# How to maximize this equation?

I am trying to maximize $P = 20q_a - 2q_a^2 + 16q_b-2q_b^2 – 1/4 (q_a + q_b)^2$, a profit equation, function of two separate quantities of products. I thought that what I need to do is to set both derivatives =0 and find where that equation holds for both variables, but I am having some trouble. Here's my work:

$dP/dq_a = 20 – 4q_a – 1/2 (q_a + q_b) = 0$
$dP/dq_b = 16 – 4q_b – 1/2 (q_a + q_b) = 0$
$4 – 4q_a +4q_b = 0$
$4 = 4 (q_a – q_b)$
$q_a = q_b + 1.$

As you can see from the last equation, I get $q_a = q_b + 1$, but when I plug a pair of 1, 0 ($q_a$ and $q_b$) into the derivative equations, I do not get 0's, so I guess I made a mistake somewhere (wolfram alpha gives a definitive answer). Please help, thanks!

-
The partial derivatives are $$\frac{\partial P}{\partial q_{a}}=20-\frac{9}{2}q_{a}-\frac{1}{2}q_{b}$$ $$\frac{\partial P}{\partial q_{b}}=16-\frac{9}{2}q_{b}-\frac{1}{2}q_{a},$$ and the solution of the system $$\left\{ \begin{array}{c} 20-\frac{9}{2}q_{a}-\frac{1}{2}q_{b}=0 \\ 16-\frac{9}{2}q_{b}-\frac{1}{2}q_{a}=0 \end{array} \right.$$ is $$q_{a}=\frac{41}{10},q_{b}=\frac{31}{10}.$$ –  Américo Tavares Sep 17 '11 at 22:11
Your subject line should say "How to maximize this function". "Equation" is definitely not the right word; it's not an equation. –  Michael Hardy Sep 17 '11 at 22:12

What you have at the end is essentially just $dP/dq_a-dP/dq_b=0$. This isn't equivalent to making both derivatives simultaneously zero: you've just made them both equal. But if they're both zero it means they're both equal, so you can at least use your last line to go further. Plug $q_a=q_b+1$ back into one of the original derivatives, set to $0$, and solve; then substitute back for $q_a$.
$$\begin{pmatrix}4+1/2 & 1/2\\ 1/2 & 4+1/2\end{pmatrix}\begin{pmatrix}q_a\\q_b\end{pmatrix}=\begin{pmatrix}20\\16\end{pmatrix}.$$ Do you know how to solve this?