I have a very short and simple question but this is very vital because it starts off my solution so I need to understand this puzzling concept (for me at least)! I have labelled that specific step with "WHY??".
QUESTION:
Suppose n balls are distributed at random into r boxes. Let $X_i$ = 1 if box i is empty and let $X_i$ = 0 otherwise.
Compute E[$X_i$].
SOLUTION:
Let $A_i$ be the event that box i is empty.
Then,
$X_i$ = $1_{A_i}$
Hence,
E[$X_i$] = E[$1_{Ai}$] = P[$A_i$] **WHY??
...
the further solutions are pretty straight forward
BUT this step...
I have no idea what E[$1_{Ai}$] means. Why is there a 1?
Thank you so much for your help! Greatly appreciated!
The expected value of a variable with only finitely many possible values $v \in V$ is, by definition, the sum $$\sum_{v \in V} vp(v)$$ hence, in your scenario, $$E(X_i) = (1)P(A_i) + (0)P(A_i') = P(A_i)$$ where $A_i'$ is the complement of $A_i$.
With regard to the notation $1_{A_i}$, it denotes the indicator function on the set $A_i$, which is the function which has value $1$ at points of $A_i$, and zero at all other points.
$\qquad$https://en.wikipedia.org/wiki/Indicator_function
It's so named since it indicates by its one-or-zero value at a given point whether or not the point is in the given set.