1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Derivative with respect to a unit vector: is my computation right?

  1. Oct 28, 2012 #1
    Hi all!
    I must compute a derivative with respect to the components of a unit vector [itex]\hat{p}^{i}[/itex]. In spherical coordinates,
    [itex]\hat{p}^{1}=\hat{p}^{1}(\theta,\phi)=\cos\theta \sin\phi[/itex]

    I want to express the derivative [itex]\frac{\partial}{\partial\hat{p}^1}[/itex] as a combination of [itex]\frac{\partial}{\partial\theta}[/itex] and [itex]\frac{\partial}{\partial\phi}[/itex].
    What I did is:
    [itex]\frac{\partial f}{\partial\hat{p}^1}=\frac{\partial f}{\partial\theta}\frac{\partial\theta}{\partial \hat{p}^1}+\frac{\partial f}{\partial\phi}\frac{\partial\phi}{\partial\hat{p}^1}[/itex]

    Since [itex]\frac{\partial\hat{p}^1}{\partial\theta}=-\sin\theta\sin\phi[/itex] and [itex]\frac{\partial\hat{p}^i}{\partial\phi}=\cos\theta \cos\phi[/itex] I thought
    [itex]\frac{\partial\theta}{\partial\hat{p}^1}=-\frac{1}{\sin\theta\sin\phi}[/itex] and [itex]\frac{\partial\phi}{\partial\hat{p}^1}=\frac{1}{ \cos\theta\cos\phi}[/itex]

    so that the final derivative is
    [itex]\frac{\partial f}{\partial\hat{p}^1}=-\frac{1}{\sin\theta\sin\phi}\frac{\partial f}{\partial\theta}+\frac{1}{\cos\theta\cos\phi} \frac{\partial f}{\partial\phi}[/itex]

    I would like to know if all this is correct. Thanks in advance!
  2. jcsd
  3. Oct 29, 2012 #2
  4. Oct 29, 2012 #3
    Your unit vector looks like a scalar with magnitude that isn't 1. It could be I am not familiar with the notation.

    But what I spotted was the inverting of a partial derivative. In functions of one variable, it is valid to invert dy/dx to get dx/dy but this is not generally true of partial differentials. Lookup Jacobians to find out how to do it.
  5. Oct 29, 2012 #4
    Thanks for replying!

    [itex]\hat{p}^1[/itex] is the first component of a unit vector, the other two are

    Could you please explain further what you mean by looking up the Jacobian to find out how to invert partial derivatives?
    Thanks again!
  6. Oct 30, 2012 #5
    I saw above you did ∂p/∂θ => ∂θ/∂p . This is not true.

    Just for an easy example, consider cartesian and polar in 2d. We have this:

    x=r cosθ
    y=r sinθ

    This tells how to convert from polar to cartesian coordinates and we can use these functions to find all partial derivatives of x or y with respect to r,θ in a straightforward manner. Finding partials of r,θ with respect to x,y would involve first solving for r,θ in terms of x,y and then taking the partials.

    Let's do one.

    ∂x/∂r = cosθ

    ∂r/∂x = x/√(x2+y2) = cosθ
    (above I used tanθ = y/x)

    Notice ∂x/∂r ≠ (∂r/∂x)-1

    So the intuitive guess didn't work, take a closer look at what is happening. The polar to cartesian functions are explicitly defining x,y in terms of r,θ but if we regard x,y as the independent variables, they are also implicity defining r,θ. So rewrite the equations like so:

    f1(x,y,r(x,y),θ(x,y)) = 0 = x -rcosθ
    f2(x,y,r(x,y),θ(x,y)) = 0 = y -rsinθ

    I have decided I want x,y to be independent and r,θ will be the functions I am after; this is like solving the above equations for r,θ in terms of x,y as I did with r=√(x2+y2)

    I'm after ∂r/∂x so let's take partial derivatives of those two equations wrt x:

    ∂f1/∂x = 1 + rsinθ ∂θ/∂x - cosθ ∂r/∂x = 0
    ∂f2/∂x = -rcosθ ∂θ/∂x - sinθ ∂r/∂x = 0

    Arrange this into a matrix with ∂θ/∂x and ∂r/∂x being the unknowns and solve for ∂r/∂x using Cramer's Rule. You'll find ∂r/∂x = cosθ

    This prodecure can be generalized and the matrix you get (as I found above) is called the Jacobian. You can then use the Jacobian to compute the inverted partials.
  7. Oct 30, 2012 #6
    Thank you very much!
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook