Proof of mean of binomial distribution by differentiation The mean of the binomial distribution, i.e. the expectation for number of events, is $np$. I've seen this proven by rearranging terms so that $np$ comes out. For example here, Relating two proofs of binomial distribution mean
I've also seen the following logic:
$$
 (p+q)^n = \sum_{k=0}^n \binom{n}{k} p^k q^{n-k}\\
p\frac{\partial}{\partial p} (p+q)^n = p\frac{\partial}{\partial p} \sum_{k=0}^n \binom{n}{k} p^k q^{n-k}\\
np (p+q)^{n-1} = \sum_{k=0}^n \binom{n}{k} k p^k q^{n-k}\\
np * 1^{n-1} = \langle k \rangle
$$
in which the fact that $p = 1-q$ is conveniently ignored until the end. Is this a sound proof? If not, could it be improved?

Ugh, that's a nasty way to do it! The steps are correct, but the starting point is wrong; it just happens to work in this case.
Consider instead
$$ G(t) = E[t^X] = \sum_{k=0}^n P(X=k) t^k. $$
This is called the Probability Generating Function of the random variable $X$. It has some properties that are easy to relate to properties of $X$: the most basic of these is probably
$$ G(1) = \sum_{k=0}^n P(X=k) = 1. $$
Now, what happens when we differentiate?
$$ G'(t) = \sum_{k=1}^n P(X=k)kt^{k-1}, $$
so
$$ G'(1) = \sum_{k=1}^n P(X=k)k = E[X]. $$
Ah, this is what we want. You can go further and derive an expression for the variance, but that's not what we're interested in here. For the binomial distribution, it is easy to see using the binomial theorem that
$$ G(t) = \sum_{k=1}^n \binom{n}{k}p^kq^{n-k} t^k = (q+pt)^n = (1-p+pt)^n $$
Ah, no this looks rather like the starting point of your expression, but we have a $t$ in it as well. Hence we have a free variable with respect to which we can differentiate:
$$ G'(t) = np(1-p+pt)^{n-1} \implies E[X] = np(1-p+p)^{n-1}=np. $$
Any discrete probability distribution has a generating function, and exactly the same technique can be applied: that's why this idea's useful.
