I was given the following question:
The Hardy-Weinberg Law of genetics describes the relationship between the proportions of different genes in populations. Suppose that a certain gene has three types (e.g., blood types of A, B and O). If the three types have proportions p, q and r, respectively, in the population, then the Hardy-Weinberg law states that the proportion of people who carry two different types of genes equals $f (p, q,r) = 2pq + 2pr + 2qr$. Explain why $p + q + r = 1$ and then show that the maximum value of $f (p, q,r)$ is $\frac23$.
For the first part of the question, I said that p,q, and r each represent a percentage and so in total they must equal one. Is this reasoning correct?
I then set the equation like this: $r=1-p-q$ because this makes it look more like the functions I am used to dealing with. The only problem is that when I take partial derivatives to find the maximum, I end up with zero. I know the answer must be $\frac23$. How can I fix this?
Without Lagrange Multipliers.
Observe first that, $$f(p,q,r) = 2(pq+pr+qr) = (p+q+r)^2 -(p^2+q^2+r^2) = 1-(p^2+q^2+r^2).$$ To maximize $f$ you want to minimize $p^2+q^2+r^2$ subject to the constraint $p+q+r=1.$ In other words you want to minimize $g(p,q) = p^2+q^2+(1-p-q)^2.$ Then $$g_p = 2p -2(1-p-q)= 4p-2+2q=0, \quad g_q = 4q-2+2p =0$$ which implies $p=q=1/3.$ Thus $r= 1/3.$ This implies that $f(p,q,r) = 2/3$ at the minimum value.
Note: $g_p = \frac{\partial f}{\partial p}.$