## Minimizing and Maximizing a Quadratic

To find the maximum or minimum vale of a quadratic function, we can complete the square.
Example:
$f(x)=x^2+6x-5$
.
Complete the square by writing in the form
$(x+a)^2+b$
.
Expanding the brackets if this expression gives
$ax^2+2ax+a^2+b$
.
$x^2+6x-5=x^2+2ax+a^2+b$
.
Hence
$2ax=6x \rightarrow a=3, \: -5=a^2+b \rightarrow b=-5-a^2=-5-3^2=-14$

The completed square form is
$(x+3)^2-15$
.
The minimum value of the quadratic is -14, occurring at
$x+3=0 \rightarrow x=-3$
. The function has no maximum (is unlimited).
Example:
$f(x)=10+8x-x^2$
.
Complete the square by writing in the form
$a-(x+b)^2$
.
Expanding the brackets if this expression gives
$a-x^2-2bx-b^2$
.
$10+8x-x^2=a-x^2-2bx-b^2$
.
Hence
$-2bx=8x \rightarrow b=-4, \: 10=a-b^2 \rightarrow a=10+b^2=10+(-4)^2=26$

The completed square form is
$26-(x-4)^2$
.
The maximum value of the quadratic is 26, occurring at
$x-4=0 \rightarrow x=4$
. The function has no minimum.
Example:
$f(x)=10+8x-2x^2$
.
Complete the square by writing in the form
$a-b(x+c)^2$
.
Expanding the brackets if this expression gives
$a-bx^2-2bcx-bc^2$
.
$10+8x-2x^2=a-bx^2-2bccx-bc^2$
.
Hence
$-2x^2=-bx \rightarrow b=2, \: 8x=-2bcx \rightarrow c=8/(-2b)=-2$

$10=a-bc^2 \rightarrow a=10+bc^2=10+2 \times (-2)^2=18$
.
The completed square form is
$18-2(x-2)^2$
.
The maximum value of the quadratic is 18, occurring at
$x-2=0 \rightarrow x=2$
. The function has no minimum.