Question on proof of linearity of expectation involving discrete random variables Please see the proof below regarding the linearity of expectation given two discrete random variables $X$ and $Y$. I'm not understanding how the first highlighted step moves to the next highlighted step. I've looked online and seen mention that this relates to the law of total probability... but after looking up some more information on the law of total probability I can't see how this law is applied here.
$$\begin{align*}E[X+Y]&=\sum_x\sum_y [(x+y)\cdot P(X=x, Y=y)]\\
&=\sum_x\sum_y [x\cdot P(X=x, Y=y)]+\sum_x\sum_y [y\cdot P(X=x, Y=y)]\\&=\bbox[yellow]{\sum_xx\sum_y P(X=x, Y=y)+\sum_xy\sum_y [P(X=x, Y=y)]}\\
&=\bbox[yellow]{\sum_x x \cdot P(X=x)+\sum_y y\cdot P(Y=y)}\\
&=E[X]+E[Y]\end{align*}$$
 A: https://en.wikipedia.org/wiki/Law_of_total_probability
If you look at the first formula in the above link, we have in your case
$P(X=x)=\sum_y P(X=x, Y=y)=\sum_y P(X=x\cap Y=y)$
A: The missing step is just that probability is additive for disjoint unions, and the support of a random variable partitions the sample space.   Also known as the Law of Total Probability.
$$\begin{align}\mathsf E(X+Y) &=\sum_x\sum_y (x+y)~\mathsf P(X=x\cap Y=y) \\[1ex] &= \sum_x\sum_y x~\mathsf P(X=x\cap Y=y)+\sum_x\sum_y y~\mathsf P(X=x\cap Y=y)\\[1ex]&=\sum_x x \sum_y\mathsf P(X=x\cap Y=y)+\sum_y y\sum_x\mathsf P(X=x\cap Y=y) \\[1ex] &= \sum_x x~\mathsf P\Bigl((X=x)\cap \bigcup_y (Y=y)\Bigr)+\sum_y y~\mathsf P\Bigl((Y=y)\cap\bigcup_x(X=x)\Bigr)\tag{$\bigstar$}\\[1ex] &= \sum_{x}x~\mathsf P(X=x)+\sum_{y}y~\mathsf P(Y=y)\\[1ex] &= \mathsf E(X)+\mathsf E(Y)\end{align}$$
PS: If you could write all probabilities of pairs of $(X,Y)$ values in a tabular grid and sum the values in the rows and columns into the margins, those values are the marginal probability masses.   This is where the name comes from.$$\mathsf P(X=x)=\sum_y \mathsf P(X=x, Y=y)$$
