Spin expectation value (source code)

= Spin expectation value
{title2=$\langle S_z\rangle=\hbar\cos\theta/2$}

For <spin one-half>, choose the normalized <spin> <eigenstates> $|+z\rangle,|-z\rangle$ with $S_z|\pm z\rangle=\pm(\hbar/2)|\pm z\rangle$. The <spin one-half along an axis> <pure state> in the $xz$ plane is
$$
|\psi_\theta\rangle=\cos(\theta/2)|+z\rangle+\sin(\theta/2)|-z\rangle,\qquad 0\leq\theta\leq\pi.
$$
Its <norm> is one because the two <eigenstates> are <orthogonal> and $\cos^2(\theta/2)+\sin^2(\theta/2)=1$. Applying the <Born rule> to a $z$ <projective measurement> gives
$$
p_+=\cos^2(\theta/2)=\frac{1+\cos\theta}{2},\qquad
p_-=\sin^2(\theta/2)=\frac{1-\cos\theta}{2}.
$$
Consequently the <expectation value>, second moment, and <variance> are
$$
\langle S_z\rangle=\frac{\hbar}{2}(p_+-p_-)=\frac{\hbar}{2}\cos\theta,\qquad
\langle S_z^2\rangle=\frac{\hbar^2}{4},\qquad
(\Delta S_z)^2=\frac{\hbar^2}{4}\sin^2\theta.
$$
At $\theta=\pi/3$, the outcome <probabilities> are $3/4$ and $1/4$, the mean is $\hbar/4$, and the <variance> is $3\hbar^2/16$. Every individual outcome remains $\pm\hbar/2$. At $\theta=\pi/2$, the mean is zero and the <variance> is maximal, $\hbar^2/4$. At either pole, one outcome has <probability> one and the <variance> vanishes.

\Image[/spin-expectation-outcome-probabilities.png]
{title=<Spin expectation value> between the two possible $S_z$ outcomes}
{description=Original calculated <Born rule> distributions at three preparation angles. Bar heights are outcome <probabilities>; the dashed orange line marks the <expectation value>, whose horizontal position is usually not an allowed outcome. Spin values are expressed in units of the reduced <Planck constant>. No bars represent experimental observations.}
{source=spin-expectation-outcome-probabilities.py}

The diagonal <mixed state> $\rho_{\rm diag}=p_+|+z\rangle\langle+z|+p_-|-z\rangle\langle-z|$ has the same $S_z$ <probabilities>, <expectation value>, and <variance> as $|\psi_\theta\rangle$. It is nevertheless a different <quantum state> for $0<\theta<\pi$: the displayed <pure state> has $\langle S_x\rangle=\hbar\sin\theta/2$, while $\rho_{\rm diag}$ has $\langle S_x\rangle=0$. A single component's mean does not reveal all relative <quantum phases> or establish <purity of a density operator>.