Consider the experiment of tossing a bias coin with probability p of Heads n times. Let X be the number of Heads obtained, which has the binomial(n,p) distribution. Calculate the mean $\mu _X=E\left(X\right)$.
Hint: X can be expressed in terms of the indicator functions as
$X=I_{H_1}+I_{H_2}+...+I_{H_n}$
where each $H_k$ is the event 'Heads on the k-th toss'.
I am looking for how to do this as well as the answer. If possible, I would like to see step by step so I can get a clear understanding of the whole problem. Thanks in advance!
$$E(X) = E(I_{H_1}+\dots+I_{H_n}) = E(I_{H_1})+\dots+E(I_{H_n})$$ So all that remains is to find $E(I_{H_i})$ for each $i=1,\dots,n$. The expected value of an indicator function is just the probability of the event it indicates.
In more detail, $I_{H_i}$ only takes the values 0 and 1, so $$ E(I_{H_i}) = 0\cdot P(1_{H_i}=0) + 1\cdot P(1_{H_i}=1) = P(H_i). $$