# derivative of binomial probability

I saw the following claim in some book without a proof and couldn't prove it myself.

$\dfrac{d}{dp}\mathbb{P}\left(\text{Bin}\left(n,\,p\right)\leq d\right)=-n\cdot\mathbb{P}\left(\text{Bin}\left(n-1,\,p\right)=d\right)$

So far I got:

$\begin{array}{l} \dfrac{d}{dp}\mathbb{P}\left(\text{Bin}\left(n,\,p\right)\leq d\right)=\\ \dfrac{d}{dp}\sum\limits _{i=0}^{d}\left(\begin{array}{c} n\\ i \end{array}\right)p^{i}\left(1-p\right)^{n-i}=\\ -n\cdot\left(1-p\right)^{n-1}+\sum\limits _{i=1}^{d}\left(\begin{array}{c} n\\ i \end{array}\right)\left[ip^{i-1}\left(1-p\right)^{n-i}-p^{i}\left(n-i\right)\left(1-p\right)^{n-i-1}\right] \end{array}$

But I am not very good playing with binomial coefficients and don't know how to proceed.

• Did you write down $$\mathbb{P}\left(\text{Bin}\left(n,\,p\right)\leq d\right)$$ as a function of $p$? What did you get? – Did Apr 3 '17 at 17:41
• Of course I did. $P\left(\text{Bin}\left(n,\,p\right)\leq d\right)=\sum\limits _{i=0}^{d}\left(\begin{array}{c} n\\ i \end{array}\right)p^{i}\left(1-p\right)^{n-i}$ – user25640 Apr 3 '17 at 17:56
• And the derivative? – Did Apr 3 '17 at 18:04
• $-n\cdot\left(1-p\right)^{n-1}+\sum\limits _{i=1}^{d}\left(\begin{array}{c} n\\ i \end{array}\right)\left[ip^{i-1}\left(1-p\right)^{n-i}-p^{i}\left(n-i\right)\left(1-p\right)^{n-i-1}\right]$ – user25640 Apr 3 '17 at 18:13

## 1 Answer

Consider the derivative of the logarithm: $$\frac{d}{dp} \left[\log \Pr[X = x \mid p]\right] = \frac{d}{dp}\left[x \log p + (n-x) \log (1-p)\right] = \frac{x}{p} - \frac{n-x}{1-p},$$ hence $$\frac{d}{dp}\left[\Pr[X = x \mid p]\right] = \binom{n}{x} p^x (1-p)^{n-x} \left(\frac{x}{p} - \frac{n-x}{1-p}\right)$$ and \begin{align*} \frac{d}{dp}\left[\Pr[X \le x \mid p] \right] &= \sum_{k=0}^x \binom{n}{k} p^k (1-p)^{n-k} \left(\frac{k}{p} - \frac{n-k}{1-p}\right) \\ &= \sum_{k=0}^x \binom{n}{k} k p^{k-1} (1-p)^{n-k} - \binom{n}{k} (n-k) p^k (1-p)^{n-1-k}. \end{align*} But observe that $$\binom{n}{k}(n-k) = \frac{n!}{k!(n-k-1)!} = \frac{(k+1) n!}{(k+1)!(n-(k+1))!} = (k+1)\binom{n}{k+1},$$ hence the second term can be written $$(k+1) \binom{n}{k+1} p^{(k+1)-1} (1-p^{n-(k+1)}),$$ which is the same as the first term except the index of summation has been shifted by $1$. Therefore, the sum is telescoping, leaving $$\frac{d}{dp}\left[\Pr[X \le x \mid p]\right] = 0 - \binom{n}{x} (n-x) p^x (1-p)^{n-1-x}.$$ All that remains is to observe $$\binom{n}{x}(n-x) = \frac{n!}{x!(n-x-1)!} = \frac{n(n-1)!}{x!(n-1-x)!} = n \binom{n-1}{x},$$ therefore $$\frac{d}{dp}\left[\Pr[X \le x \mid p] \right] = -n \Pr[X^* = x \mid p],$$ where $X^* \sim \operatorname{Binomial}(n-1,p)$, as claimed.