Use the convolution formula to find the pdf Let $X$ and $Y$ be two independent uniform random variables such that $X\sim unif(0,1)$ and $Y\sim unif(0,1)$.
A) Using the convolution formula, find the pdf $f_Z(z)$ of the random variable $Z = X + Y$, and graph it.
B) What is the moment generating function of $Z$?
So far I got to $$f_Z(z) = \int_{-\infty}^{\infty} f_Y(y)f_X(z-y)dy = \int_0^1 f_X(z-y)dy.$$ Where do I go from here?
 A: By assumption that $X$ and $Y$ are Uniform$(0,1)$ random variables, it follows that $f_X(x) = \mathbf{1}_{(0,1)}(x)$ and $f_Y(y) = \mathbf{1}_{(0,1)}(y)$ so that $$f_Z(z) = \int_{-\infty}^{\infty} f_Y(y) f_X(z-y) \, dy = \int_0^1 f_X(z-y) \, dy = \int_0^1 \mathbf{1}_{(0,1)}(z-y) \, dy.$$ Consider the following two cases.
1.) Given that $0 < z < 1,$ we have that $\mathbf{1}_{(0,1)}(z-y) = 1$ if and only if $0 < y < z,$ hence we have that $f_Z(z) = \int_0^z dy = z$ in this case.
2.) Given that $1 \leq z < 2,$ we have that $\mathbf{1}_{(0,1)}(z-y) = 1$ if and only if $z-1 < y < 1,$ hence we have that $f_Z(z) = \int_{z-1}^1 dy = 2-z$ in this case.
We conclude that $f_Z(z) = z \cdot \mathbf{1}_{(0,1)}(z) + (2-z) \cdot \mathbf{1}_{(1,2)}(z).$ Furthermore, we have that the moment generating function of $Z$ is given by
\begin{align*}
\psi_Z(t) = \mathbb{E} e^{tZ} &= \int_0^1 z e^{tz} \, dz + \int_1^2 (2-z) e^{tz} \, dz \\ \\
&= \frac{e^t(t-1) + 1}{t^2} + \frac{e^t(-t + e^t - 1)}{t^2} \\ \\
&= \frac{e^{2t}}{t^2} - \frac{2e^t}{t^2} + \frac{1}{t^2}.
\end{align*}
