Maximum and minimum of a quadratic function

The maximum or minimum of a quadratic function is found at the vertex of its graph1. Let us find the maximum of y=x2+4x1y = -x^2 + 4x - 1.

Opening downward

Since the coefficient of x2x^2 is negative, this graph is a downward-opening parabola. The vertex is then the highest point, where the function attains its maximum. There is no lower bound, so no minimum.

Completing the square

x2+4x1=(x24x)1=((x2)24)1=(x2)2+3\begin{align*} -x^2 + 4x - 1 &= -(x^2 - 4x) - 1 \\ &= -\left((x - 2)^2 - 4\right) - 1 \\ &= -(x - 2)^2 + 3 \end{align*}

So the vertex is (2,3)(2, 3). Since (x2)2-(x - 2)^2 is 1-1 times a square, it is always at most 00, and it is largest when x=2x = 2. The maximum value 33 is taken there.

Two routes to the same point

MethodComputationResult
Completing the square(x2)2+3-(x-2)^2 + 3vertex (2,3)(2, 3)
Vertex formulax=b2a=42x = -\dfrac{b}{2a} = -\dfrac{4}{-2}x=2x = 2
Calculusy=2x+4=0y' = -2x + 4 = 0x=2x = 2, and y<0y'' < 0

Completing the square finds the vertex from the shape of the expression; differentiating finds it from where the slope is 00.

Maximum or minimum

Sign of aa in y=a(xp)2+qy = a(x - p)^2 + qAt x=px = p
a<0a < 0maximum qq
a>0a > 0minimum qq

Whether it is a maximum or a minimum depends only on the sign of the coefficient of x2x^2.

A restricted interval

One case deserves care: when xx is restricted to an interval. If the vertex lies outside it, the largest and smallest values occur at the endpoints instead. Take this same function on 0x10 \leq x \leq 1.

xxyyRole
001-1minimum
1122maximum
2233vertex, outside the interval

With a restricted domain, always check whether the vertex is inside it.

An application

To maximize the area of a rectangle of perimeter 2020: with height xx the width is 10x10 - x, so the area is S=x(10x)=x2+10xS = x(10 - x) = -x^2 + 10x, whose vertex is at x=5x = 5. The area is greatest, at 2525, when the rectangle is the 55 by 55 square.

The large dot on the graph is the vertex, where the maximum is attained.

  1. Quadratic function, Wikipedia