Understanding the spherical and cylindrical coordinates converter — concept and principle
This converter takes a point in 3D Cartesian coordinates (x, y, z) and expresses it in two curvilinear systems. Cylindrical coordinates (ρ, θ, z) keep the height z and use polar coordinates in the xy-plane. Spherical coordinates (r, θ, φ) use the distance from the origin and two angles. They are used for triple integrals, electric and gravitational fields, antenna patterns, and anything with an axis or a centre of symmetry.
How it is calculated
- Cylindrical: ρ = √(x² + y²), θ = atan2(y, x), z unchanged.
- Spherical: r = √(x² + y² + z²), θ = atan2(y, x), φ = arccos(z / r).
Angles are shown in degrees. In this calculator θ is the azimuth, measured in the xy-plane counter-clockwise from the +x axis (−180° to 180°), and φ is the polar angle measured down from the +z axis (0° to 180°). Distances use the same unit as x, y and z.
The principle
Project the point onto the xy-plane: its shadow is at distance ρ from the z-axis, and the direction of that shadow is the azimuth θ, exactly as in 2D polar coordinates. Adding z gives cylindrical coordinates. For spherical coordinates, the 3D Pythagorean theorem gives r, and the right triangle formed by r, z and ρ gives cos φ = z / r and sin φ = ρ / r. Going back: x = r sin φ cos θ, y = r sin φ sin θ, z = r cos φ, and ρ = r sin φ.
Worked example
- Default inputs: x = 1, y = 1, z = 1.
- ρ = √(1 + 1) = √2 = 1.414213562.
- θ = atan2(1, 1) = 45°.
- r = √(1 + 1 + 1) = √3 = 1.732050808.
- φ = arccos(1 / √3) = arccos(0.57735) = 54.73561032°.
- Results: spherical 1.732050808, θ 45°, φ 54.73561032°; cylindrical 1.414213562, 45°, 1.
How to read the result
φ = 0° means the point lies on the positive z-axis, φ = 90° means it lies in the xy-plane, and φ = 180° means it lies on the negative z-axis. A negative θ means the point's shadow is below the x-axis (y < 0). The point (1, 1, 1) is the corner of a unit cube; 54.7356° is the well-known angle between a cube's space diagonal and its edge.
Common mistakes
- Swapping the names θ and φ. The international standard ISO 80000-2 and most physics texts use θ for the polar angle and φ for the azimuth, while many calculus texts do the reverse, as this calculator does. Always check which convention a formula assumes.
- Using latitude instead of the polar angle: latitude = 90° − φ.
- Using arctan(y/x) and placing the azimuth in the wrong quadrant.
Frequently asked questions
How do I convert spherical back to Cartesian?
With θ as azimuth and φ as polar angle: x = r sin φ cos θ, y = r sin φ sin θ, z = r cos φ.
What is the volume element in these systems?
Cylindrical: dV = ρ dρ dθ dz. Spherical: dV = r² sin φ dr dθ dφ (with φ the polar angle).
Is this the same as latitude and longitude?
Nearly. Longitude corresponds to θ, and latitude is 90° − φ, but geographic coordinates on Earth also use an ellipsoid, not a perfect sphere.
Sources: ISO 80000-2:2019, Quantities and units — Part 2: Mathematics (coordinate systems) · James Stewart, Calculus: Early Transcendentals, sections on cylindrical and spherical coordinates