3
$\begingroup$

I suspect there is a way to do the following sum by hand, but I'm having some trouble: $$\sum_{x=0}^{n} x^{2} {n \choose x} p^{x}(1-p)^{n-x}$$

There are a couple questions like this, but for general $x^{k}$, I wanted to know for k = 2.

$\endgroup$
  • 1
    $\begingroup$ $=E(X^2)=(E(X))^2+\sigma^2_X=(np)^2+np(1-p)$ for $X\sim B(n,p)$. For general $k$, you could probably use $k$th derivative of moment generating function for a binomial. $\endgroup$ – A.S. Mar 19 '16 at 18:22
  • $\begingroup$ @A.S. ya this is how i ended up doing it when i answered orginially $\endgroup$ – yoshi Mar 19 '16 at 19:05
  • $\begingroup$ I'm assuming $k$ and $n$ are the same thing? And $x$ does not generally represent an integer variable, but that's more of a convention. $\endgroup$ – Teepeemm Mar 20 '16 at 0:21
2
$\begingroup$

$$\begin{align*} \sum_kk^2\binom{n}kp^k(1-p)^{n-k}&=n\sum_kk\binom{n-1}{k-1}p^k(1-p)^{n-k}\\ &=n\sum_k(k+1)\binom{n-1}kp^{k+1}(1-p)^{n-k-1}\\ &=n\sum_kk\binom{n-1}kp^{k+1}(1-p)^{n-k-1}+n\sum_k\binom{n-1}kp^{k+1}(1-p)^{n-k-1}\\ &=n(n-1)\sum_k\binom{n-2}{k-1}p^{k+1}(1-p)^{n-k-1}+np\sum_k\binom{n-1}kp^k(1-p)^{(n-1)-k}\\ &=n(n-1)\sum_k\binom{n-2}kp^{k+2}(1-p)^{n-2-k}+np\\ &=n(n-1)p^2+np\\ \end{align*}$$

$\endgroup$
  • $\begingroup$ is the second line just a re-indexing? $\endgroup$ – yoshi Mar 19 '16 at 19:00
  • $\begingroup$ @yoshi: Yes, and so is the first part of the fifth line. $\endgroup$ – Brian M. Scott Mar 19 '16 at 19:01
  • $\begingroup$ is there anyway to see that would work? i got to the first equality when I did this myself. $\endgroup$ – yoshi Mar 19 '16 at 19:04
  • 2
    $\begingroup$ @yoshi: I wasn’t positive when I started, but experience suggested that it could probably be pushed through with a bit of work. After that I just kind of followed my nose. $\endgroup$ – Brian M. Scott Mar 19 '16 at 19:06
5
$\begingroup$

Take $q$ to be a constant in the following, and use the identity $$ \sum_{x=0}^n \left(n\atop x\right)p^x q ^{n - x} = (p +q )^n.$$ Apply the operator $D = p \,{d\over dp}$ to both sides $k$ times (twice, here), and then set $q = 1-p$, and you'll get the same answer (for $k=2$) as is on this page... i.e., $p^2n (n-1) +pn = (pn)^2 + np(1-p).$

$\endgroup$
  • $\begingroup$ Solid approach. Tantamount to "Feynman's Trick" and the way forward I would have presented. Well done! +1 - Mark $\endgroup$ – Mark Viola Mar 19 '16 at 18:47
  • $\begingroup$ o man, this is good, thanks! $\endgroup$ – yoshi Mar 19 '16 at 19:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.