I am encountering times when Var(X) is interchanged with $E[X^2]$ where X is a random variable and in the cases where E[X] = 0 I see why that is:
$Var(X) = E[X^2] - (E[X])^2$.
But sometimes that is not the case, i.e. E[X] != 0. Would you mind weighing in? Take for example this problem:
Customers arrive at a restaurant with a Poisson rate $\lambda$ and on average spend 20 dollars with a variance of 5. What is the mean and variance of the revenue at this restaurant over 10 hours?
The solution goes as follows:
Let $X_i$ be money spent by i-th customer and let N(t) be customer arrivals by time t.
average money spent = $E[\sum_{i=1}^{N(10)}X_i = E[N(10)]*E[X_i]$
=$10*\lambda*20 $, this is clear
variance = $Var(\sum_{i=1}^{N(10)}X_i) = 10*\lambda*E[X_i^2]$
= $10*\lambda * (Var(X_i) + E[X_i]^2)$
- the expectation was computed to be 200*$\lambda$
- In the first step of the variance calculation they seemingly skipped a step that most likely was as follows:
variance = $Var(\sum_{i=1}^{N(10)}X_i) = E[N(10)]*Var[X_i]$
and then they substituted $Var(X_i) = E[X_i^2]$
How come? I'm not fully following why that is allowed.