# Sum of two random variables (distribution)

I have a conceptual understanding problem. If we have say random variables $X_1$ and $X_2$ and they are i.i.d. with PDF $f$, and we want to find the distribution of the sum of these variables say, $Y$. Why:

1. The formula is what I will show, and how does one find a distribution of two random variables combined in general? Or for that matter, n-random variables.
2. Why is the second function a function of $y-x_1$? This is my conceptual hurdle.

$$f_Y(y)=\iint f(x_1)f(x_2)\delta (x_1+x_2-y) dx_1 dx_2=\int f(x_1) f(y-x_1) dx_1$$

• It should be $f_2(Y)=\int \int f_1(x_1)f_1(x_2)\delta(x_1+x_2-Y)dx_1 dx_2=\int f_1(x_1)f_2(Y-x_1)dx_1$. – velut luna Jan 14 '16 at 10:55
• If you want to find have $x_1+x_2=y$ then $x_2=y-x_1$ – Henry Jan 14 '16 at 10:56
• try with finite and discrete random variables first : $X_1 = \mathcal{U}_{\{1\ldots N\}}$ and $X_2 = \mathcal{U}_{\{1\ldots M\}}$ the uniform distributions. realize that the result is a discrete convolution. and with $3$ random variables, the result is $(X_1+X_2)+X_3$ which is the convolution applied two times : between $X_1$ and $X_2$, then the result is convolved with $X_3$. the convolution being a product : commutative and distributive over addition, everything works well. – reuns Jan 14 '16 at 11:20
• The answer seems to be simply that, for every $x_1$ and $y$, $$\int f(x_2)\delta (x_1+x_2-y) dx_2=f(y-x_1).$$ – Did Jan 14 '16 at 11:46

For any measurable set $G$, an event $\{Y \in G\}$ can be written as $$\{Y \in G\}=\{X_1+X_2 \in G\}=\{X_1=x, X_2=y-x \text{ for some }x \in \mathbb{R}, y \in G\}.$$
Therefore, by the Fubini theorem, the probability $$P\{Y \in G\}=\int_\mathbb{R}\int_G f_1(x)f_1(y-x)\,\mathrm{d}y\,\mathrm{d}x=\int_G\int_\mathbb{R} f_1(x)f_1(y-x)\,\mathrm{d}x\,\mathrm{d}y.$$
In other words, $$P\{Y \in G\}=\int_G f_Y(y)\,\mathrm{d}y$$ for $\displaystyle f_Y(y)=\int_\mathbb{R} f_1(x)f_1(y-x)\,\mathrm{d}x$ and we see that, indeed, $f_Y$ is PDF of $Y$.
Suppose the PDFs of two distributions are $f$ and $g$.
The probability that the sum is less than $x$ $$\iint_{s+t\le x} f(t)\,g(s)\,\mathrm{d}s\,\mathrm{d}t =\int_{-\infty}^\infty\int_{-\infty}^{x-t} f(t)\,g(s)\,\mathrm{d}s\,\mathrm{d}t$$ The density is the derivative \begin{align} \frac{\mathrm{d}}{\mathrm{d}x}\int_{-\infty}^\infty\int_{-\infty}^{x-t} f(t)\,g(s)\,\mathrm{d}s\,\mathrm{d}t &=\int_{-\infty}^\infty\frac{\mathrm{d}}{\mathrm{d}x}\int_{-\infty}^{x-t} f(t)\,g(s)\,\mathrm{d}s\,\mathrm{d}t\\ &=\int_{-\infty}^\infty f(t)\,g(x-t)\,\mathrm{d}t \end{align}