# What happens when you add random things?
>[!quote] Linearity of Expectation.
>Suppose that $X$ and $Y$ are random variables that have finite expected values $\mu_X$ and $\mu_Y$, respectively. If $a$ and $b$ are real-valued constants, then
>$
>\mathbb{E}(aX + bY) = a \mu_X + b \mu_Y.
>$
>[!quote] Variance of sums of random variables
>Suppose that $X$ and $Y$ are random variables that have finite expected values ($\mu_X$ and $\mu_Y$) and finite variances ($\sigma_X^2$ and $\sigma_Y^2)$. Then
>$
>\mathrm{Var}(aX + bY) = a^2 \sigma_X^2 + b^2 \sigma_Y^2 + a b \,\mathrm{Cov}(X,Y)
>$
>where $\mathrm{Cov}(X,Y) \coloneqq \mathbb{E}(XY) - \mu_x \mu_y$
>
>In particular, if $X$ and $Y$ are independent, then
>
>$\displaystyle \text{Independent } X,Y \text{ :} \qquad \mathrm{Var}(aX + bY) = a^2 \sigma_X^2 + b^2 \sigma_Y^2.$
In the following worksheet we look at what happens when you add or multiply the outcomes of two fair dice. The expected value of the sum equals the sum of the expected values. But even better, because the outcomes of the two dice are *independent* in a way that we will discuss soon, the expected value of their product is the product of their expected values.
![[Companion_2_3_TwoDice.pdf]]
---
Proof of linearity of expectation.
For simplicity, we will provide the proof for non-negative random variables $X$ and $Y$ that have finite means $\mu_X$ and $\mu_Y$. Suppose that they have the joint distribution $p(x,y) = \mathbb{P}(X = x, Y = y)$. The comma means "and".