Cylindrical and spherical coordinates, compared to Cartesian

Two views of the same point P, each swapping out two of the three Cartesian numbers for a distance and one or two angles.

Cylindrical: (ρ, θ, z)

x y z θ ρ z P P'
ρ and z (linear) θ (azimuthal angle)

Drop P straight down onto the xy-plane to get P′. Then:

  • ρ — flat distance from the origin to P′
  • θ — angle swept from the x-axis to O→P′, in the xy-plane
  • z — the same Cartesian height as before, untouched
x = ρ cos θ,   y = ρ sin θ,   z = z

Spherical: (r, θ, φ)

x y z P' θ φ r P
r (straight-line distance) θ (azimuthal, shared with cylindrical) φ (polar angle, from z-axis)

Same point P. Instead of projecting first, draw the straight line O→P directly:

  • r — straight-line distance from the origin to P
  • θ — the same azimuthal angle as the cylindrical picture
  • φ — the new angle: swept from the z-axis down to O→P, not from the ground plane
x = r cos θ sin φ,   y = r sin θ sin φ,   z = r cos φ
Notation trap worth remembering: the θ/φ role split above is the "mathematical" convention (θ = azimuthal, φ = polar). The common physics/ISO convention swaps them (φ = azimuthal, θ = polar), and MATLAB's cart2sph typically returns elevation rather than the polar angle at all. Always check which angle is measured from the z-axis before trusting a formula from a new source.