# Problem of the Week Problem E and Solution Keeping it Small

## Problem

Clara is learning to code, so she has written a program to help her practice what she has learned so far.

Clara’s program takes two real numbers as input, called $$A$$ and $$B$$. First, her program doubles $$A$$, squares the result, and then reduces this result by four times $$A$$. The result is called $$C$$. Then her program squares $$B$$, and then increases this result by six times $$B$$. The result is called $$D$$. Finally, her program outputs the sum of $$C$$ and $$D$$.

Determine the minimum possible output of Clara’s program, and the two input values that produce this output.

## Solution

In order to minimize the final output, we need to minimize both $$C$$ and $$D$$.

First, let’s minimize $$C$$. Clara’s program doubles $$A$$ to get $$2A$$. It squares this result to get $$(2A)^2 = 4A^2$$. It then reduces this number by $$4A$$, to get $$C=4A^2 -4A$$. Thus, we need to minimize $$4A^2 -4A$$. This is a quadratic and so represents a parabola. Since the coefficient of $$A^2$$ is positive, it opens up and so its minimum value occurs at its vertex. We can find the vertex by completing the square. \begin{align} 4A^2 - 4A &= 4(A^2 - A)\\ &= 4\left(A^2 - A + \frac{1}{4}-\frac{1}{4}\right)\\ &= 4\left(A^2 - A + \frac{1}{4}\right)-1\\ &= 4\left(A - \frac{1}{2}\right)^2-1 \end{align} The vertex is at $$\left(\frac{1}{2}, -1\right)$$, and so the minimum value of $$C=4A^2 -4A$$ is $$-1$$ and occurs when $$A=\frac{1}{2}$$.

Now let’s minimize $$D$$. Clara’s program squares $$B$$ to get $$B^2$$. It then increases the result by $$6B$$ to get $$D=B^2+6B$$. So we need to minimize $$B^2+6B$$. This is a quadratic and so represents a parabola. Since the coefficient of $$B^2$$ is positive, it opens up and so its minimum value occurs at its vertex. We can find the vertex by completing the square. \begin{align} B^2 +6B &= (B^2 +6B + 9) - 9\\ &= (B + 3)^2-9 \end{align} The vertex is at $$(-3, -9)$$, and so the minimum value of $$D=B^2+6B$$ is $$-9$$ and occurs when $$B=-3$$.

Therefore, the minimum possible output of Clara’s program is $$-1 + (-9) = -10$$ and occurs when $$A=\frac{1}{2}$$ and $$B=-3$$.

Aside: This problem is essentially asking us to minimize the multivariable function $$f(x,y) = 4x^2 - 4x+ y^2 + 6y$$.