Why can't I apply Linearity of Expectation in this situation (in layman's terms)

Background

• Let's say you own a convenience store

• Each day $N$ customers will visit you, where $N \in (1,7 \, billion \, humans)$

• $X_i$ is the amount that each customer will spend

• All the $X_i$'s are iid and also independent of $N$

Let's say you want to know the expected value of total revenue made in a day. I know the following is true (Wald's equation),

$$E \bigg[ \sum_{i=1}^{N} X_i \bigg] = E[N]E[X]$$

My question

Can you explain why it is illegal to do,

$$E \bigg[ \sum_{i=1}^{N} X_i \bigg] = \sum_{i=1}^{N} E[X_i] = NE[X]$$

I know this is illegal because $NE[X] \neq E[N]E[X]$. I know the LOE doesn't always hold for infinite sums but in this situation $N$ is capped by the human population. If you could explain in lay terms I would greatly appreciate it (versus going into sigma algebras and IUT). Thanks.

• $N$ is a random variable. – Lord Shark the Unknown Aug 31 '18 at 21:59
• The expected value of a random variable is a real number. Your attempt at using linearity gives a random variable because $N$ is random. So you aren’t even getting the right type of object when you apply linearity this way. It’s like saying 117 * 123 = Fish; I don’t have to do any calculation to tell you that it is wrong. – guy Aug 31 '18 at 22:03
• The problem is already in the example with the $3$s. If $N$ is a random variable, then the expected value of an $N$-fold sum of $3$s is not $3N$ but $3\mathsf E[N]$. – joriki Aug 31 '18 at 22:08
• $N$ is a random variable: $E[X]N$ is a random variable. Expectations are numbers, not random variables. – Lord Shark the Unknown Aug 31 '18 at 22:10
• @HJ_beginner $E[X \mid Y = y]$ is a number, yes. There are a couple of ways to be rigorous about this; one is to start by defining $E[X \mid Y = y]$ and then define $E[X \mid Y]$ to be what you get when you "plug in" $Y$ for $y$. Alternatively, you can define $E[X \mid Y]$ first as a random variable, and then let $E[X \mid Y = y]$ be the value $E[X \mid Y]$ takes on the level set $[Y = y]$. – guy Sep 1 '18 at 1:47