Tutorials › Calculus III › Deriving The Spherical Coordinate Formulas

Cylindrical and Spherical Coordinates · Tutorial 284 of 999

Deriving The Spherical Coordinate Formulas

Derive each spherical-to-Cartesian relation from projection and planar components, including why the projected radius is \(\rho\sin\phi\).

Intermediate 10 min read

What You'll Learn

  • Interpret \(\rho\), \(\theta\), and \(\phi\) geometrically.
  • Derive the signed vertical relation \(z=\rho\cos\phi\).
  • Prove that the \(xy\)-plane projection has radius \(r=\rho\sin\phi\).
  • Resolve the projection into signed \(x\)- and \(y\)-components.
  • Apply and verify the spherical-to-Cartesian formulas.
  • Identify the errors caused by treating signed coordinates as triangle side lengths.

Why Derive the Spherical Coordinate Formulas?

Spherical coordinates describe a point by its distance from the origin and two angles. The resulting conversion formulas are compact, but their signs and geometric meaning matter: a right triangle has nonnegative side lengths, whereas Cartesian coordinates can be negative. A sound derivation keeps those facts distinct.

We use the spherical convention in which \(\rho\) is the distance from the origin, \(\theta\) is the directed azimuth in the \(xy\)-plane measured from the positive \(x\)-axis, and \(\phi\) is the angle from the positive \(z\)-axis. For \(\rho>0\), take \(0\leq\phi\leq\pi\). The symbol \(r\) will denote the distance of the point’s projection from the origin in the \(xy\)-plane.

Definition: For a point \(P=(x,y,z)\), its distance from the origin is \(\rho=\sqrt{x^2+y^2+z^2}\), and the radius of its projection onto the \(xy\)-plane is \(r=\sqrt{x^2+y^2}\). The spherical angles are the azimuth \(\theta\) of that projection and the angle \(\phi\) between the position vector and the positive \(z\)-axis.

The goal is to derive the relations between \((\rho,\theta,\phi)\) and \((x,y,z)\), not to rely on a memorized formula. We will first determine the vertical coordinate and the projection radius, then resolve that projection into its two signed components.

Vertical Component and Planar Projection

Let \(O\) be the origin, \(P=(x,y,z)\), and \(Q=(x,y,0)\) be the projection of \(P\) onto the \(xy\)-plane. The lengths \(OP\), \(OQ\), and \(QP\) are respectively \(\rho\), \(r\), and \(|z|\). Since \(OQ\) is perpendicular to the \(z\)-axis, triangle \(OQP\) is a right triangle, so its side lengths satisfy

$$ \rho^2=r^2+z^2. $$

This length equation is useful, but by itself it does not determine the sign of \(z\). That sign comes from the angle \(\phi\), which is measured from the positive \(z\)-axis. In vector terms, the position vector is \(\mathbf{p}=\langle x,y,z\rangle\), and the unit vector in the positive \(z\)-direction is \(\mathbf{k}=\langle 0,0,1\rangle\). For \(\rho>0\), the dot-product formula for the angle between two vectors gives

$$ \cos\phi = \frac{\mathbf{p}\cdot\mathbf{k}}{\|\mathbf{p}\|\,\|\mathbf{k}\|} = \frac{z}{\rho}. $$

Here \(\mathbf{p}\cdot\mathbf{k}=z\), \(\|\mathbf{p}\|=\rho\), and \(\|\mathbf{k}\|=1\). Rearranging gives \(z=\rho\cos\phi\). This relation retains the sign: when \(P\) is below the \(xy\)-plane, \(\phi\) is obtuse and \(\cos\phi<0\), so \(z<0\).

Now substitute \(z=\rho\cos\phi\) into the right-triangle length equation. This determines the radius \(r\) of the projection:

$$ \begin{aligned} r^2 &=\rho^2-z^2\\ &=\rho^2-(\rho\cos\phi)^2\\ &=\rho^2(1-\cos^2\phi)\\ &=\rho^2\sin^2\phi. \end{aligned} $$

Because \(r\) is a length, \(r\geq0\). Also, \(0\leq\phi\leq\pi\), so \(\sin\phi\geq0\). Taking the nonnegative square root therefore gives

$$ r=\rho\sin\phi. $$

This reasoning handles points both above and below the \(xy\)-plane. The right triangle uses \(|z|\) as a side length; the signed vertical coordinate comes from the angle with the positive \(z\)-axis. In particular, one should not infer that \(z\) is a nonnegative side length.

Key result: The vertical coordinate is \(z=\rho\cos\phi\), while the radius of the projection onto the \(xy\)-plane is \(r=\rho\sin\phi\). The second relation is nonnegative because \(r\geq0\) and \(\sin\phi\geq0\) for \(0\leq\phi\leq\pi\).

Resolving the Projection into \(x\) and \(y\)

The point \(Q\) lies in the \(xy\)-plane at distance \(r\) from the origin. Its direction is specified by the directed azimuth \(\theta\), measured from the positive \(x\)-axis. In the plane, the direction of \(OQ\) is the unit vector \(\langle\cos\theta,\sin\theta\rangle\). Multiplying by the projection’s length \(r\), its signed components are

$$ x=r\cos\theta, \qquad y=r\sin\theta. $$

These are component equations, not claims that \(x\) and \(y\) are always nonnegative triangle side lengths. The signs are supplied by the directed angle: for example, \(\cos\theta<0\) when the projection points to the left of the \(y\)-axis, and \(\sin\theta<0\) when it points below the \(x\)-axis.

Substituting \(r=\rho\sin\phi\) into the two planar component equations produces the Cartesian coordinates directly.

1
Determine the vertical component.
The angle from the positive \(z\)-axis gives \(z=\rho\cos\phi\), with its sign determined by \(\cos\phi\).
2
Determine the projection radius.
The right-triangle relation and \(0\leq\phi\leq\pi\) give \(r=\rho\sin\phi\).
3
Resolve the projection horizontally.
The directed azimuth gives \(x=r\cos\theta\) and \(y=r\sin\theta\).
Derived formulas: With \(\rho\geq0\), azimuth \(\theta\), and \(0\leq\phi\leq\pi\), the spherical coordinates give $$ x=\rho\sin\phi\cos\theta,\qquad y=\rho\sin\phi\sin\theta,\qquad z=\rho\cos\phi. $$

Worked Examples

Worked Example: Deriving Spherical Coordinates from a Point Below the Plane

Find spherical coordinates for \(P=(-3,3,-3\sqrt{2})\), using the stated convention.

First compute the distance from the origin:

$$ \begin{aligned} \rho &=\sqrt{x^2+y^2+z^2}\\ &=\sqrt{(-3)^2+3^2+(-3\sqrt{2})^2}\\ &=\sqrt{9+9+18}\\ &=\sqrt{36}=6. \end{aligned} $$

The projection radius is

$$ r=\sqrt{x^2+y^2} =\sqrt{9+9} =\sqrt{18} =3\sqrt{2}. $$

Use the signed vertical relation to find \(\phi\):

$$ \cos\phi=\frac{z}{\rho} =\frac{-3\sqrt{2}}{6} =-\frac{\sqrt{2}}{2}. $$

Since \(\phi\in[0,\pi]\), this gives \(\phi=3\pi/4\). The projection has \(x<0\) and \(y>0\), so its directed azimuth is \(\theta=3\pi/4\). Check by converting back:

$$ \begin{aligned} x&=6\sin(3\pi/4)\cos(3\pi/4) =6\left(\frac{\sqrt2}{2}\right)\left(-\frac{\sqrt2}{2}\right)=-3,\\ y&=6\sin(3\pi/4)\sin(3\pi/4) =6\left(\frac{\sqrt2}{2}\right)\left(\frac{\sqrt2}{2}\right)=3,\\ z&=6\cos(3\pi/4) =6\left(-\frac{\sqrt2}{2}\right)=-3\sqrt2. \end{aligned} $$

All three coordinates match the original point, including the negative \(z\)-coordinate.

Worked Example: Converting Spherical Coordinates to Cartesian Coordinates

Let \(\rho=8\), \(\theta=\pi/3\), and \(\phi=2\pi/3\). Find \((x,y,z)\).

First find the projection radius:

$$ r=\rho\sin\phi =8\sin(2\pi/3) =8\left(\frac{\sqrt3}{2}\right) =4\sqrt3. $$

Now resolve the projection into its signed planar components and compute the vertical component:

$$ \begin{aligned} x&=r\cos\theta =4\sqrt3\cos(\pi/3) =4\sqrt3\left(\frac12\right) =2\sqrt3,\\ y&=r\sin\theta =4\sqrt3\sin(\pi/3) =4\sqrt3\left(\frac{\sqrt3}{2}\right) =6,\\ z&=\rho\cos\phi =8\cos(2\pi/3) =8\left(-\frac12\right) =-4. \end{aligned} $$

Thus the Cartesian point is \((2\sqrt3,6,-4)\). Check its distance:

$$ x^2+y^2+z^2 =(2\sqrt3)^2+6^2+(-4)^2 =12+36+16 =64 =8^2. $$

The distance agrees with the given \(\rho=8\), and the negative \(z\)-coordinate agrees with the obtuse value of \(\phi\).

Worked Example: A Projection with a Negative \(y\)-Coordinate

Let \(\rho=10\), \(\theta=5\pi/3\), and \(\phi=\pi/3\). Find and check the Cartesian coordinates.

The projection radius is

$$ r=10\sin(\pi/3) =10\left(\frac{\sqrt3}{2}\right) =5\sqrt3. $$

Using the directed azimuth, \(\cos(5\pi/3)=1/2\) and \(\sin(5\pi/3)=-\sqrt3/2\). Therefore

$$ \begin{aligned} x&=5\sqrt3\left(\frac12\right)=\frac{5\sqrt3}{2},\\ y&=5\sqrt3\left(-\frac{\sqrt3}{2}\right)=-\frac{15}{2},\\ z&=10\cos(\pi/3)=10\left(\frac12\right)=5. \end{aligned} $$

Check the distance using these coordinates:

$$ x^2+y^2+z^2 =\frac{75}{4}+\frac{225}{4}+25 =\frac{300}{4}+25 =75+25 =100 =10^2. $$

The negative \(y\)-coordinate is correct: the projection points below the \(x\)-axis in the plane, as indicated by \(\sin(5\pi/3)<0\).

A Common Mistake: Using Side Lengths for Signed Coordinates

A frequent error is to treat \(z\), \(x\), and \(y\) as if they were always nonnegative sides of right triangles. For example, suppose \(\rho=1\) and \(\phi=2\pi/3\). A mistaken calculation might use the acute interior angle \(\pi/3\) in the vertical triangle and conclude

$$ z=\rho\cos(\pi/3)=\frac12. $$

That result is wrong: the point is below the \(xy\)-plane. The angle \(\phi\) is measured from the positive \(z\)-axis, so the signed relation gives

$$ z=\rho\cos\phi =1\cos(2\pi/3) =-\frac12. $$

The projection radius remains a nonnegative length:

$$ r=\rho\sin\phi =1\sin(2\pi/3) =\frac{\sqrt3}{2}. $$

The analogous planar mistake is to call \(x\) the adjacent side and \(y\) the opposite side without accounting for the direction of \(\theta\). For an azimuth such as \(5\pi/6\), \(\cos\theta<0\), so \(x=r\cos\theta\) is negative even though \(r\) is a length. The correct interpretation is that \(x\) and \(y\) are signed components of the projection.

Pitfall to avoid: Use nonnegative lengths for the sides of a right triangle, but use signed component formulas for Cartesian coordinates. In particular, \(r=\rho\sin\phi\) is a length, whereas \(z=\rho\cos\phi\) is signed.

Why These Relations Are Useful

The derivation separates the geometry into two steps. The angle \(\phi\) controls how the distance \(\rho\) splits into a vertical component and a planar projection. The azimuth \(\theta\) then determines the direction of that projection within the plane. This separation makes the formulas easier to remember and helps diagnose sign errors.

It also gives immediate checks. Since \(r^2=x^2+y^2\), the planar equations imply

$$ x^2+y^2 =r^2(\cos^2\theta+\sin^2\theta) =r^2. $$

Combining this with \(r=\rho\sin\phi\) and \(z=\rho\cos\phi\) yields

$$ x^2+y^2+z^2 =\rho^2\sin^2\phi+\rho^2\cos^2\phi =\rho^2. $$

This verifies that the derived Cartesian coordinates lie at distance \(\rho\) from the origin. The formulas also behave sensibly at the axis: if \(\phi=0\) or \(\phi=\pi\), then \(r=0\), so \(x=y=0\), while \(z=\rho\) or \(z=-\rho\), respectively. At the origin, \(\rho=0\) makes all three Cartesian coordinates zero regardless of the angles.

Check Your Understanding

Use the projection and signed-component reasoning above to answer these questions.

  1. Why does \(z=\rho\cos\phi\) remain valid when the point is below the \(xy\)-plane?
  2. Starting from \(\rho^2=r^2+z^2\) and \(z=\rho\cos\phi\), derive \(r=\rho\sin\phi\). Which range condition on \(\phi\) ensures the nonnegative square root is \(\rho\sin\phi\)?
  3. For \(\rho=4\), \(\theta=\pi\), and \(\phi=\pi/3\), find \(x\), \(y\), and \(z\), then verify that \(x^2+y^2+z^2=16\).
  4. For a projection with \(\theta=3\pi/2\) and \(r>0\), which of \(x\) and \(y\) are zero, positive, or negative? Explain using the signed component formulas.
  5. Explain why the right-triangle side lengths alone do not determine the sign of \(z\).