thumb|The physics convention. Spherical coordinates (, , ) as commonly used: ([[International Organization for Standardization|ISO 80000-2:2019): radial distance (slant distance to origin), polar angle (theta) (angle with respect to positive polar axis), and azimuthal angle (phi) (angle of rotation from the initial meridian plane). This is the convention followed in this article.]]
In mathematics, a spherical coordinate system specifies a given point in three-dimensional space by using a distance and two angles as its three coordinates. These are
- the radial distance along the line connecting the point to a fixed point called the origin;
- the polar angle between this radial line and a given polar axis; and
- the azimuthal angle , which is the angle of rotation of the radial line around the polar axis.
(See graphic regarding the "physics convention".) <!-- Please maintain the bolding of symbols and terms (in the first occurrence only) for ease of distinguishing same while introducing them to reader, but do not forget to also apply italics for scalars. -->
Once the radius is fixed, the three coordinates (r, θ, φ), known as a 3-tuple, provide a coordinate system on a sphere, typically called the spherical polar coordinates.
The plane passing through the origin and perpendicular to the polar axis (where the polar angle is a right angle) is called the reference plane (sometimes fundamental plane).
Terminology
The radial distance from the fixed point of origin is also called the radius, or radial line, or radial coordinate. The polar angle may be called inclination angle, zenith angle, normal angle, or the colatitude. The user may choose to replace the inclination angle by its complement, the elevation angle (or altitude angle), measured upward between the reference plane and the radial linei.e., from the reference plane upward (towards to the positive z-axis) to the radial line. The depression angle is the negative of the elevation angle. (See graphic re the "physics convention"not "mathematics convention".)
Both the use of symbols and the naming order of tuple coordinates differ among the several sources and disciplines. This article will use the ISO convention frequently encountered in physics, where the naming tuple gives the order as: radial distance, polar angle, azimuthal angle, or <math>(r,\theta,\varphi)</math>. (See graphic re the "physics convention".) In contrast, the conventions in many mathematics books and texts give the naming order differently as: radial distance, "azimuthal angle", "polar angle", and <math>(\rho,\theta,\varphi)</math> or <math>(r,\theta,\varphi)</math>which switches the uses and meanings of symbols θ and φ. Other conventions may also be used, such as r for a radius from the z-axis that is not from the point of origin. Particular care must be taken to check the meaning of the symbols. <!-- Please maintain a consistent convention in this article. -->
thumb|The mathematics convention. Spherical coordinates as typically used: radial distance , azimuthal angle , and polar angle . + The meanings of and have been swappedcompared to the physics convention. The 'south'-direction x-axis is depicted but the 'north'-direction x-axis is not. (As in physics, ([[rho) is often used instead of to avoid confusion with the value in cylindrical and 2D polar coordinates.)]]
According to the conventions of geographical coordinate systems, positions are measured by latitude, longitude, and height (altitude). There are a number of 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; (note 90 degrees equals radians). And these systems of the mathematics convention may measure the azimuthal angle counterclockwise (i.e., from the south direction -axis, or 180°, towards the east direction -axis, or +90°)rather than measure clockwise (i.e., from the north direction x-axis, or 0°, towards the east direction y-axis, or +90°), as done in the horizontal coordinate system. (See graphic re "mathematics convention".)
The spherical coordinate system of the physics convention can be seen as a generalization of the polar coordinate system in three-dimensional space.
It can be further extended to higher-dimensional spaces, and is then referred to as a hyperspherical coordinate system.
Definition
To define a spherical coordinate system, one must designate an origin point in space, ', and two orthogonal directions: the zenith reference direction and the azimuth reference direction. These choices determine a reference plane that is typically defined as containing the point of origin and the x and yaxes, either of which may be designated as the azimuth reference direction. The reference plane is perpendicular (orthogonal) to the zenith direction, and typically is designated "horizontal" to the zenith direction's "vertical". The spherical coordinates of a point then are defined as follows:
- The radius or radial distance is the Euclidean distance from the origin ' to '.
- The inclination (or polar angle) is the signed angle from the zenith reference direction to the line segment . (Elevation may be used as the polar angle instead of inclination; see below.)
- The azimuth (or azimuthal angle) is the signed angle measured from the azimuth reference direction to the orthogonal projection of the radial line segment on the reference plane.
The sign of the azimuth is determined by designating the rotation that is the positive sense of turning about the zenith. This choice is arbitrary, and is part of the coordinate system definition.
(If the inclination is either zero or 180 degrees (= radians), the azimuth is arbitrary. If the radius is zero, both azimuth and inclination are arbitrary.)
The elevation is the signed angle from the x-y reference plane to the radial line segment , where positive angles are designated as upward, towards the zenith reference. Elevation is 90 degrees (= radians) minus inclination. Thus, if the inclination is 60 degrees (= radians), then the elevation is 30 degrees (= radians).
In linear algebra, the vector from the origin to the point is often called the position vector of P.
Conventions
Several different conventions exist for representing spherical coordinates and prescribing the naming order of their symbols. The 3-tuple number set <math>(r,\theta,\varphi)</math> denotes radial distance, the polar angle"inclination", or as the alternative, "elevation"and the azimuthal angle. It is the common practice within the physics convention, as specified by ISO standard 80000-2:2019, and earlier in ISO 31-11 (1992).
As stated above, this article describes the ISO "physics convention"unless otherwise noted.
However, some authors (including mathematicians) use the symbol ρ (rho) for radius, or radial distance, φ for inclination (or elevation) and θ for azimuthwhile others keep the use of r for the radius; all which "provides a logical extension of the usual polar coordinates notation". As to order, some authors list the azimuth before the inclination (or the elevation) angle. Some combinations of these choices result in a left-handed coordinate system. The standard "physics convention" 3-tuple set <math>(r,\theta,\varphi)</math> conflicts with the usual notation for two-dimensional polar coordinates and three-dimensional cylindrical coordinates, where is often used for the azimuth.
In geography
Instead of inclination, the geographic coordinate system uses elevation angle (or latitude), in the range (aka domain) and rotated north from the equator plane. Latitude (i.e., the angle of latitude) may be either geocentric latitude, measured (rotated) from the Earth's centerand designated variously by or geodetic latitude, measured (rotated) from the observer's local vertical, and typically designated .
The polar angle (inclination), which is 90° minus the latitude and ranges from 0 to 180°, is called colatitude in geography.
The azimuth angle (or longitude) of a given position on Earth, commonly denoted by , is measured in degrees east or west from some conventional reference meridian (most commonly the IERS Reference Meridian); thus its domain (or range) is and a given reading is typically designated "East" or "West". For positions on the Earth or other solid celestial body, the reference plane is usually taken to be the plane perpendicular to the axis of rotation. <!--Must explain the conventions for positive latitude and longitude-->
Instead of the radial distance geographers commonly use altitude above or below some local reference surface (vertical datum), which, for example, may be the mean sea level. When needed, the radial distance can be computed from the altitude by adding the radius of Earth, which is approximately .
However, modern geographical coordinate systems are quite complex, and the positions implied by these simple formulae may be inaccurate by several kilometers. The precise standard meanings of latitude, longitude and altitude are currently defined by the World Geodetic System (WGS), and take into account the flattening of the Earth at the poles (about ) and many other details.
Planetary coordinate systems use formulations analogous to the geographic coordinate system.
In astronomy
A series of astronomical coordinate systems are used to measure the elevation angle from several fundamental planes. These reference planes include:
the observer's horizon, the galactic equator (defined by the rotation of the Milky Way), the celestial equator (defined by Earth's rotation), the plane of the ecliptic (defined by Earth's orbit around the Sun), and the plane of the earth terminator (normal to the instantaneous direction to the Sun).
Coordinate system conversions
As the spherical coordinate system is only one of many three-dimensional coordinate systems, there exist equations for converting coordinates between the spherical coordinate system and others.
Cartesian coordinates
The spherical coordinates of a point in the ISO convention (i.e. for physics: radius , inclination , azimuth ) can be obtained from its Cartesian coordinates by the formulae
<math display="block">\begin{align}
r &= \sqrt{x^2 + y^2 + z^2} \\
\theta &= \arccos\frac{z}{\sqrt{x^2 + y^2 + z^2 = \arccos\frac{z}{r}=
\begin{cases}
\arctan\frac{\sqrt{x^2+y^2{z} &\text{if } z > 0 \\
\pi +\arctan\frac{\sqrt{x^2+y^2{z} &\text{if } z < 0 \\
+\frac{\pi}{2} &\text{if } z = 0 \text{ and } \sqrt{x^2+y^2} \neq 0 \\
\text{undefined} &\text{if } x=y=z = 0 \\
\end{cases} \\
\varphi &= \sgn(y)\arccos\frac{x}{\sqrt{x^2+y^2 =
\begin{cases}
\arctan(\frac{y}{x}) &\text{if } x > 0, \\
\arctan(\frac{y}{x}) + \pi &\text{if } x < 0 \text{ and } y \geq 0, \\
\arctan(\frac{y}{x}) - \pi &\text{if } x < 0 \text{ and } y < 0, \\
+\frac{\pi}{2} &\text{if } x = 0 \text{ and } y > 0, \\
-\frac{\pi}{2} &\text{if } x = 0 \text{ and } y < 0, \\
\text{undefined} &\text{if } x = 0 \text{ and } y = 0.
\end{cases}
\end{align}</math>
where .
The inverse tangent denoted in must be suitably defined, taking into account the correct quadrant of , as done in the equations above. See the article on atan2.
Alternatively, the conversion can be considered as two sequential rectangular to polar conversions: the first in the Cartesian plane from to , where is the projection of onto the -plane, and the second in the Cartesian -plane from to . The correct quadrants for and are implied by the correctness of the planar rectangular to polar conversions.
These formulae assume that the two systems have the same origin, that the spherical reference plane is the Cartesian plane, that is inclination from the direction, and that the azimuth angles are measured from the Cartesian axis (so that the axis has ). If θ measures elevation from the reference plane instead of inclination from the zenith the arccos above becomes an arcsin, and the and below become switched.
Conversely, the Cartesian coordinates may be retrieved from the spherical coordinates (radius , inclination , azimuth ), where , , , by
<math display="block">\begin{align}
x &= r \sin\theta \, \cos\varphi, \\
y &= r \sin\theta \, \sin\varphi, \\
z &= r \cos\theta.
\end{align}</math>
Cylindrical coordinates
<!-- if you notice--rho and r are described opposite of convention here--someone with extra time could remedy this -->
Cylindrical coordinates (axial radius ρ, azimuth <!--radians--> φ, elevation z) may be converted into spherical coordinates (central radius r, inclination θ, azimuth φ), by the formulas
<math display="block">\begin{align}
r &= \sqrt{\rho^2 + z^2}, \\
\theta &= \arctan\frac{\rho}{z} = \arccos\frac{z}{\sqrt{\rho^2 + z^2, \\
\varphi &= \varphi.
\end{align}</math>
Conversely, the spherical coordinates may be converted into cylindrical coordinates by the formulae
<math display="block">\begin{align}
\rho &= r \sin \theta, \\
\varphi &= \varphi, \\
z &= r \cos \theta.
\end{align}</math>
These formulae assume that the two systems have the same origin and same reference plane, measure the azimuth angle in the same senses from the same axis, and that the spherical angle is inclination from the cylindrical axis.
Ellipsoidal coordinates
It is also possible to deal with ellipsoids in Cartesian coordinates by using a modified version of the spherical coordinates.
Let P be an ellipsoid specified by the level set
<math display="block">ax^2 + by^2 + cz^2 = d.</math>
The modified spherical coordinates of a point in P in the ISO convention (i.e. for physics: radius , inclination , azimuth ) can be obtained from its Cartesian coordinates by the formulae
<math display="block">\begin{align}
x &= \frac{1}{\sqrt{a r \sin\theta \, \cos\varphi, \\
y &= \frac{1}{\sqrt{b r \sin\theta \, \sin\varphi, \\
z &= \frac{1}{\sqrt{c r \cos\theta, \\
r^{2} &= ax^2 + by^2 + cz^2.
\end{align}</math>
An infinitesimal volume element is given by
<math display="block">
\mathrm{d}V = \left|\frac{\partial(x, y, z)}{\partial(r, \theta, \varphi)}\right| \, dr\,d\theta\,d\varphi =
\frac{1}{\sqrt{abc r^2 \sin \theta \,\mathrm{d}r \,\mathrm{d}\theta \,\mathrm{d}\varphi =
\frac{1}{\sqrt{abc r^2 \,\mathrm{d}r \,\mathrm{d}\Omega.
</math>
The square-root factor comes from the property of the determinant that allows a constant to be pulled out from a column:
<math display="block">
\begin{vmatrix}
ka & b & c \\
kd & e & f \\
kg & h & i
\end{vmatrix} =
k \begin{vmatrix}
a & b & c \\
d & e & f \\
g & h & i
\end{vmatrix}.
</math>
Integration and differentiation in spherical coordinates
thumb|Unit vectors in spherical coordinates
The following equations (Iyanaga 1977) assume that the colatitude is the inclination from the positive axis, as in the physics convention discussed.
The line element for an infinitesimal displacement from to is
<math display="block">
\mathrm{d}\mathbf{r} = \mathrm{d}r\,\hat{\mathbf r} + r\,\mathrm{d}\theta \,\hat{\boldsymbol\theta } + r \sin{\theta} \, \mathrm{d}\varphi\,\mathbf{\hat{\boldsymbol\varphi,</math>
where
<math display="block">\begin{align}
\hat{\mathbf r} &= \sin \theta \cos \varphi \,\hat{\mathbf x} +
\sin \theta \sin \varphi \,\hat{\mathbf y} + \cos \theta \,\hat{\mathbf z}, \\
\hat{\boldsymbol\theta} &= \cos \theta \cos \varphi \,\hat{\mathbf x} +
\cos \theta \sin \varphi \,\hat{\mathbf y} - \sin \theta \,\hat{\mathbf z}, \\
\hat{\boldsymbol\varphi} &= - \sin \varphi \,\hat{\mathbf x} +
\cos \varphi \,\hat{\mathbf y}
\end{align}</math>
are the local orthogonal unit vectors in the directions of increasing , , and , respectively,
and , , and are the unit vectors in Cartesian coordinates. The linear transformation to this right-handed coordinate triplet is a rotation matrix,
<math display="block">R = \begin{pmatrix}
\sin\theta\cos\varphi&\sin\theta\sin\varphi&\hphantom{-}\cos\theta\\
\cos\theta\cos\varphi&\cos\theta\sin\varphi&-\sin\theta\\
-\sin\varphi&\cos\varphi &\hphantom{-}0
\end{pmatrix}.
</math>
This gives the transformation from the Cartesian to the spherical, the other way around is given by its inverse.
Note: the matrix is an orthogonal matrix, that is, its inverse is simply its transpose.
The Cartesian unit vectors are thus related to the spherical unit vectors by:
<math display="block">\begin{bmatrix}\mathbf{\hat x} \\ \mathbf{\hat y} \\ \mathbf{\hat z} \end{bmatrix}
= \begin{bmatrix} \sin\theta\cos\varphi & \cos\theta\cos\varphi & -\sin\varphi \\
\sin\theta\sin\varphi & \cos\theta\sin\varphi & \hphantom{-}\cos\varphi \\
\cos\theta & -\sin\theta & \hphantom{-}0 \end{bmatrix}
\begin{bmatrix} \boldsymbol{\hat{r \\ \boldsymbol{\hat\theta} \\ \boldsymbol{\hat\varphi} \end{bmatrix}</math>
The general form of the formula to prove the differential line element, is
<math display="block">\mathrm{d}\mathbf{r} =
\sum_i \frac{\partial \mathbf{r{\partial x_i} \,\mathrm{d}x_i =
\sum_i \left|\frac{\partial \mathbf{r{\partial x_i}\right|
\frac{\frac{\partial \mathbf{r{\partial x_i{\left|\frac{\partial \mathbf{r{\partial x_i}\right|} \, \mathrm{d}x_i =
\sum_i \left|\frac{\partial \mathbf{r{\partial x_i}\right| \,\mathrm{d}x_i \, \hat{\boldsymbol{x_i,
</math>
that is, the change in <math>\mathbf r</math> is decomposed into individual changes corresponding to changes in the individual coordinates.
To apply this to the present case, one needs to calculate how <math>\mathbf r</math> changes with each of the coordinates. In the conventions used,
<math display="block">\mathbf{r} = \begin{bmatrix}
r \sin\theta \, \cos\varphi \\
r \sin\theta \, \sin\varphi \\
r \cos\theta
\end{bmatrix},
x_1=r, x_2=\theta, x_3=\varphi.</math>
Thus,
<math display="block">
\frac{\partial\mathbf r}{\partial r} = \begin{bmatrix}
\sin\theta \, \cos\varphi \\
\sin\theta \, \sin\varphi \\
\cos\theta
\end{bmatrix}=\mathbf{\hat r}, \quad
\frac{\partial\mathbf r}{\partial \theta} = \begin{bmatrix}
r \cos\theta \, \cos\varphi \\
r \cos\theta \, \sin\varphi \\
-r \sin\theta
\end{bmatrix}=r\,\hat{\boldsymbol\theta }, \quad
\frac{\partial\mathbf r}{\partial \varphi} = \begin{bmatrix}
-r \sin\theta \, \sin\varphi \\
\hphantom{-}r \sin\theta \, \cos\varphi \\
0
\end{bmatrix}
=
r \sin\theta\,\mathbf{\hat{\boldsymbol\varphi .
</math>
The desired coefficients are the magnitudes of these vectors:
<math display="block">\begin{align}
D &= \sqrt{r^2+r'^2-2rr'(\sin{\theta}\sin{\theta'}\cos{(\varphi-\varphi')} + \cos{\theta}\cos{\theta'})}
\end{align}</math>
The angle <math> \gamma </math> between the two points can be found from their dot product in Cartesian coordinates:
<math display="block"> \cos \gamma = \cos \theta \cos \theta' + \sin \theta \sin \theta' (\cos \phi \cos \phi' + \sin \phi \sin \phi') </math>
which by the angle difference identity for cosine is
<math display="block"> \cos \gamma = \cos \theta \cos \theta' + \sin \theta \sin \theta' \cos(\phi - \phi') </math>
Kinematics
In spherical coordinates, the position of a point or particle (although better written as a triple <math>(r,\theta, \varphi)</math>) can be written as
<math display="block">\mathbf{r} = r \mathbf{\hat r} .</math>
Its velocity is then
