We may define a coordinate system in an -dimensional Euclidean space which is analogous to the
spherical coordinate system defined for -dimensional Euclidean space, in which the coordinates consist of a radial coordinate , and angular coordinates {{tmath|\varphi_1, \varphi_2, \ldots, \varphi_{n-1} }}, where the angles {{tmath|\varphi_1, \varphi_2, \ldots, \varphi_{n-2} }} range over radians (or degrees) and {{tmath|\varphi_{n-1} }} ranges over radians (or degrees). If are the Cartesian coordinates, then we may compute from {{tmath|r, \varphi_1, \ldots, \varphi_{n-1} }} with:{{efn|1=Formally, this formula is only correct for . For , the line beginning with must be omitted, and for , the formula for
polar coordinates must be used. The case reduces to . Using
capital-pi notation and the usual convention for the
empty product, a formula valid for is given by {{tmath|1=\textstyle x_n = r\prod_{i=1}^{n-1} \sin \varphi_i }} and {{tmath|1=\textstyle x_k =r \cos \varphi_k\prod_{i=1}^{k-1} \sin \varphi_i }} for .}} :\begin{align} x_1 &= r \cos(\varphi_1), \\[5mu] x_2 &= r \sin(\varphi_1) \cos(\varphi_2), \\[5mu] x_3 &= r \sin(\varphi_1) \sin(\varphi_2) \cos(\varphi_3), \\ &\qquad \vdots\\ x_{n-1} &= r \sin(\varphi_1) \cdots \sin(\varphi_{n-2}) \cos(\varphi_{n-1}), \\[5mu] x_n &= r \sin(\varphi_1) \cdots \sin(\varphi_{n-2}) \sin(\varphi_{n-1}). \end{align} Except in the special cases described below, the inverse transformation is unique: : \begin{align} r &= {\textstyle \sqrt{{x_n}^2 + {x_{n-1}}^2 + \cdots + {x_2}^2 + {x_1}^2}}, \\[5mu] \varphi_1 &= \operatorname{atan2} \left({\textstyle \sqrt{{x_n}^2 + {x_{n-1}}^2 + \cdots + {x_2}^2}}, x_{1}\right), \\[5mu] \varphi_2 &= \operatorname{atan2} \left({\textstyle \sqrt{{x_n}^2 + {x_{n-1}}^2 + \cdots + {x_3}^2}}, x_{2}\right), \\ &\qquad \vdots\\ \varphi_{n-2} &= \operatorname{atan2} \left({\textstyle \sqrt{{x_n}^2 + {x_{n-1}}^2}}, x_{n-2}\right), \\[5mu] \varphi_{n-1} &= \operatorname{atan2} \left(x_n, x_{n-1}\right). \end{align} where is the two-argument arctangent function. There are some special cases where the inverse transform is not unique; for any will be ambiguous whenever all of {{tmath|x_k, x_{k+1}, \ldots x_n}} are zero; in this case may be chosen to be zero. (For example, for the -sphere, when the polar angle is or then the point is one of the poles, zenith or nadir, and the choice of azimuthal angle is arbitrary.)
Spherical volume and area elements The arc length element isd s^2=d r^2+\sum_{k=1}^{n-1} r^2\left(\prod_{m=1}^{k-1} \sin ^2\left(\varphi_m\right)\right) d \varphi_k^2To express the
volume element of -dimensional Euclidean space in terms of spherical coordinates, let and for concision, then observe that the
Jacobian matrix of the transformation is: : J_n = \begin{pmatrix} c_1 &-rs_1 &0 &0 &\cdots &0 \\ s_1c_2 &rc_1c_2 &-rs_1s_2 &0 &\cdots &0 \\ \vdots &\vdots & \vdots & &\ddots &\vdots \\ & & & & &0 \\ s_1\cdots s_{n-2}c_{n-1} &\cdots &\cdots & & &-rs_1\cdots s_{n-2}s_{n-1} \\ s_{1}\cdots s_{n-2}s_{n-1} &rc_1\cdots s_{n-1} &\cdots & & &\phantom{-}rs_1\cdots s_{n-2}c_{n-1} \end{pmatrix}. The determinant of this matrix can be calculated by induction. When , a straightforward computation shows that the determinant is . For larger , observe that can be constructed from {{tmath|J_{n-1} }} as follows. Except in column , rows and of are the same as row of {{tmath|J_{n-1} }}, but multiplied by an extra factor of {{tmath|\cos \varphi_{n-1} }} in row and an extra factor of {{tmath|\sin \varphi_{n-1} }} in row . In column , rows and of are the same as column of row of {{tmath|J_{n-1} }}, but multiplied by extra factors of {{tmath|\sin \varphi_{n-1} }} in row and {{tmath|\cos \varphi_{n-1} }} in row , respectively. The determinant of can be calculated by
Laplace expansion in the final column. By the recursive description of , the submatrix formed by deleting the entry at and its row and column almost equals {{tmath|J_{n-1} }}, except that its last row is multiplied by {{tmath|\sin \varphi_{n-1} }}. Similarly, the submatrix formed by deleting the entry at and its row and column almost equals {{tmath|J_{n-1} }}, except that its last row is multiplied by {{tmath|\cos \varphi_{n-1} }}. Therefore the determinant of is :\begin{align} &= (-1)^{(n-1)+n}(-rs_1 \dotsm s_{n-2}s_{n-1})(s_{n-1}|J_{n-1}|) \\ &\qquad {}+ (-1)^{n+n}(rs_1 \dotsm s_{n-2}c_{n-1})(c_{n-1}|J_{n-1}|) \\ &= (rs_1 \dotsm s_{n-2}|J_{n-1}|(s_{n-1}^2 + c_{n-1}^2) \\ &= (rs_1 \dotsm s_{n-2})|J_{n-1}|. \end{align} Induction then gives a
closed-form expression for the volume element in spherical coordinates :\begin{align} d^nV &= \left|\det\frac{\partial (x_i)}{\partial\left(r,\varphi_j\right)}\right| dr\,d\varphi_1 \, d\varphi_2\cdots d\varphi_{n-1} \\ &= r^{n-1}\sin^{n-2}(\varphi_1)\sin^{n-3}(\varphi_2)\cdots \sin(\varphi_{n-2})\, dr\,d\varphi_1 \, d\varphi_2\cdots d\varphi_{n-1}. \end{align} The formula for the volume of the -ball can be derived from this by integration. Similarly the surface area element of the -sphere of radius , which generalizes the
area element of the -sphere, is given by : d_{S^{n-1}}V = R^{n-1}\sin^{n-2}(\varphi_1)\sin^{n-3}(\varphi_2)\cdots \sin(\varphi_{n-2})\, d\varphi_1 \, d\varphi_2\cdots d\varphi_{n-1}. The natural choice of an
orthogonal basis over the angular coordinates is a product of
ultraspherical polynomials, : \begin{align} & {} \quad \int_0^\pi \sin^{n-j-1}\left(\varphi_j\right) C_s^{\left(\frac{n-j-1}{2}\right)}\cos \left(\varphi_j \right)C_{s'}^{\left(\frac{n-j-1}{2}\right)}\cos \left(\varphi_j\right) \, d\varphi_j \\[6pt] & = \frac{2^{3-n+j}\pi \Gamma(s+n-j-1)}{s!(2s+n-j-1)\Gamma^2\left(\frac{n-j-1}{2}\right)}\delta_{s,s'} \end{align} for , and the {{tmath|e^{is\varphi_j} }} for the angle in concordance with the
spherical harmonics.
Polyspherical coordinates The standard spherical coordinate system arises from writing as the product {{tmath|\R \times \R^{n-1} }}. These two factors may be related using polar coordinates. For each point of \R^n, the standard Cartesian coordinates :\mathbf{x} = (x_1, \dots, x_n) = (y_1, z_1, \dots, z_{n-1}) = (y_1, \mathbf{z}) can be transformed into a mixed polar–Cartesian coordinate system: :\mathbf{x} = (r\sin\theta, (r\cos\theta)\hat\mathbf{z}). This says that points in may be expressed by taking the ray starting at the origin and passing through \hat\mathbf{z}=\mathbf{z}/\lVert\mathbf{z}\rVert\in S^{n-2}, rotating it towards (1,0,\dots,0) by \theta=\arcsin y_1/r, and traveling a distance r=\lVert\mathbf{x}\rVert along the ray. Repeating this decomposition eventually leads to the standard spherical coordinate system. Polyspherical coordinate systems arise from a generalization of this construction. The space is split as the product of two Euclidean spaces of smaller dimension, but neither space is required to be a line. Specifically, suppose that and are positive integers such that . Then . Using this decomposition, a point may be written as :\mathbf{x} = (x_1, \dots, x_n) = (y_1, \dots, y_p, z_1, \dots, z_q) = (\mathbf{y}, \mathbf{z}). This can be transformed into a mixed polar–Cartesian coordinate system by writing: :\mathbf{x} = ((r\sin \theta)\hat\mathbf{y}, (r\cos \theta)\hat\mathbf{z}). Here \hat\mathbf{y} and \hat\mathbf{z} are the unit vectors associated to and . This expresses in terms of {{tmath| \hat\mathbf{y} \in S^{p-1} }}, {{tmath| \hat\mathbf{z} \in S^{q-1} }}, , and an angle . It can be shown that the domain of is if , if exactly one of and is , and if neither nor are . The inverse transformation is :\begin{align} r &= \lVert\mathbf{x}\rVert, \\ \theta &= \arcsin\frac{\lVert\mathbf{y}\rVert}{\lVert\mathbf{x}\rVert} = \arccos\frac{\lVert\mathbf{z}\rVert}{\lVert\mathbf{x}\rVert} = \arctan\frac{\lVert\mathbf{y}\rVert}{ \lVert\mathbf{z}\rVert}. \end{align} These splittings may be repeated as long as one of the factors involved has dimension two or greater. A
polyspherical coordinate system is the result of repeating these splittings until there are no Cartesian coordinates left. Splittings after the first do not require a radial coordinate because the domains of \hat\mathbf{y} and \hat\mathbf{z} are spheres, so the coordinates of a polyspherical coordinate system are a non-negative radius and angles. The possible polyspherical coordinate systems correspond to binary trees with leaves. Each non-leaf node in the tree corresponds to a splitting and determines an angular coordinate. For instance, the root of the tree represents , and its immediate children represent the first splitting into and . Leaf nodes correspond to Cartesian coordinates for {{tmath|S^{n-1} }}. The formulas for converting from polyspherical coordinates to Cartesian coordinates may be determined by finding the paths from the root to the leaf nodes. These formulas are products with one factor for each branch taken by the path. For a node whose corresponding angular coordinate is , taking the left branch introduces a factor of and taking the right branch introduces a factor of . The inverse transformation, from polyspherical coordinates to Cartesian coordinates, is determined by grouping nodes. Every pair of nodes having a common parent can be converted from a mixed polar–Cartesian coordinate system to a Cartesian coordinate system using the above formulas for a splitting. Polyspherical coordinates also have an interpretation in terms of the
special orthogonal group. A splitting determines a subgroup :\operatorname{SO}_p(\R) \times \operatorname{SO}_q(\R) \subseteq \operatorname{SO}_n(\R). This is the subgroup that leaves each of the two factors S^{p-1} \times S^{q-1} \subseteq S^{n-1} fixed. Choosing a set of
coset representatives for the quotient is the same as choosing representative angles for this step of the polyspherical coordinate decomposition. In polyspherical coordinates, the volume measure on and the area measure on {{tmath|S^{n-1} }} are products. There is one factor for each angle, and the volume measure on also has a factor for the radial coordinate. The area measure has the form: :dA_{n-1} = \prod_{i=1}^{n-1} F_i(\theta_i)\,d\theta_i, where the factors are determined by the tree. Similarly, the volume measure is :dV_n = r^{n-1}\,dr\,\prod_{i=1}^{n-1} F_i(\theta_i)\,d\theta_i. Suppose we have a node of the tree that corresponds to the decomposition {{tmath|\R^{n_1 + n_2} \R^{n_1} \times \R^{n_2} }} and that has angular coordinate . The corresponding factor depends on the values of and . When the area measure is normalized so that the area of the sphere is , these factors are as follows. If , then :F(\theta) = \frac{d\theta}{2\pi}. If and , and if denotes the
beta function, then :F(\theta) = \frac{\sin^{n_1 - 1}\theta}{\Beta(\frac{n_1}{2}, \frac{1}{2})}\,d\theta. If and , then :F(\theta) = \frac{\cos^{n_2 - 1}\theta}{\Beta(\frac{1}{2}, \frac{n_2}{2})}\,d\theta. Finally, if both and are greater than one, then :F(\theta) = \frac{(\sin^{n_1 - 1}\theta)(\cos^{n_2 - 1}\theta)}{\frac{1}{2}\Beta(\frac{n_1}{2}, \frac{n_2}{2})}\,d\theta. == Stereographic projection ==