V3 - cartesian to spherical

vCalc Reviewed
Equation / Last modified by AndrewBudd on 2018/10/12 16:04
`V (rho,theta, phi) = `
vCalc.V3 - cartesian to spherical

The Cartesian to Spherical formula calculates the spherical coordinatesV3 - Cartesian to Spherical.pngVector in 3D for a vector given its Cartesian coordinates.   

INSTRUCTIONS: Enter the following:

  • (V): Enter the x, y and z  components of V separated by commas (e.g. 3,4,5)

This formula lets the user enter three Cartesian coordinates (X, Y and Z)   This algorithm converts the spherical coordinates.  The length (`rho`) of the vector is in the units entered.  The angles (`theta` and `phi`) are returned in decimal degrees.  

Spherical Coordinates

In mathematics, a spherical coordinate system is a coordinate system for three-dimensional space where the position of a point is specified by three numbers: the radial distance of that point from a fixed origin, its polar angle measured from a fixed zenith direction, and the azimuth angle of its orthogonal projection on a reference plane that passes through the origin and is orthogonal to the zenith, measured from a fixed reference direction on that plane.

The radial distance is also called the radius or radial coordinate. The polar angle may be called co-latitude, zenith angle, normal angle, or inclination angle.

The use of symbols and the order of the coordinates differs between sources. In one system frequently encountered in physics (r, θ, φ) gives the radial distance, polar angle, and azimuthal angle, whereas in another system used in many mathematics books (r, θ, φ) gives the radial distance, azimuthal angle, and polar angle. In both systems ρ is often used instead of r. Other conventions are also used, so great care needs to be taken to check which one is being used.

A number of different spherical coordinate systems following other conventions are used outside mathematics. In a geographical coordinate system positions are measured in latitude, longitude and height or altitude. There are a number of different celestial coordinate systems based on different fundamental planes and with different terms for the various coordinates. The spherical coordinate systems used in mathematics normally use radians rather than degrees and measure the azimuthal angle counter-clockwise rather than clockwise[further explanation needed]. The inclination angle is often replaced by the elevation angle measured from the reference plane. Elevation angle of zero is at the horizon.

The spherical coordinate system generalises the two-dimensional polar coordinate system. It can also be extended to higher-dimensional spaces and is then referred to as a hyperspherical coordinate system.


To define a spherical coordinate system, one must choose two orthogonal directions, the zenith and the azimuth reference, and an origin point in space. These choices determine a reference plane that contains the origin and is perpendicular to the zenith. The spherical coordinates of a point P are then defined as follows:

    The radius or radial distance is the Euclidean distance from the origin O to P.
    The inclination (or polar angle) is the angle between the zenith direction and the line segment OP.
    The azimuth (or azimuthal angle) is the signed angle measured from the azimuth reference direction to the orthogonal projection of the line segment OP on the reference plane.

The sign of the azimuth is determined by choosing what is a positive sense of turning about the zenith. This choice is arbitrary, and is part of the coordinate system's definition.

The elevation angle is 90 degrees (π/2 radians) minus the inclination angle.

If the inclination is zero or 180 degrees (π radians), the azimuth is arbitrary. If the radius is zero, both azimuth and inclination are arbitrary.

In linear algebra, the vector from the origin O to the point P is often called the position vector of P.


Several different conventions exist for representing the three coordinates, and for the order in which they should be written. The use of (r, θ, φ) to denote radial distance, inclination (or elevation), and azimuth, respectively, is common practice in physics, and is specified by ISO standard 80000-2 :2009, and earlier in ISO 31-11 (1992).

However, some authors (including mathematicians) use φ for inclination (or elevation) and θ for azimuth, which "provides a logical extension of the usual polar coordinates notation". Some authors may also list the azimuth before the inclination (or elevation), and/or use ρ (rho) instead of r for radial distance. Some combinations of these choices result in a left-handed coordinate system. The standard convention (r, θ, φ) conflicts with the usual notation for the two-dimensional polar coordinates, where θ is often used for the azimuth. It may also conflict with the notation used for three-dimensional cylindrical coordinates. 

The angles are typically measured in degrees (°) or radians (rad), where 360° = 2π rad. Degrees are most common in geography, astronomy, and engineering, whereas radians are commonly used in mathematics and theoretical physics. The unit for radial distance is usually determined by the context.

When the system is used for physical three-space, it is customary to use positive sign for azimuth angles that are measured in the counter-clockwise sense from the reference direction on the reference plane, as seen from the zenith side of the plane. This convention is used, in particular, for geographical coordinates, where the "zenith" direction is north and positive azimuth (longitude) angles are measured eastwards from some prime meridian.

3D Vector Functions