I'm studying introductory statistis and I'm having a difficult time understanding linearity of expectation. I found this proof from the website Brilliant:
We'll explicitly prove this theorem for discrete random variables. By the basic definition of expected value,
\begin{align*} E[X+Y] &= \sum_{x}\sum_{y} \big[(x+y)\cdot P(X=x,Y=y)\big] \\ &=\sum_{x}\sum_{y} \big[x\cdot P(X=x,Y=y)\big] + \sum_{x}\sum_{y} \big[y\cdot P(X=x,Y=y)\big] \\ &=\sum_{x}x\underbrace{\sum_{y} P(X=x,Y=y)}_{P(X=x)} + \sum_{y}y\underbrace{\sum_{x} P(X=x,Y=y)}_{P(Y=y)} \\ &=\sum_{x}x\cdot P(X=x) + \sum_{y}y \cdot P(Y=y) \\ &=E[X] + E[Y]. \end{align*}
This result can be extended for (n) variables using induction.
Note that we have never used any properties of independence in this proof, and thus linearity of expectation holds for all random variables!
I'm having a difficult time understanding the proof, can someone help me understand it?