Finding mode in Binomial distribution

Solution 1:

Let $a_k=P(X=k)$, we have $$a_k=\binom{n}{k}p^kq^{n-k}\qquad\text{and}\qquad a_{k+1}=\binom{n}{k+1}p^{k+1}q^{n-k- 1},$$ where as usual $q=1-p$ in binomial distribution.

We calculate the ratio $\dfrac{a_{k+1}}{a_k}$. Note that $\frac{\binom{n}{k+1}}{\binom{n}{k}}$ simplifies to $\frac{n-k}{k+1},$ and therefore $$\frac{a_{k+1}}{a_k}=\frac{n-k}{k+1}\cdot\frac{p}{q}=\frac{n-k}{k+1}\cdot\frac{p}{1-p}.$$

From this equation we can follow:

$$\begin{align} k > (n+1)p-1 \implies a_{k+1} < a_k \\ k = (n+1)p-1 \implies a_{k+1} = a_k \\ k < (n+1)p-1 \implies a_{k+1} > a_k \end{align}$$

The calculation (almost) says that we have equality of two consecutive probabilities precisely if $a_{k+1}=a_k$, that is, if $k=np+p-1$. Note that $k=np+p-1$ implies that $np+p-1$ is an integer.

So if $k=np+p-1$ is not an integer, there is a single mode; and if $k=np+p-1$ is an integer, there are two modes, at $np+p-1$ and at $np+p$.

Not quite! We have been a little casual in our algebra. We have not paid attention to whether we might be multiplying or dividing by $0$. We also have casually accepted what the algebra seems to say, without doing a reality check.

Suppose that $p=0$. Then $np+p-1$ is an integer, namely $-1$. But whatever $n$ is, there is a single mode, namely $k=0$. In all other situations where $np+p-1$ is an integer, the $k$ we have identified is non-negative.

However, suppose that $p=1$. Again, $np+p-1$ is an integer, and again there is no double mode. The largest $a_k$ occurs at one place only, namely $k=n$, since $np+p$ is in this case beyond our range.

That completes the analysis when $np+p-1$ is an integer. When it is not, the analysis is simple. There is a single mode, at $\lfloor np+p\rfloor$.