I understand that given a pure state $ |\psi\rangle$, we can express it in terms of two angles $\theta$ and $\varphi$ such that $|\psi\rangle = \cos(\theta/2)|0\rangle + \mathrm{e}^{i\varphi}\sin(\theta/2)|1\rangle $, and this is derived by converting from $|\psi\rangle = \alpha|0\rangle + \beta|1\rangle$ into their representations in terms of $r\mathrm{e}^{i\theta}$, and then factoring and rearranging that.
But how do I convert between the two representations given arbitrary states? I know that $|0\rangle = (\theta,\varphi) = (0,0), |1\rangle = (\pi,0), |+\rangle = (\pi/2, 0)$ etc, but how do I get it for an arbitrary state $|\psi\rangle$?
So far, I have:
- If $\alpha$ is complex, shift the entire state by phase $\bar{\alpha}$, where $\bar\alpha$ is the complex conjugate of $\alpha$, to end up with $\alpha\bar\alpha |0\rangle + \bar\alpha\beta|1\rangle$
- Use the formulas:
$$ \theta = 2 \arccos(\alpha\bar\alpha) \\ \varphi = ??? $$