Probability density function of s = $u^2 + v^2$ with uniformly distributed u and v

probability distributionsrandom variables

I have a question on the section "Polar form" in the Wikipedia article of the Box-Muller-Scheme. There it is said that if u and v are two independent uniformly distributed random variables in the interval [-1,1] each, then if you sample from them and discard every point (u,v) with $s=u^2 + v^2 \ge 1$ or $s=0$, then the random variable s will be uniformly distributed.

I tried to verify this, but it didn't work. I started by defining the probability densities of u and v as $f_u(u) = \frac{1}{2}$ and $f_v(v) = \frac{1}{2}$. Then I set $\tilde{u} = u^2$ and $\tilde{v} = v^2$ and calculated their probabilities by the following steps (where $F_x$ is the cumulative density function of the variable x):

$F_{\tilde{u}}(U) = P(\tilde{u} \le U) = P(u^2 \le U) = P(-\sqrt{U} \le u \le \sqrt{U}) = P(u \le \sqrt{U}) – P(u \le – \sqrt{U}) = F_u(\sqrt U) – F_u(- \sqrt U) = 0.5 (\sqrt{U} + 1) – 0.5 (-\sqrt{U} +1) = \sqrt{U}$

and then we get the pdf by taking the derivative: $f_{\tilde u}(\tilde u) = \frac{1}{2\sqrt{\tilde u}}$ and analogous for $\tilde v$.

Then the pdf of a sum of two independent random variables, namely $s = \tilde u + \tilde v$ should be the convolution of the pdfs of $\tilde u$ and $\tilde v$:

$$f_s(s) = \int_0^1 f_{\tilde u}(\tilde u) \cdot f_{\tilde v}(s – \tilde u) d\tilde{u} = \frac{1}{4} \int_0^1 \frac{1}{\sqrt{\tilde u (s-\tilde u)}}d\tilde u.$$

I calculated this with WolframAlpha, but it didn't look like a uniform distribution at all. Where did I make a mistake here?

Best Answer

Your mistake is with the limits of the integral in $f_s$ --- $\tilde{u}$ does not take all values $0$ to $1$, but only $0$ to $s$. Then $$ \int_0^s\frac{1}{\sqrt{\tilde{u} (s-\tilde{u})}}\,\mathrm{d}\tilde{u}=\int_0^1\frac{1}{\sqrt{\frac{\tilde{u}}{s}(1-\frac{\tilde{u}}{s})}}\,\mathrm{d}\left(\frac{\tilde{u}}{s}\right) $$ therefore does not depend on $s\in(0,1]$ (The integral works out to $\pi$ but it doesn't really matter).

Note that you need to re-normalize $f_s$ because you have thrown out the set $s>1$ (or in other words, conditioned on $s\leq 1$).