1
$\begingroup$

Let $X \sim U(-1, 1)$ and $X \sim U(-1,1)$. We want to find density function of $W = \sqrt{X^2 + Y^2}$.

I got stuck and I have no idea, where I am making a mistake. This is my approach.

Let $F$ be a cumulative distribution function of $W = \sqrt{X^2 + Y^2}$

\begin{align*} F(w) = P(W \le w ) &= P(\sqrt{X^2 + Y^2} \le w) \\ &= P(X^2 + Y^2 \le w^2) \\ &= \iint \limits_{x^2 + y^2 \le w^2} \frac{1}{4} dxdy \\ &= \int \limits_{0}^{w^2} \int \limits_{0}^{2 \pi} \frac{1}{4} d\theta dr \\ &= \pi \frac{w^4}{4} \end{align*} So, the density: $$ f(w) = F'(w) = \pi w^3 $$

But if I run a simulation:

X <- runif(100000, -1, 1)
Y <- runif(100000, -1, 1)
R2 <- X^2 + Y^2
R <- sqrt(R2)

hist(R,  prob=TRUE)

enter image description here

Where am I making a mistake?

$\endgroup$
2

1 Answer 1

2
$\begingroup$

Some observations:

  • The radius is $w$, but you're taking it as $w^2$
  • Don't forget the $|J|$ term (i.e. $rdrd\theta$) in the integral (or you can simply use area of the circle as well)
  • The density will take two different functional forms for $[0,1]$ and $[1,\sqrt{2}]$. Visualise a growing circle inside the square $[-1,1]\times[-1,1]$.
$\endgroup$
2
  • $\begingroup$ Thanks! for $[0,1]$ calculations are easy and I was able to receive the good result. Will it be correct if for $[1, \sqrt{2}]$ I would consider one quater and write $\int_0^1 \int_0^{\sqrt{w^2 -1}} \frac{1}{4} dx dy + \int_{\sqrt{w^2 -1}}^1 \int_0^{\sqrt{w^2 - x^2}} \frac{1}{4} dydx$ and then multiply the result by 4? $\endgroup$ Commented Jun 12, 2020 at 12:17
  • $\begingroup$ I might be mistaken but the integral didn't seem correct. Why don't you calculate using just the formulas for area and then try to verify your integrals? $\endgroup$
    – gunes
    Commented Jun 12, 2020 at 13:03

Not the answer you're looking for? Browse other questions tagged or ask your own question.