pdf for random variable over unit disk

1k Views Asked by At

Let $(X,Y)$ be uniformly distributed on the unit disk $S = \{(x,y) \in \mathbb{R}^2:x^2 + y^2 \leq 1\}$.

a) Find the probability density function for the RV $U = X + Y$.

b) Find the probability density function for the random variable $W = Y/X$.

My solution a) Consider the line $X + Y = \alpha$. The solution is (the area of the circular segment bounded by the intersections of the line and the circle)/$\pi$.

b) Consider $P(W \leq \alpha) = P(Y/X \leq \alpha) = P(Y\leq \alpha X)$. Since the line $Y= \alpha X$ will always go through the origin, $P(W \leq \alpha) = \pi/2$.

It's so simple that I'm skeptical. Can somebody help? Thanks,

EDIT

Since people pointed my errors out. I'm assuming my answer to part a) is incorrect as well.

3

There are 3 best solutions below

1
On

First problem I see is that you can't just clear the denominator like that. If $X$ is negative the inequality has to reverse. So you have to integrate over two pieces, which I'm guessing won't add up to $\pi/2$.

0
On

For the first problem, if we write PDF in radial coordinates, as $2~r~dr~d\phi/2\pi$, it is clearly normalized and is a product of independent distributions in $r$ and in $\phi$. For the sum $X+Y$ result will be some PDF defined in circle of radius 2. Again, it is obvious that azimuth distribution will be uniform in $2 \pi$, and the only problem is to find PDF(r). Following logic here for the sum of two uniform variates, one could compute integral and produce PDF

$$PDF(r) = \frac{2}{3}~r^3, 0 \le r \le 1$$ $$PDF(r) = 2~r~(1-(r-1)^2) - \frac{4}{3}(1-(r-1)^3), 1 \le r \le 2$$

Full PDF:

$$ PDF(r, \phi) = PDF(r)~dr~d\phi/2\pi $$

Test, PDF(r) vs sampling

PDF(r), sampling vs formual

Code, R

library(ggplot2)
library(data.table)

PDF.r <- function(R) {
     q <- 0.0

     if (R >= 0.0) {
         if (R <= 2.0) {
              if (R <= 1.0) {
                  q <- (2.0/3.0)*R^3L
              } else {
                  q <- (R - 1.0)
                  q <- 2.0 * R * ( 1.0 - q^2L ) - (4.0/3.0) * ( 1.0 - q^3L )
              }
         }
     }
     q
}

# sampling
n <- 10^6L

dt.r <- data.table(x = sqrt( runif(n) ), y = sqrt( runif(n) ))
dt.r[ , sum := x + y] # summed radii

# plot density histogram overlapped with PDF
p <- ggplot(dt.r, aes(x = sum)) +
     geom_histogram(aes(y=..density..),
                   binwidth = 0.05,
                   colour = "black", fill = "blue") +
     stat_function(fun = Vectorize(PDF.r)) +
     labs(title = "PDF vs MC",
          x = "radius", y = "PDF(r)") +
     xlim(0.0, 2.0) + ylim(0.0, 1.2)
print(p)
0
On

For ratio, same logic applies, final would be uniform in azimuth, but have now semi-infinite distribution id radius. Following logic here for ratio distribution, one can get PDF

$$PDF(r) = r, 0 \le r \le 1$$ $$PDF(r) = 1/r^3, 1 \le r \le \infty $$

Test, PDF(r) vs sampling

enter image description here

Code, R

library(ggplot2)
library(data.table)

PDF.r <- function(u) {
    q <- 0.0

    if (u >= 0.0) {
        if (u <= 1.0) {
            q <- u
        } else {
            q <- 1.0/u^3L
        }
    }
    q
}

# sampling
n <- 10^6L

set.seed(12345)
dt.r <- data.table(x = sqrt( runif(n) ), y = sqrt( runif(n) ))
dt.r[ , sum := x / y]

# plot density histogram overlaped with PDF
p <- ggplot(dt.r, aes(x = sum)) +
    geom_histogram(aes(y=..density..),
                   binwidth = 0.05,
                   colour = "black", fill = "blue") +
    stat_function(fun = Vectorize(PDF.r)) +
    labs(title = "PDF vs MC",
         x = "radius", y = "PDF(r)") +
    xlim(0.0, 4.0) + ylim(0.0, 1.1)
print(p)