# Calculating PDF of $Z$ from $X,Y$ when $Z=X+Y$, given the PDFs of $X$ and $Y$

A Student is taking an exam which has two parts, X and Y, with each part given a score from 200 to 800. The students probability distribution for each part is given by $$f_X(x)= \begin{cases} \frac{x}{2500}-\frac{6}{25}\;\;\; &600 \leq x \leq 650,\\ \frac{7}{25}-\frac{x}{2500}\;\;\; &650 \leq x \leq 700,\\ 0 &\text{elsewhere,} \end{cases}$$ and $$f_Y(y)= \begin{cases} \frac{y}{15000}-\frac{1}{25}\;\;\; &600 \leq x \leq 700,\\ \frac{1}{150} \;\;\; &700 \leq x \leq 800,\\ 0 &\text{elsewhere.} \end{cases}$$ What is the probability that the student gets a score of 1350 or better?

I think I understand the concepts required to solve this problem, and I have made a lengthy attempt, but at the very end, i am getting nonsensical answers. Here is my attempt:

Since $X$ and $Y$ are independent random variables, I can obtain the PDF of Z by convolution: $$f_Z(z) = f_X(x)\star f_Y(y) = \int_{-\infty}^{\infty}f_X(t)f_Y(z-t)dt.$$ Since $f_X(x)$ and $f_Y(y)$ are piece-wise defined, this integral breaks up into several cases:

1. If $z \leq 1200\text{ or } z \geq 1500,$ then $$f_Z(z)=0$$

2. If $1200 \leq z \leq 1250$, then we can conclude that $600 \leq x \leq 650$ and $600 \leq y \leq 650$, so for this interval,

$$f_Z(z) = \int_{600}^{650}\left[\frac{t}{2500}-\frac{6}{25}\right]\left[\frac{z-t}{150000} - \frac{1}{25}\right]dt = \frac{z}{30000} -\frac{37}{900}$$

1. If $1250 \leq z \leq 1300$, then $600 \leq x \leq 700$ and $600 \leq y \leq 700$, so for this interval, $$f_Z(z) = \int_{600}^{650}\left[\frac{t}{2500}-\frac{6}{25}\right]\left[\frac{z-t}{150000} - \frac{1}{25}\right]dt + \int_{650}^{700}\left[\frac{7}{25}-\frac{t}{2500}\right]\left[\frac{z-t}{150000} - \frac{1}{25}\right]dt = \frac{z}{15000}-\frac{1}{12},$$

2. If $1300 \leq z \leq 1400$, then $600 \leq x \leq 700$ and $700 \leq y \leq 800$, so for this interval, $$\int_{600}^{650}\left[\frac{t}{2500}-\frac{6}{25}\right]\left[\frac{z-t}{150000} - \frac{1}{25}\right]dt+\int_{650}^{700}\left[\frac{7}{25}-\frac{t}{2500}\right]\left(\frac{1}{150}\right)dt \\ = \frac{z}{30000}-\frac{17}{450}$$

3. If $1400 \leq z \leq 1500$, then $600\leq x \leq 700$ and $700 \leq y \leq 800$, so for this interval, $$\int_{600}^{650}\left[\frac{t}{2500}-\frac{6}{25}\right]\left(\frac{1}{150}\right)dt+ \int_{650}^{700}\left[\frac{7}{25}-\frac{t}{2500}\right]\left(\frac{1}{150}\right)dt = \frac{1}{150}$$

Putting it all together: $$f_Z(x)=\begin{cases} \frac{z}{30000} -\frac{37}{900} & \text{for } 1200 \leq z \leq 1250\\ \frac{z}{15000}-\frac{1}{12} & \text{for } 1250 \leq z \leq 1300\\ \frac{z}{30000}-\frac{17}{450} & \text{for } 1300 \leq z \leq 1400\\ \frac{1}{150} & \text{for } 1400 \leq z \leq 1500\\ 0 & \text{otherwise.} \end{cases}$$

I know right away some of this is wrong. For one thing, $$\int_{1200}^{1250}\left(\frac{z}{30000} -\frac{37}{900}\right)= -\frac{1}{72},$$

but the PDF of a function should always be nonnegative. Also, the sum of the integrals over their respective intervals should add to 1, but it doesn't. Is my approach on the right track? Can anyone see where i went wrong?

Holy smokes. That is a lot of computation and I applaud your efforts. Here's a somewhat simpler way to go about it, though. Let's think about the CDF, because what we want is a probability that the sum $X+Y$ is in a certain range; in particular, $$\Pr[X+Y \ge 1350] = \int_{y=650}^{800} \Pr[X \ge 1350-y]f_Y(y) \, dy,$$ because if $X+Y \ge 1350$ and $X$ is at most $700$, that implies $Y \ge 650$. What we have done here is essentially used the law of total probability and conditioned on the value of $Y$. The next step is to break out the integral for the two pieces of the density of $Y$: $$= \int_{y=650}^{700} \Pr[X \ge 1350-y] \left(\tfrac{y}{15000} - \tfrac{1}{25}\right) \, dy + \tfrac{1}{150} \int_{y=700}^{800} \Pr[X \ge 1350-y] \, dy.$$ Next, we have to compute the survival function $S_X(x) = \Pr[X > x]$ of $X$, which I think you know how to do, and then perform the resulting integration, and then you are done. It's still tedious, but not as convoluted as using convolution.
So that you can check your work, you should find that: $$\Pr[X > 1350 - y] = \begin{cases} 0, & y < 650 \\ \frac{(y-650)^2}{5000}, & 650 \le y < 700 \\ 1 - \frac{(y-750)^2}{5000}, & 700 \le y < 750 \\ 1, & 750 \le y. \\ \end{cases}$$
• I wasn't familiar with the survival function, but a quick wikipedia check tells me that is simply 1 - CDF. Does that mean i have to further break up these integrals into the different sections of $S_X(x)$? Thanks for the alternative perspective by the way, my way was awful. – Kyle Funk Dec 9 '14 at 18:07
• Note that you only have to break up the second integral into two more pieces, because the first integral is contained (with the exception of the endpoint, which doesn't matter) in the interval $650 \le y < 700$. Fortunately, in the interval $750 \le y$, $\Pr[X > 1350 - y] = 1$, so in the end, you still only need to do two integrations. – heropup Dec 9 '14 at 18:10
• If $X$ and $Y$ are not independent, then you will need some expression for how they are jointly distributed, in which case you would write something like $$\Pr[X + Y > c] = \iint_R f_{X,Y}(x,y) \, dx \, dy$$ where $R$ is the subset of the joint support satisfying $X + Y > c$. How this region $R$ is specified depends on the support and the value of $c$. – heropup Dec 9 '14 at 18:26