# Spherical coordinates

My question is really about converting between spherical coordinates and cartesian coordinates.
Suppose that ##\phi## and ##\theta## are defined as follows:
##\phi## is the angle between the position vector of a point and the ##z##-axis. ##\theta## is the angle between the projection of that vector onto the ##xy##-plane and the ##x##-axis.
Why exactly do we write ##x = r \sin{\phi} \cos{\theta}##?
I know that we first project the position vector onto the ##xy##-plane before projecting that projection onto the ##x##-axis. But if that were the case, shouldn't we write ##x = |r \sin{\phi}| \cos{\theta}##?
I'm confused because the quantity ##r \sin{\phi}## is, on occasion, negative. I thought we're only allowed to project "lengths" or "positive scalars". I am fully aware of the fact that the projection can itself be negative, but the whole notion that the length (not the final projection) which is to be projected can be negative isn't so intuitive.
Take for example a circle of radius ##r## centred at the origin. I'll define ##t## as the angle made with the ##x##-axis. ##x = r \cos{\theta}##. ##x## is allowed to be positive or negative, but ##r## is always positive.

Khashishi
##\phi## is only defined on the domain ##0<\phi<\pi/2## so ##\sin(\phi) \ge 0##

##\phi## is only defined on the domain ##0<\phi<\pi/2## so ##\sin(\phi) \ge 0##

Isn't the choice of the interval somewhat arbitrary?
When dealing with polar coordinates for instance, we work on either ##(-\pi, \pi]## or ##[0, 2\pi)##.

Khashishi
Well, that's the standard convention. You can choose another convention if you want, but you'll have to deal with ##\sin(\phi) < 0## somehow, so the standard convention makes a lot of sense.

PFuser1232
Well, that's the standard convention. You can choose another convention if you want, but you'll have to deal with ##\sin(\phi) < 0## somehow, so the standard convention makes a lot of sense.

Thanks!
But am I correct in assuming that projecting a "negative length" is meaningless?
Also, I believe the domain you are talking about is ##0 \leq \phi \leq \pi##, not ##0 \leq \phi \leq \frac{\pi}{2}##.

Khashishi
Also, I believe the domain you are talking about is ##0 \leq \phi \leq \pi##, not ##0 \leq \phi \leq \frac{\pi}{2}##.
Oops!

In some situations, you can interpret a negative length as a length in the opposite direction.

Oops!

In some situations, you can interpret a negative length as a length in the opposite direction.

Well, yeah. But not in this particular example, right?

HallsofIvy
Homework Helper
Given the spherical coordinates as you say, the z coordinate is easy. If we draw a line from the given point perpendicular to the z-axis, $\phi$ is the angle in a right triangle having the straight line from the origin to the point, of length $\rho$, as hypotenuse and the height above the xy-plane as "near side": so $z= \rho cos(\phi)$.

Now consider the projection of that point in the xy-plane, (x, y, 0). The straight line from the origin to (x, y, 0) is the "opposite side" to $\phi$ of a right triangle having $\rho$ as hypotenuse- its length is $\rho sin(\phi)$. And that line is the hypotenuse of a right triangle in the xy-plane with angle $\theta$ and "near side" of length x, "opposite side" of length y. $x/r= cos(\theta)$ so $x= r cos(\theta)= \rho sin(\phi) cos(\theta)$ and $y/r= sin(\theta)$ so $y= r sin(\theta)= \rho sin(\phi)sin(\theta)$.

PFuser1232
Given the spherical coordinates as you say, the z coordinate is easy. If we draw a line from the given point perpendicular to the z-axis, $\phi$ is the angle in a right triangle having the straight line from the origin to the point, of length $\rho$, as hypotenuse and the height above the xy-plane as "near side": so $z= \rho cos(\phi)$.

Now consider the projection of that point in the xy-plane, (x, y, 0). The straight line from the origin to (x, y, 0) is the "opposite side" to $\phi$ of a right triangle having $\rho$ as hypotenuse- its length is $\rho sin(\phi)$. And that line is the hypotenuse of a right triangle in the xy-plane with angle $\theta$ and "near side" of length x, "opposite side" of length y. $x/r= cos(\theta)$ so $x= r cos(\theta)= \rho sin(\phi) cos(\theta)$ and $y/r= sin(\theta)$ so $y= r sin(\theta)= \rho sin(\phi)sin(\theta)$.

And the length ##\rho \sin{\phi}## is always positive, right?

HallsofIvy
Homework Helper
$\rho$ itself is a distance so always positive. $\phi$ is between 0 and $\pi$ so $sin(\phi)$ is positive. Yes, their product, the product of positive numbers, is positive.

PFuser1232
Mark44
Mentor
$\rho$ itself is a distance so always positive.
Per wikipedia, "always" is too strong.
It is also convenient, in many contexts, to allow negative radial distances, with the convention that (−r, θ, φ) is equivalent to (r, θ + 180°, φ) for any r, θ, and φ.
-- https://en.wikipedia.org/wiki/Spherical_coordinate_system

Note that for some reason they are using r instead of ##\rho##, which is more commonly used in spherical coordinates.
HallsofIvy said:
$\phi$ is between 0 and $\pi$ so $sin(\phi)$ is positive. Yes, their product, the product of positive numbers, is positive.

$\rho$ itself is a distance so always positive. $\phi$ is between 0 and $\pi$ so $sin(\phi)$ is positive. Yes, their product, the product of positive numbers, is positive.

So unlike polar coordinates, ##\phi## is always restricted to be between 0 and ##\pi##.

Mark44
Mentor
So unlike polar coordinates, ##\phi## is always restricted to be between 0 and ##\pi##.
Not according to the same article whose link I posted earlier.
If it is necessary to define a unique set of spherical coordinates for each point, one may restrict their ranges. A common choice is:

r ≥ 0
0° ≤ θ ≤ 180° (π rad)
0° ≤ φ < 360° (2π rad)
However, the azimuth φ is often restricted to the interval (−180°, +180°], or (−π, +π] in radians, instead of [0, 360°). This is the standard convention for geographic longitude.

Not according to the same article whose link I posted earlier.
Not according to the same article whose link I posted earlier.

Which brings me to my initial question; how can we project a "negative length" onto a plane?

Mark44
Mentor
You can project a positive length onto a plane, right? The projection of a "negative length" would be just as long but would point in the opposite direction.

PFuser1232
You can project a positive length onto a plane, right? The projection of a "negative length" would be just as long but would point in the opposite direction.
So, is it wrong to write ##x = |\rho \sin{\phi}| \cos{\theta}## (where ##\phi## is the angle between the position vector of a point and the ##z##-axis)?

HallsofIvy
Homework Helper
Yes, it is. What is correct is that $x= \rho sin(\phi) cos(\theta)$. There should be no absolute value since x, which is a coordinate, not a distance, can be negative.

Yes, it is. What is correct is that $x= \rho sin(\phi) cos(\theta)$. There should be no absolute value since x, which is a coordinate, not a distance, can be negative.
It could still be negative if ##x = |\rho \sin{\phi}| \cos{θ}##; there are no absolute value bars around ##\cos{θ}##.

HallsofIvy
Homework Helper
Right. I should have said that the absolute value bars are not necessary here. $\rho$, a distance, is always positive and since $\phi$ lies between 0 and $\pi$, $sin(\phi)$ is always positive $\rho sin(\phi)$ cannot be negative..

Mark44
Mentor
Right. I should have said that the absolute value bars are not necessary here. $\rho$, a distance, is always positive and since $\phi$ lies between 0 and $\pi$, $sin(\phi)$ is always positive $\rho sin(\phi)$ cannot be negative..
For what it's worth, and to repeat what I said in post #11, wikipedia disagrees that ##\rho## is always positive -- https://en.wikipedia.org/wiki/Spherical_coordinate_system

For what it's worth, and to repeat what I said in post #11, wikipedia disagrees that ##\rho## is always positive -- https://en.wikipedia.org/wiki/Spherical_coordinate_system
How do we define ##\phi## anyway? I thought the concept of "positive - counterclockwise, negative - clockwise" only makes sense in a plane, not in three dimensional space.

Mark44
Mentor
How do we define ##\phi## anyway? I thought the concept of "positive - counterclockwise, negative - clockwise" only makes sense in a plane, not in three dimensional space.
##\phi## is the angle between the z-axis and the ray along which you measure ##\rho##. The z-axis and the ray define a plane.

##\phi## is the angle between the z-axis and the ray along which you measure ##\rho##. The z-axis and the ray define a plane.
How do we define negative angles in that case?

HallsofIvy
In this specific case, we don't. $\phi$ is always between 0 and $\pi$. It is never negative.
In this specific case, we don't. $\phi$ is always between 0 and $\pi$. It is never negative.