Finding density of piece-wise with 2 random variables

34 Views Asked by At

Question:

Let $X$ be a uniformly distributed random variable over $[0, \pi/2)$ and let $Y$ be uniformly distributed over $[0,1)$. We assume that $X$ and $Y$ are independent. Define:

$$ Z = \begin{cases} X & \text{if } Y < \sin^2(X)\\ X + \pi /2& \text{if } Y > \sin^2(X)\\ \end{cases}$$

The random variable $Z \in (0, \pi)$. What's the density of $Z$?

Attempt:

I have it set it up like this

$$P(Z \leq t ) = P(X \leq t|Y<\sin^2 X) \cdot P(Y<\sin^2 X) + P \left( \frac{\pi}{2}+X \leq t |Y>\sin^2 X\right)\cdot P(Y>\sin^2 X)$$

where $P(Y<\sin^2 X) = \int_{0}^{\pi/2} \sin^2X = \pi /4$

I'm not so sure how to find the conditional probabilities or if I'm approaching this correctly.Having 3 random variables confuses me. I do not have the solution to this problem but the answer is supposed to be

$$f_Z(z) = \dfrac{2}{\pi} \sin^2(z), z \in (0, \pi)$$

The original source can be found here, question #1 (in Polish).

1

There are 1 best solutions below

1
On BEST ANSWER

We can calculate $$P(X \leq t \mid Y < \sin^2X) = \frac{P(X \leq t \cap Y < \sin^2X)}{P(Y < \sin^2X)}.$$

We only need to calculate the numerator, but I will show you how to calculate the denominator as well.

For $P(Y < \sin^2X)$ we need to integrate the joint density of $(X, Y)$ over the blue region in the diagram. Integration Region The density of $X$ and $Y$ are below (where $\mathbb{I}_{A}$ is $1$ if the statement $A$ is true, and $0$ otherwise). $$f_X(x) = \frac{2}{\pi}\mathbb{I}_{0 \leq x \leq \pi/2}, f_Y(y) = \mathbb{I}_{0 \leq y \leq 1}.$$ $X, Y$ are independent so the joint density is $$f_{XY}(x, y) = \frac{2}{\pi}\mathbb{I}_{0 \leq x \leq \pi/2, 0 \leq y \leq 1}.$$ Integrating the joint density over the region is as follows: $$P(Y < \sin^2X) = \int_{x=0}^{\pi/2} \int_{y = 0}^{\sin^2x} \frac{2}{\pi} dy dx.$$ This leads to $$P(Y < \sin^2X) = \frac{2}{\pi} \int_{x=0}^{\pi/2} \sin^2x dx = \frac{2}{\pi}\frac{\pi}{4} = \frac{1}{2}.$$


Computing $P(X \leq t \cap Y < \sin^2X)$ we have the equation $$P(X \leq t \cap Y < \sin^2X) = \begin{cases} \int_{x = 0}^{t} \int_{y = 0}^{\sin^2x} \frac{2}{\pi} dy dx & \text{if } 0 < t < \frac{\pi}{2},\\ 0 & \text{if } t \leq 0,\\ \int_{x = 0}^{\pi/2} \int_{y = 0}^{\sin^2x} \frac{2}{\pi} dy dx & \text{if } t \geq \frac{\pi}{2}. \end{cases}$$ The top integral can then be computed: $$\int_{x = 0}^{t} \int_{y = 0}^{\sin^2x} \frac{2}{\pi} dy dx = \frac{2}{\pi} \int_{x = 0}^{t} \sin^2x dx = \frac{2}{\pi} \frac{1}{2} \left(t - \sin t \cos t\right) = \frac{t - \sin t \cos t}{\pi}.$$ So we have $$P(X \leq t \cap Y < \sin^2X) = \begin{cases} \frac{t - \sin t \cos t}{\pi} & \text{if } 0 < t < \frac{\pi}{2},\\ 0 & \text{if } t \leq 0,\\ \frac{1}{2} & \text{if } t \geq \frac{\pi}{2}. \end{cases}$$


Similarly we can compute \begin{equation} P\left(X \leq t - \frac{\pi}{2} \cap Y > \sin^2 X\right) = \begin{cases} \int_{x = 0}^{t-\pi/2} \int_{y = \sin^2x}^{1} \frac{2}{\pi} dy dx & \text{if } \frac{\pi}{2} < t < \pi,\\ 0 & \text{if } t \leq \frac{\pi}{2},\\ \int_{x = 0}^{\pi/2} \int_{y = \sin^2x}^{1} \frac{2}{\pi} dy dx & \text{if } t \geq \pi. \end{cases} \end{equation} The top integral can then be computed $$\int_{x = 0}^{t-\pi/2} \int_{y = \sin^2x}^{1} \frac{2}{\pi} dy dx = \frac{2}{\pi} \int_{x = 0}^{t-\pi/2} 1 - \sin^2x dx = \frac{2}{\pi} \frac{1}{2} \left(t - \frac{\pi}{2} + \sin \left(t - \frac{\pi}{2}\right) \cos \left(t - \frac{\pi}{2}\right)\right).$$ Now, $\sin(t - \pi/2) = -\cos t$ and $\cos(t - \pi/2) = \sin t$, so $$P\left(X \leq t - \frac{\pi}{2} \cap Y > \sin^2 X\right) = \frac{t - \pi/2 - \sin t \cos t}{\pi}.$$ Therefore we have \begin{equation} P\left(X \leq t - \frac{\pi}{2} \cap Y > \sin^2 X\right) = \begin{cases} \frac{t - \pi/2 - \sin t \cos t}{\pi} & \text{if } \frac{\pi}{2} < t < \pi,\\ 0 & \text{if } t \leq \frac{\pi}{2},\\ \frac{1}{2} & \text{if } t \geq \pi. \end{cases} \end{equation}


Calculating $$P(Z \leq t) = P(X \leq t \cap Y < \sin^2X) \frac{P(Y < \sin^2X)}{P(Y < \sin^2X)} + P(X \leq t \cap Y > \sin^2X) \frac{P(Y > \sin^2X)}{P(Y > \sin^2X)},$$ I get $$P(Z \leq t) = \begin{cases} 0 & \text{if } t \leq 0,\\ \frac{t - \sin t \cos t}{\pi} & \text{if } 0 < t < \frac{\pi}{2},\\ \frac{1}{2} + \frac{t - \pi/2 - \sin t \cos t}{\pi} & \text{if } \frac{\pi}{2} \leq t < \pi,\\ 1 & \text{if } t \geq \pi. \end{cases} $$ This is equivalent to $$P(Z \leq t) = \begin{cases} 0 & \text{if } t \leq 0,\\ \frac{t - \sin t \cos t}{\pi} & \text{if } 0 < t < \pi,\\ 1 & \text{if } t \geq \pi. \end{cases} $$ Differentiating gives the density of $Z$ $$f_Z(z) = \frac{1 - \cos^2z + \sin^2z}{\pi}\mathbb{I}_{0\leq z \leq \pi},$$ which equals $$f_Z(z) = \frac{2}{\pi}\sin^2z\ \mathbb{I}_{0\leq z \leq \pi},$$ as required.