# Parametrization of uniformly distributed n dimensional states

1. May 1, 2013

### Arubaito

Any two dimensional state can be written as:
$|\phi\rangle=\cos\frac{\theta}{2}|0\rangle+e^{i\phi}\sin\frac{\theta}{2}|1\rangle$
where $0\leq\theta\leq\pi$ and $0\leq\phi\leq 2\pi$, and $0\leq\theta\leq\pi$. To pick one such state uniformly at random it suffices to draw $\phi$ at random from its domain and $\cos\theta$ uniformly in the range $[-1,1]$. How would you do the equivalent parametrization for an n-dimensional state?

2. May 1, 2013

### tom.stoer

I think you should google for "random distribution on n-spheres"

It is not possible to use n-dim. spherical coordinates; the sample will not be distributed uniformly. However it is possible to generate a random point X uniformly distributed in the n-cube [−1,1]n, to reject it if it is outside the unit ball |X| ≤ 1, and to project the remaining points to the n-sphere. This works nice for small n, but fails for large n b/c the ratio Vol(n-sphere) / Vol(n-cube) tends to zero for large n.

Last edited: May 1, 2013
3. May 1, 2013

### Arubaito

Thanks for your pointer. Probably my question was a little ambiguous. The thing is that I want to use the parametrization to integrate over the space of states, that's why I was looking for a generalization of spherical coordinates.

4. May 1, 2013

### Staff: Mentor

The uniform distribution on the spheres gives you this generalization - you just have to add phase factors for all but one base vector afterwards.

5. May 1, 2013

### andrien

are you looking for generalization of spherical coordinates then
x1=rCos(ψ1)
x2=rSin(ψ1)Cos(ψ2) and so on
with xn=rSin(ψ1)....Sin(ψn-2)Sin(ψn-1)
ψn-1 ranges over 0 to 2∏ and other ranges from 0 to ∏.

6. May 1, 2013

### Arubaito

I am not very sure that andrien parametrization suffices. Following mfb, dou you think that something of the following form works?

$|\phi\rangle=\cos\frac{\theta_1}{2}|0\rangle + e^{i\phi_1}\sin\frac{\theta_1}{2}\cos\frac{\theta_2}{2}|1\rangle + e^{i\phi_2}\sin\frac{\theta_1}{2}\sin\frac{\theta_2}{2}\cos\frac{\theta_3}{2}|2\rangle + \ldots + e^{i\phi_{n-2}}\sin\frac{\theta_1}{2}\ldots\cos\frac{\theta_{n-2}}{2}|n-2\rangle + e^{i\phi_{n-1}}\sin\frac{\theta_1}{2}\ldots\sin\frac{\theta_{n-2}}{2}|n-1\rangle$

7. May 1, 2013

### tom.stoer

8. May 13, 2013

### Arubaito

Hi Tom, I took a look, however the parametrization I need should be in the computational basis. What is wrong with:

$|\phi\rangle=\cos\frac{\theta_1}{2}|0\rangle \\ + e^{i\phi_1}\sin\frac{\theta_1}{2}\cos\frac{\theta_2}{2}|1\rangle \\ + e^{i\phi_2}\sin\frac{\theta_1}{2}\sin\frac{\theta_2}{2}\cos\frac{\theta_3}{2}|2\rangle \\ + \ldots \\ + e^{i\phi_{n-2}}\sin\frac{\theta_1}{2}\ldots\cos\frac{\theta_{n-2}}{2}|n-2\rangle \\ + e^{i\phi_{n-1}}\sin\frac{\theta_1}{2}\ldots\sin\frac{\theta_{n-2}}{2}|n-1\rangle$

9. May 13, 2013

### tom.stoer

Nothing is wrong, but a uniform random distribution of the angles results in a non-uniform distribution on the n-sphere

10. May 16, 2013

### Arubaito

I see, you mean that I should consider also the appropriate element of area, which following your pointer should be:

$(\sin{\theta_1})^{n-2}d\theta_1(\sin{\theta_2})^{n-3}d\theta_2 \ldots d\theta_{n-2} d\phi_1 d\phi_2\ldots d\phi_{n-1}$

with $0\leq\theta_i\leq\pi$ and $0\leq\phi_i\leq 2\pi$.

11. May 16, 2013

### tom.stoer

yes

but honerstly, I do not know how to generate random angles with a specific non-uniform distribution such that the resulting points on the sphere are uniformely distributed. Better try a google search

12. May 16, 2013

### Staff: Mentor

Generate n random numbers from -1 to 1, interpret them as vector, normalize? Calculate the vectors afterwards if you like.

To avoid numerical issues, discard vectors with a very small magnitude due to rounding errors.

13. May 16, 2013

### Arubaito

What you're saying helps if I wanted to sample vectors, but I think it doesn't help me much if I want to manipulate analitically the state

14. May 16, 2013

### tom.stoer

Right.

But in the 1st post you wrote

So my conclusion was that you are looking for random samples on th n-dim. unit sphere.

15. May 16, 2013

### Arubaito

You're right, my question should have been more precise.