Expressing cartesian unit vectors in terms of spherical unit vectors

Click For Summary

Discussion Overview

The discussion revolves around expressing Cartesian unit vectors \(\hat{x}\), \(\hat{y}\), and \(\hat{z}\) in terms of spherical unit vectors \(\hat{r}\), \(\hat{\theta}\), and \(\hat{\phi}\). Participants explore various methods, including geometric interpretations and algebraic approaches, while also referencing related transformations in polar coordinates.

Discussion Character

  • Exploratory
  • Technical explanation
  • Mathematical reasoning
  • Debate/contested

Main Points Raised

  • One participant expresses frustration in converting Cartesian unit vectors to spherical unit vectors and mentions success in polar coordinates.
  • Another participant provides the relationships for Cartesian coordinates in spherical form: \(x = r \sin(\phi) \cos(\theta)\), \(y = r \sin(\phi) \sin(\theta)\), \(z = r \cos(\phi)\).
  • A suggestion is made to use the gradient of the coordinate functions expressed in spherical coordinates to derive the Cartesian unit vectors, noting that this approach may be circular.
  • Some participants discuss the normalization of the gradient and how it relates to the direction of the unit vectors.
  • There is mention of a common misunderstanding regarding the inverse transformation, with references to the popularity of expressing spherical unit vectors in terms of Cartesian coordinates.
  • One participant attempts to clarify the gradient calculation for the \(z\) coordinate and its implications for deriving the unit vectors.
  • Another participant corrects a previous statement regarding the components of the gradient, emphasizing the cancellation of terms in the final expression.

Areas of Agreement / Disagreement

Participants generally agree on the methods to approach the problem but express differing opinions on the clarity and effectiveness of these methods. There is no consensus on a definitive solution or approach.

Contextual Notes

Some participants note the complexity of the transformations and the potential for confusion, particularly regarding the normalization of gradients and the relationships between the coordinate systems. The discussion includes unresolved mathematical steps and assumptions about the transformations.

Repetit
Messages
128
Reaction score
2
This is driving me crazy, I just can't see how to do it. I want to express the cartesian unit vectors \hat{x}, \hat{y} and \hat{z} in terms of the spherical unit vectors \hat{r}, \hat{\theta} and \hat{\phi}. I have tried to do something similar in polar coordinates (just to make it a bit simpler for myself) but that didn't really help a lot. I have figured out how to express the polar unit vectors in terms of cartesian ones:

\hat{\theta} = -sin(\theta)\hat{x} + cos(\theta) \hat{y}
\hat{r} = cos(\theta) \hat{x} + sin(\theta) \hat{y}

... and I think I can do that for spherical coordinates too. But I can't see how to do it the other way around (polar to cartesian). If you could just help me do it for polar coords I think I will be able to adapt it to spherical.

Thanks!
 
  • Like
Likes   Reactions: elias3dchabi
Physics news on Phys.org
x = r \sin(\phi) \cos(\theta)

y = r \sin(\phi) \sin(\theta)

z = r \cos(\phi)
 
Last edited:
You could do it geometrically if you can draw the pictures carefully. An arguably easier algebraic way to do it is to use the fact that, eg, \hat x = \nabla(x), where x is the scalar function returning the x coordinate of a point (ie, the function f(x,y,z)=x). You can write this function in terms of r,\theta,\phi using the formulas uart gave and then calculate the gradient in spherical coordinates. Of course, this is really a little circular, as you would usually use the expression for \hat x in spherical coordinates to derive the form of the gradient in spherical coordinates.
 
Last edited:
Repetit said:
This is driving me crazy, I just can't see how to do it. I want to express the cartesian unit vectors \hat{x}, \hat{y} and \hat{z} in terms of the spherical unit vectors \hat{r}, \hat{\theta} and \hat{\phi}. I have tried to do something similar in polar coordinates (just to make it a bit simpler for myself) but that didn't really help a lot. I have figured out how to express the polar unit vectors in terms of cartesian ones:

\hat{\theta} = -sin(\theta)\hat{x} + cos(\theta) \hat{y}
\hat{r} = cos(\theta) \hat{x} + sin(\theta) \hat{y}

... and I think I can do that for spherical coordinates too. But I can't see how to do it the other way around (polar to cartesian). If you could just help me do it for polar coords I think I will be able to adapt it to spherical.

Thanks!
Your equations there for polar coords form a linear system with two equations and two unknowns. You can solve them for \hat{x} and \hat{y}. If you can set up the same type of system for spherical coords, then just do the same thing there (you'll have 3 eqns and 3 unknowns)!
 
Last edited:
This is a problem I have seen a lot on the internet, and no one seems to know what the asker is talking about. We want to know how to express the CARTESIAN unit vectors \hat{x}, \hat{y}, \hat{z} in terms of the spherical coordinates r, \theta, and \phi and their respective unit vectors.

The inverse, that is expressing \hat{r}, \hat{\theta}, \hat{\phi} in terms of Cartesian unit vectors (but spherical coordinates!) is pretty popular. It's easy to find a reference online that shows:

<br /> \hat{r} = sin(\theta)cos(\phi)\hat{x} + sin(\theta)sin(\phi)\hat{y} + cos(\theta)\hat{z} <br />, etc...

(Note: going to stop using LaTeX here, something's wrong with either my code or the compiler...)

But what about the other way around? Well, the above comments are on the right track: if you think about it, the gradient of a coordinate is a vector that points in the direction of increase of that coordinate axis. We know how to express z as a function of spherical coordinates. So, the gradient of z(r, theta, phi) is a vector that points in the z-hat direction.

Now we just need to normalize the vector. But wait! Recall that the magnitude of the gradient is just the "slope" of the scalar function along the direction of maximum increase. Well, think about the scalar function f(r, theta, phi) = z. That function is just a line along the z-axis, that increases at a rate of 1. So the gradient, in this case, is already normalized!

The main point: to find a Cartesian unit vector in terms of spherical coordinates AND spherical unit vectors, take the spherical gradient of that coordinate. For example (this is going to be tough without LaTeX, but hopefully you will follow):

z = rcos(theta)

Now, recall the gradient operator in spherical coordinates.

grad(z) = (partial z w/r/t r, 1/r partial z w/r/t theta, 1/rsin(theta) partial z w/r/t phi).

partial z w/r/t r = cos(theta)

partial z w/r/t theta = -rsin(theta)

partial z w/r/t phi = 0

so: grad(z) = cos(theta) r-hat + -sin(theta) theta-hat = z-hat in spherical coordinates!


and so on with x and y.

Hopefully that makes sense. If I can figure out the LaTeX it will be easier to read.
 
  • Like
Likes   Reactions: realanswers and (deleted member)
tstin said:
This is a problem I have seen a lot on the internet, and no one seems to know what the asker is talking about. We want to know how to express the CARTESIAN unit vectors \hat{x}, \hat{y}, \hat{z} in terms of the spherical coordinates r, \theta, and \phi and their respective unit vectors.

The inverse, that is expressing \hat{r}, \hat{\theta}, \hat{\phi} in terms of Cartesian unit vectors (but spherical coordinates!) is pretty popular. It's easy to find a reference online that shows:

<br /> \hat{r} = sin(\theta)cos(\phi)\hat{x} + sin(\theta)sin(\phi)\hat{y} + cos(\theta)\hat{z} <br />, etc...

(Note: going to stop using LaTeX here, something's wrong with either my code or the compiler...)

But what about the other way around? Well, the above comments are on the right track: if you think about it, the gradient of a coordinate is a vector that points in the direction of increase of that coordinate axis. We know how to express z as a function of spherical coordinates. So, the gradient of z(r, theta, phi) is a vector that points in the z-hat direction.

Now we just need to normalize the vector. But wait! Recall that the magnitude of the gradient is just the "slope" of the scalar function along the direction of maximum increase. Well, think about the scalar function f(r, theta, phi) = z. That function is just a line along the z-axis, that increases at a rate of 1. So the gradient, in this case, is already normalized!

The main point: to find a Cartesian unit vector in terms of spherical coordinates AND spherical unit vectors, take the spherical gradient of that coordinate. For example (this is going to be tough without LaTeX, but hopefully you will follow):

z = rcos(theta)

Now, recall the gradient operator in spherical coordinates.

grad(z) = (partial z w/r/t r, 1/r partial z w/r/t theta, 1/rsin(theta) partial z w/r/t phi).

partial z w/r/t r = cos(theta)

partial z w/r/t theta = -rsin(theta)

partial z w/r/t phi = 0

so: grad(z) = cos(theta) r-hat + -sin(theta) theta-hat = z-hat in spherical coordinates!


and so on with x and y.

Hopefully that makes sense. If I can figure out the LaTeX it will be easier to read.

z=r cos(\theta)

\nabla z = \left(\frac{\partial z}{\partial r}, \frac{1}{r} \frac{\partial z}{\partial \theta}, \frac{1}{r sin(\theta)} \frac{\partial z}{\partial \phi}\right)

\frac{\partial z}{\partial r} = cos(\theta)

\frac{\partial z}{\partial \theta} = -r sin(\theta)

\frac{\partial z}{\partial \phi} = 0

\nabla z = cos(\theta) \hat{r} - r sin(\theta) \hat{\theta} = \hat{z}

There's your LaTeX for you.
 
  • Like
Likes   Reactions: khossain4337
Char. Limit said:
\nabla z = cos(\theta) \hat{r} - r sin(\theta) \hat{\theta} = \hat{z}

There's your LaTeX for you.

Thanks for the LaTeX help, but note that the r's cancel in the \hat{\theta} component of the final solution because the \hat{\theta} component of the gradient in spehrical coordinates has a 1/r in it already. So the last line should read


\nabla z = cos(\theta) \hat{r} - sin(\theta) \hat{\theta} = \hat{z}

And to clarify: you can do a similar thing with the other cartesian unit vectors:

1) Express the cartesian COORDINATE in spherical coordinates. (Essentially, we're "pretending" the coordinate is a scalar function of spherical variables.)
2) Take the gradient of the coordinate, using the spherical form of the gradient. That just IS the unit vector of that coordinate axis.


Hope this helps. It took me a while to figure it out, so maybe this will save some people some time.
 
  • Like
Likes   Reactions: khossain4337
tstin, thanks a lot for your post, it helped a lot!
 
I know its an old post, but I just wanted to add this here.
http://upload.wikimedia.org/wikipedia/en/math/3/b/0/3b0f088344e3a78604cdbd2227fff791.png
Note: the matrix is an orthogonal matrix, that is, its inverse is simply its transpose.
Find the transpose of that matrix and you are done :)
All from wikipedia (http://en.wikipedia.org/wiki/Vector_fields_in_cylindrical_and_spherical_coordinates)

This is not as rigorous as what tstin posted, but it is much faster :) Also makes it easy to relate the unit vectors in spherical polar and cylindrical coordinates, once you know their transformation matrix from Cartesian coord.
 
Last edited:
  • #10
That's right... essentially, what I described above is the same as calculating the Jacobian, which is the matrix given by TAMEPLAH. A more rigorous description of coordinate transformations would involve a discussion of Jacobians and why they work and stuff... that's for whoever's feeling ambitions (or understands those things, which I currently don't).
 

Similar threads

Replies
3
Views
3K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 12 ·
Replies
12
Views
5K
  • · Replies 33 ·
2
Replies
33
Views
5K
  • · Replies 1 ·
Replies
1
Views
3K
Replies
7
Views
3K
  • · Replies 14 ·
Replies
14
Views
3K
  • · Replies 10 ·
Replies
10
Views
6K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 14 ·
Replies
14
Views
2K