This is one of my friends homework question. I tried to solve it and explain to him but I couldn't solve it. The question is simple.
Let $ X_n = (\text{# of successes}) - (\text{# of failures}) $
in $n$ Bernoulli trials with possibility of success = $p$, and possibility of failure = $(1-p)$ for each of the Bernoulli trials. Find $E[X_n]$ and $Var[X_n]$.
My attempt to find the PMF of $X_n$ is the following:
$ f(x)= \begin{cases} p^n, & \text{if } x=n \\ p^{n-1}(1-p)^1 \binom{n}{n-1}, & \text{if } x=n-2 \\ p^{n-2}(1-p)^2 \binom{n}{n-2}, & \text{if } x=n-4 \\ \vdots & \vdots \\ (1-p)^n, & \text{if } x=-n \\ 0 & \text{otherwise} \end{cases} $
More compactly,
$ f(n-i)= \begin{cases} p^{(n-\frac{i}{2})} (1-p)^{(\frac{i}{2})}\binom{n}{n-\frac{i}{2}}, & \text{if } 0 \leq i \leq 2n \text{ and } i \% 2 = 0 \\ 0 & \text{otherwise} \end{cases} $
And using this PMF, expected value will be:
$ \begin{align} E[x] &= \sum_{i} i f(i) \\ &= \sum_{i \in {0 \leq i \leq 2n \text{ and } i \% 2 = 0}} (n-i) p^{(n-\frac{i}{2})} (1-p)^{(\frac{i}{2})}\binom{n}{n-\frac{i}{2}} \end{align} $
This is where I got stuck. I feel like there is a simpler way to solve this.
Any ideas?