0
$\begingroup$

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?

$\endgroup$
5
  • $\begingroup$ 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. $\endgroup$
    – drhab
    Jul 25, 2020 at 10:52
  • $\begingroup$ 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? $\endgroup$
    – Lukas
    Jul 25, 2020 at 10:57
  • $\begingroup$ Can you provide a link to the Wikipedia page? $\endgroup$
    – drhab
    Jul 25, 2020 at 11:18
  • $\begingroup$ en.wikipedia.org/wiki/Box%E2%80%93Muller_transform $\endgroup$
    – Lukas
    Jul 25, 2020 at 11:23
  • $\begingroup$ My first comment was wrong (sorry). $\endgroup$
    – drhab
    Jul 25, 2020 at 12:15

2 Answers 2

0
$\begingroup$

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

$\endgroup$
4
  • $\begingroup$ 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$). $\endgroup$
    – Lukas
    Jul 25, 2020 at 12:30
  • $\begingroup$ 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? $\endgroup$
    – Lukas
    Jul 25, 2020 at 12:40
  • $\begingroup$ 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. $\endgroup$ Jul 25, 2020 at 12:49
  • $\begingroup$ 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. $\endgroup$
    – Lukas
    Jul 25, 2020 at 14:17
0
$\begingroup$

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<u^2+v^2<1$ random vector $(u,v)$ has uniform distribution on the set: $$\{(x,y)\in\mathbb R^2\mid 0<x^2+y^2<1\}$$

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

$\endgroup$
1
  • $\begingroup$ 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. $\endgroup$
    – Lukas
    Jul 25, 2020 at 12:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .