# Convolution, sum of two independent random variables $X+Y$

Let $$f_{(X,Y)}(x,y) = 2x$$ for $$x \in (0,1), y \in (0,1)$$. I need to compute density of $$X+Y$$. So, I know that $$X \perp Y$$, because \begin{align} f_X(x) &= 2x, \ \ x\in(0,1)\\ f_Y(x) &= 1, \ \ \ \ y \in (0,1) \end{align} thus $$f_{(X,Y)}(x,y) = f_X(x)f_Y(y)$$.

Let $$Z=X+Y$$ and $$z\in(0,2)$$, then $$f_Z(z) = \int\limits_{-\infty}^{+\infty}f_Y(y)f_X(z-y)dy$$ Then, for $$z\in(0,1)$$ I need $$z-y\geq 0$$, so $$z \geq y$$ $$f_Z(z) = \int\limits_{0}^{z}1\cdot2(z-y)dy = 2z^2-z^2 = z^2$$ And for $$z\in(1,2)$$ inequality $$z \geq y$$ holds, but $$z-y \leq 1$$ $$f_Z(z) = \int\limits_{z-1}^{1}1\cdot2(z-y)dy = 2z-z^2$$ Thus $$f_Z(z) = \begin{cases} z^2, \ \ \ \ \ \ \ \ \ \ z \in (0,1)\\ 2z-z^2, \ \ \ z \in (1,2)\\ 0, \ \ \ \ \ \ \ \ \ \ \ \ \text{elsewhere} \end{cases}$$ Am I correct?

• This seems correct to me. Dec 7, 2022 at 19:15

I think you are correct. An alternate proof (with many steps omitted for concision) to sanity check: \begin{align} f_Z(z)&=\int_0^1f_Y(z-x)f_X(x)dx\tag{1} \end{align} For $$0\leq z \leq1$$, $$f_Z(z)=\int_{0}^{z}2xdx=z^2\tag{2}.$$ For $$1, $$f_Z(z)=\int_{z-1}^{1}2xdx=2z-z^2\tag{3}.$$ As such, f_Z(z)=\left\{ \begin{aligned} z^2 &\ \ \ \text{ for }0\leq z \leq 1,\\ 2z-z^2&\ \ \ \text{ for }1 < z \leq 2,\\ 0 &\ \ \ \text{ otherwise. } \end{aligned} \right.