# Largest variance

Let S be the number of successes in n independent Bernoulli trials, with possibly different probabilities $p_1$ $,...,$ $p_n$ pn on different trials. Show that for fixed $\mu$=E(S), Var(S) is largest in case the probabilities are all equal.

I figured out that $Var(S)=\sum_{i=1}^n p_i(1-p_i)$, and my question is why $p_i$ for i=1,2,..,n are all equal to make Var(S) largest.

Thanks!

• For each i $p_i$ (1-$p_i$) is maximized when it equals 1/2. That would make each term equal to 1/4 and so the total would be n/4. – Michael Chernick Apr 25 '17 at 19:40
• Why not look at the situation for $n=2$? It might also help to simplify $\sum p_i(1-p_i) = \mu - \sum p_i^2.$ You could also compare this to $-\sum(p_i-\mu/n)^2$: since the two turn out to differ by a constant, you only have to maximize this sum of squares. @Michael The issue is that the $p_i$ are not independent: the problem asserts they sum to $\mu$. – whuber Apr 25 '17 at 19:44
• @whuber The OP said that the Bernoulli trials are independent. But I missed the part where he has the restriction that E(S)=$\mu$ for a specified fixed value. That makes a differences as you point out. – Michael Chernick Apr 25 '17 at 19:51

You can easily do this with lagrange multipliers. Your constraint is $\sum_{i=1}^n p_i=\mu$, along with $p_i\geq 0$. Then the method of lagrange multipliers gives:
$$1-2p_i=\lambda , \ \sum_{i=1}^np_i=\mu.$$
So each $p_i$ is equal to a constant $c$. The constraint gives $c=\mu/n$. To check that this is a maximum, you just need to check the boundary cases of $p_k=1$, $p_i=0\ (i\neq k)$, all of which give 0 variance. So the above is a maximum.
For a more classical approach, by Cauchy Schwartz, $|\sum_i a_ib_i|$ is maximized when $b_i=Ca_i$. For you this gives $p_i=C(1-p_i)$, or $p_i=1/(1+C)$. With your additional constraint of $\sum_ip_i=\mu$, you get the same result.