Day 4 · Spherical Coordinate Variance¶
Edited by Charles and Sophia
Statistics · Symmetry · Expectation · Variance
Original question on OpenQuant
Problem¶
Choose a point \((X,Y,Z)\) uniformly by surface area on the surface of the unit sphere, centered at the origin. Find \(\operatorname{Var}(Z)\).
The source says a random point "on the unit sphere"; here we make the intended uniform-surface assumption explicit. Choosing uniformly inside the solid ball or choosing the polar angle uniformly is a different experiment.
Core idea
Every sampled point satisfies \(X^2+Y^2+Z^2=1\). Uniform surface sampling treats all three axes identically, so their expected squared coordinates are equal. They must therefore share the total expectation of one equally.
Short solution¶
1. Start from the definition of variance¶
We need the mean and the second moment separately. A mean of zero does not imply a second moment of zero.
2. Show that the mean is zero¶
Reflecting any surface patch through the plane \(z=0\) preserves its area and changes \(Z\) to \(-Z\). Uniform sampling therefore gives \(Z\) and \(-Z\) the same distribution. Consequently,
3. Explain exactly why E[Z²] = 1/3¶
First, use the sphere equation. For every outcome, not merely on average,
Take expectations of both sides and use linearity:
Linearity of expectation does not require independence. In fact, the coordinates are constrained by the sphere equation and are not independent.
Next, use rotational symmetry. Swapping coordinate axes preserves both the sphere and its uniform surface-area distribution. No axis is favored, so \(X\), \(Y\), and \(Z\) have the same marginal distribution. Thus
Write their common value as \(a\). The previous equation becomes
Therefore,
This says the average squared height over random surface points is \(1/3\). It does not say that every point has \(Z^2=1/3\). At a pole \(Z^2=1\); at the equator \(Z^2=0\). Those different outcomes average to \(1/3\) under uniform surface sampling.
4. Substitute into the variance formula¶
Answer
Watch out
\(E[Z^2]\) and \((E[Z])^2\) are different quantities: here they are \(1/3\) and \(0\). The sphere equation alone is also insufficient: a distribution concentrated at the poles still lies on the sphere but has \(E[Z^2]=1\). Uniform rotational symmetry is what makes the three second moments equal.
Independent derivation: Z is uniform on [-1, 1]
Use polar angle \(\theta\in[0,\pi]\) and azimuth \(\phi\in[0,2\pi)\). On the unit sphere, \(z=\cos\theta\) and the area element is
Since \(|dz|=\sin\theta\,d\theta\), integrating around a full horizontal band gives area \(2\pi\,dz\) for a height interval of width \(dz\). Divide by the total area \(4\pi\):
Thus \(Z\sim\operatorname{Uniform}[-1,1]\), and directly
Although a band near a pole has a smaller circumference, its surface width per unit change in height is larger. The factors cancel, giving equal surface area for equal height intervals.
Derivation by conditioning: fix X and Y, then integrate
1. Given \((X,Y)\), what is \(Z\)? Once \((X,Y)=(x,y)\) is known, the sphere equation leaves only two possible heights:
Reflection through the plane \(z=0\) preserves area, so the two signs are equally likely:
Either way, \(Z^2\) takes the same value, so
2. Find the density of \((X,Y)\). Project the sphere onto the unit disk \(x^2+y^2\le1\). On the upper hemisphere \(z=\sqrt{1-x^2-y^2}\), the surface element is
The lower hemisphere contributes the same amount. Dividing the total by \(4\pi\) gives
This density blows up at the rim because the sphere is nearly vertical there: a tiny patch \(dx\,dy\) near the equator sits under a large piece of surface.
3. Average over \((X,Y)\) (law of total expectation).
Switch to polar coordinates, \(x^2+y^2=r^2\), \(dx\,dy=r\,dr\,d\phi\):
Bonus. The same conditioning gives \(E[Z\mid X,Y]=0\), so \(E[Z]=0\) as well. As a sanity check, the density integrates to one: \(\int_0^1\frac{r}{\sqrt{1-r^2}}\,dr=1\).
Why a uniform polar angle gives the wrong experiment
If instead \(\theta\sim\operatorname{Uniform}[0,\pi]\), then
That sampling scheme overweights the poles. For uniform surface sampling, the polar angle density is \(f_\Theta(\theta)=\tfrac12\sin\theta\), not a constant. Uniform \(Z\) and uniform azimuth produce the intended surface distribution.
Generalization: a sphere of radius R
For a uniformly sampled surface point on a sphere of radius \(R\) centered at the origin, symmetry gives \(E[Z]=0\) and \(3E[Z^2]=R^2\). Hence \(\operatorname{Var}(Z)=R^2/3\).