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!
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.