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

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?

• The $s$ defined as $u^2+v^2$ will not have uniform distribution after discarding. Don't they mean $s:=(u,v)$ here? It has uniform distribution on an open disk missing its center. Jul 25, 2020 at 10:52
• From the Wikipedia page: "Because u and v are uniformly distributed and because only points within the unit circle have been admitted, the values of s will be uniformly distributed in the open interval (0, 1), too." Or do I maybe understand your comment wrong? Jul 25, 2020 at 10:57
• en.wikipedia.org/wiki/Box%E2%80%93Muller_transform Jul 25, 2020 at 11:23
• My first comment was wrong (sorry). Jul 25, 2020 at 12:15

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$$).

• Ah, you are right there. But I'm a little bit confused that it is $\pi$ because s can take values between 0 and 1, so I would expect a pdf that is normalized when integrating over this interval (and this is not the case if we have a uniform distribution $f_s(s) = \pi$). Jul 25, 2020 at 12:30
• I was a little bit sloppy: because of the prefactor $\frac{1}{4}$ the pdf should be $f_s(s) = \frac{\pi}{4}$ then. But s can take values in the domain (0,2), so I would expect it to be 1 if I integrate $f_s(s)$ over this domain. Why is this not the case here? Jul 25, 2020 at 12:40
• The convolution integral gives $\tilde{u}+\tilde{v}$, without the condition $\tilde{u}+\tilde{v}\leq 1$, having pdf $$\frac14\int_{\mathbb{R}} (\tilde{u}(s-\tilde{u}))^{-1/2} 1_{\tilde{u}\in(0,1]} 1_{s-\tilde{u}\in(0,1]}\,\mathrm{d}\tilde{u}.$$ You can calculate it for $s\in(1,2)$ (the result should be $\frac12[\sin^{-1}(1/\sqrt{s})-\cos^{-1}(1/\sqrt{s})]$) and you can check this indeed integrates to $1$ on the full $[0,2]$. The condition on $s\leq 1$ is so that we have a uniform distribution. Jul 25, 2020 at 12:49
• Thank you very much. I forgot completely to pay attention to the $1_{x \in X}$'s that you inserted into your integral. Now it all works. Jul 25, 2020 at 14:17

Random variables $$u$$ and $$v$$ are independent and have uniform distribution on $$[-1,1]$$.

Then random vector $$(u,v)$$ has uniform distribution on the set:$$[-1,1]^2$$

Then under condition $$0 random vector $$(u,v)$$ has uniform distribution on the set: $$\{(x,y)\in\mathbb R^2\mid 0

Then for $$z\in(0,1)$$ we find: $$P(u^2+v^2\leq z)=\frac{\text{area of }\{(x,y)\mid 0showing that $$s:=u^2+v^2$$ has uniform distribution on interval $$(0,1)$$.

• Makes sense and this is a far more elegant way to prove it than mine. But this means that somewhere in my derivation must be a mistake and it would be great if anyone could tell me where it is. Jul 25, 2020 at 12:24