Finding the PDF of a sum of 2 different distributions

112 Views Asked by At

Let $X,Y$ be two continuous independent R.Vs such that $X $~ $Uni(-1,3)$ and $Y$ is a R.V. defined within $[0,1]$ with PDF: $f_Y(y)=\frac {1}{\sqrt {y}}$, Find the PDF of $Z=X+Y$

In my first attempt, I've tried finding the CDF of $Z$ like so: $$ CDF_Z=P(Z\leq z)=P(X+Y\leq z)=P(Y\leq z-X)=\int_{-1}^{3}P(Y\leq z-x|X=x)\cdot f_X(x)dx $$ yet this method gave me a wrong answer, which I was able to debunk using the expected value 'sanity check'.

On my second attempt, I've tried apporaching this the other way around: $$ \int_{0}^{1}P(X\leq z-y|Y=y)\cdot f_Y(y)dy $$

Only to get a different result, which was also incorrect.

I've tried thinking in a convolution apporach to this, yet could not make the connection.

2

There are 2 best solutions below

1
On BEST ANSWER

First comment: I suspect you mean the pdf of $Y$ is $f_Y(y) = \frac{1}{2 \sqrt{y}}$. Without that $2$, your pdf doesn't integrate to 1.

Second: The convolution approach works and it's the easiest method here. I'd recommend using the other answer's method in general.

On the other hand, the two methods you say you tried both work; I'm guessing you just made a mistake in your computations, so I'll write out some results to help you check your work in case you want to confirm that the results come out the same.

I got these CDFs: $$\begin{align} F_X(x) &= \begin{cases} 0 & x < -1 \\ \frac {x+1}{4} & -1 \le x \le 3 \\ 1 & x > 3 \end{cases} \\ F_Y(y) &= \begin{cases} 0 & y < 0 \\ \sqrt{y} & 0 \le y \le 1 \\ 1 & y > 1 \end{cases} \end{align}$$

Using your first method I get: $$\begin{align} F_Z(z) &= \int_{-1}^{3} F_Y(z-x) f_X(x) dx \\ &= \begin{cases} 0 & z < -1 \\ \frac{1}{6} (z+1)^{3/2} & -1 \le z < 0 \\ \frac 1 6 + \frac z 4 & 0 \le z < 3 \\ \frac{1}{12} \left( 3z + 2 - 2(z-3)^{3/2} \right) & 3 \le z < 4 \\ 1 & 4 \le z \end{cases} \end{align}$$

and I get the same result using your second method $F_Z(z) = \int_0^1 F_X(z-y) F_Y(y) dy$.

I'm not sure what exactly you mean by "the expected value sanity check" but you can run whatever sanity check you want at this point.


Here is some Mathematica code I used to double-check my computations:

fx[x_] := If[-1 <= x <= 3, 1/4, 0];
fy[y_] := If[0 <= y <= 1, 1/2/Sqrt[y]];
Fx[x_] := If[x < -1, 0, If[x < 3, 1/4 + x/4, 1]];
Fy[y_] := If[y < 0, 0, If[y < 1, Sqrt[y], 1]];

Fz1[z_] := Integrate[Fy[z - x] fx[x], {x, -1, 3}]
Fz2[z_] := Integrate[Fx[z - y] fy[y], {y, 0, 1}]

Fz1[z] // FullSimplify
Fz2[z] // FullSimplify

and then I can check that the outputs for the last two commands match.

1
On

We have $$f_Z(z)=f_X(x) * f_Y(y)=\int_{-\infty}^\infty f_X(w) f_Y(z-w) \ dw.$$ This is also called the convolution of $f_X$ and $f_Y$. Look at example 5.30 here for a derivation of the result.