It is given that $X \sim R(0,1)$ and the density of $Y$ is given as:
$f(y)= \begin{array}{cc} \Bigg\{ & \begin{array}{cc} y & 0<y<1 \\ 2-y & 1<y<2 \\ 0 & \text{otherwise} \end{array} \end{array} $
$X,Y$ are independent.
Find the distribution of $X+Y$
I had the following approach. Let $Z=X+Y$
Case 1 : $0<z<2$
$P(Z \le z)=P(Z \le z| 0 < Y < 1)P(0 < Y < 1)+ P(Z \le z|1 < Y <2)P(1<Y<2)$
$=(\int_{0}^{1}\int_{0}^{z-x} y \ \text{dy} \ \text{dx}) \frac{1}{2}+(\int_{0}^{1}\int_{1}^{z-x} 2-y \ \text{dy dx})\frac{1}{2}$
Case 2:$2<z<3$ $P(Z \le z)=P(Z \le z|1<Y<2)P(1<Y<2)=(\int_{0}^{1}\int_{1}^{z-x} 2-y \ \text{dy dx}) \frac{1}{2}$
Is this approach correct?
This is only a partial answer in that I show the results but not the logic leading to the results. (However, that should probably give you enough hints to provide the missing steps.)
Using Mathematica one can get the pdf for the sum:
$$\begin{array}{cc} \{ & \begin{array}{cc} \frac{z^2}{2} & 0<z\leq 1 \\ -(z-3) z-\frac{3}{2} & 1<z\leq 2 \\ \frac{1}{2} (z-3)^2 & 2<z<3 \\ \end{array} \\ \end{array}$$
Generate some random samples of the sum.
Display results: