How to compute $\operatorname{Var}(Xe^X)$ for binomial r.v. $X$

93 Views Asked by At

I was prepping for my probability exam and stumbled upon the question below:

$$\operatorname{Var}[Xe^X]$$ when $X\sim\operatorname{Binomial}(n,p)$

I tried using the variance rule, $E[X^2]-(E[X])^2$, and the law of the unconscious statistician, all to fail.

Can someone help me? I get that the variance of a binomial r.v. is supposed to be $np(1-p)$, but I have no idea how to apply it onto that question.

I think someone actually asked the same question a few weeks ago, but that dude erased it for whatever reason.

Anyway, thx a lot for anyone who can help me out!

2

There are 2 best solutions below

3
On BEST ANSWER

Let $M_X(t)$ denote $X$'s moment-generating function, $E[e^{tX}]$. You want$$E[X^2e^{2X}]-(E[Xe^X])^2=M_X^{\prime\prime}(2)-(M_X^\prime(1))^2.$$Famously, $M_X(t)=(q+pe^t)^n$ with $q:=1-p$ (proof is an exercise). The rest is a calculus exercise.

1
On

We can solve this from first principles with indicator variables. Let $X_i$ denote the result of the $i^\text{th}$ independent trial. Then we have

$$E\left[e^{aX_i}\right] = e^a p$$

$$E\left[e^{aX}\right] = \prod_{i=1}^nE\left[e^{aX_i}\right]=(e^ap)^n$$ $$E\left[X_ie^X\right] = E\left[X_ie^{aX_i}\right]\prod_{j=1 \\ i\neq j}^nE\left[e^{aX_i}\right] = (e^ap)^n$$

$$E\left[X_iX_je^{aX}\right] = (e^ap)^n$$

which leaves

$$E\left[Xe^X\right] = E\left[(X_1+\cdots X_n)e^{X}\right]=\sum_{i=1}^n(ep)^n = n(ep)^n$$

$$E\left[X^2e^{2X}\right] = E\left[(X_1+\cdots + X_n)^2e^{2X}\right]$$

$$ = \sum_{i, j}E\left[X_iX_je^{2X}\right] = n^2(e^2p)^n$$

and finally

$$Var\left(Xe^X\right) = n^2(e^2p)^n - n^2(ep)^{2n} = n^2(e^2p)^n(1-p^n)$$