Quadratic functions

A quadratic function is a function of the form

${f(x)=ax^2+bx+c}$, where ${a\ne 0}$.

Here ${a}$, ${b}$, and ${c}$ are numbers. Its graph is a U-shaped curve called a parabola. This page shows how to find the most important point of a parabola, its vertex. Then it uses the vertex to find the largest or smallest value of a function. That solves many real problems.

The graph of a quadratic function

Every parabola has three main features:

vertex (2, −1)axis x = 2(1, 0)(3, 0)(0, 3)xy
The parabola ${y=x^2-4x+3}$. The vertex is ${(2,-1)}$. The dashed line ${x=2}$ is the axis of symmetry.

The graph above also shows the intercepts. The ${x}$-intercepts are where the graph crosses the ${x}$-axis. The ${y}$-intercept is where it crosses the ${y}$-axis.

Standard form

A quadratic function is in standard form (also called vertex form) when it is written as

${f(x)=a(x-h)^2+k}$

In this form, the vertex is the point ${(h,k)}$, and the axis of symmetry is the line ${x=h}$.

Why? This is the graph of ${y=x^2}$ after transformations (see graphs of functions). It is shifted ${h}$ units right and ${k}$ units up, and stretched by ${a}$. So the vertex moves from ${(0,0)}$ to ${(h,k)}$. If ${a<0}$, the parabola is also reflected, so it opens downward.

Watch out: The form has a minus sign: ${x-h}$. So in ${(x+1)^2}$, write ${x+1=x-(-1)}$. Then ${h=-1}$, not ${1}$.

Example 1: For ${f(x)=-(x+1)^2+4}$, find the vertex, the axis of symmetry, and the intercepts. Then sketch the graph.

Solution:

Here ${a=-1}$, ${h=-1}$, and ${k=4}$. Since ${a<0}$, the parabola opens downward.

The vertex is ${(-1,4)}$. The axis of symmetry is ${x=-1}$.

For the ${y}$-intercept, put ${x=0}$:

${f(0)=-(1)^2+4=3}$

For the ${x}$-intercepts, set ${f(x)=0}$, and solve:

$\begin{align*}-(x+1)^2+4&=0\\(x+1)^2&=4\\x+1&=\pm 2\end{align*}$

So ${x=-1+2=1}$, or ${x=-1-2=-3}$.

(−1, 4)(−3, 0)(1, 0)(0, 3)xy
The graph of ${f(x)=-(x+1)^2+4}$. It opens downward, and the vertex ${(-1,4)}$ is the highest point.

Completing the square

Most quadratic functions are given as ${ax^2+bx+c}$. To find the vertex, rewrite the function in standard form. Use completing the square, as on the quadratic equations page.

There is one difference. An equation has two sides, so there we added the same number to both sides. A function has only one side. So we add a number and subtract it again. This changes the look, but not the value.

Example 2: Write ${f(x)=x^2-6x+5}$ in standard form, and find the vertex.

Solution:

Half of ${-6}$ is ${-3}$, and ${(-3)^2=9}$. Add ${9}$ and subtract ${9}$:

$\begin{align*}&f(x)\\&=x^2-6x+9-9+5\\&=(x^2-6x+9)-4\\&=(x-3)^2-4\end{align*}$

So ${h=3}$ and ${k=-4}$. The vertex is ${(3,-4)}$. Since ${a=1>0}$, the parabola opens upward.

If ${a\ne 1}$, first factor ${a}$ out of the two ${x}$-terms. Then complete the square inside the parentheses.

Example 3: Write ${f(x)=2x^2+8x+5}$ in standard form, and find the vertex.

Solution:

Factor ${2}$ out of ${2x^2+8x}$:

${f(x)=2(x^2+4x)+5}$

Half of ${4}$ is ${2}$, and ${2^2=4}$. Add and subtract ${4}$ inside the parentheses:

${f(x)=2(x^2+4x+4-4)+5}$

Now move the ${-4}$ out of the parentheses. It is multiplied by ${2}$, so it becomes ${-8}$:

$\begin{align*}&f(x)\\&=2(x^2+4x+4)-8+5\\&=2(x+2)^2-3\end{align*}$

So ${h=-2}$ and ${k=-3}$. The vertex is ${(-2,-3)}$, and the parabola opens upward.

Check: Multiply out the answer:

$\begin{align*}&2(x+2)^2-3\\&=2(x^2+4x+4)-3\\&=2x^2+8x+5\end{align*}$

The vertex formula

Completing the square works every time. But there is a faster way to find the vertex. For ${f(x)=ax^2+bx+c}$:

The vertex is at ${x=-\dfrac{b}{2a}}$.

To find the ${y}$-value of the vertex, put this ${x}$ into the function.

Optional

Where the formula comes from. Complete the square in ${ax^2+bx+c}$. Factor ${a}$ out of the ${x}$-terms:

${f(x)=a\left(x^2+\dfrac{b}{a}x\right)+c}$

Half of ${\dfrac{b}{a}}$ is ${\dfrac{b}{2a}}$. Add and subtract its square inside the parentheses. This gives

$f(x)=a\left(x+\dfrac{b}{2a}\right)^2+c-\dfrac{b^2}{4a}$.

This is standard form with ${h=-\dfrac{b}{2a}}$.

Maximum and minimum values

The vertex is the lowest or the highest point of the graph. So its ${y}$-value is the smallest or the largest value of the function. For ${f(x)=a(x-h)^2+k}$:

If ${a>0}$, the minimum value (smallest value) of ${f}$ is ${k=f(h)}$.

If ${a<0}$, the maximum value (largest value) of ${f}$ is ${k=f(h)}$.

Why? The square ${(x-h)^2}$ is never negative, and it is ${0}$ only at ${x=h}$. So if ${a>0}$, the term ${a(x-h)^2}$ only adds to ${k}$. If ${a<0}$, it only takes away from ${k}$.

This also gives the range. If ${a>0}$, the range is ${[k,\infty)}$. If ${a<0}$, it is ${(-\infty,k]}$.

Graphing a quadratic function

To sketch the graph of ${f(x)=ax^2+bx+c}$:

  1. Look at the sign of ${a}$: the parabola opens upward if ${a>0}$, and downward if ${a<0}$.
  2. Find the vertex with ${x=-\dfrac{b}{2a}}$. Draw the axis of symmetry through it.
  3. Find the ${y}$-intercept: ${f(0)=c}$.
  4. Find the ${x}$-intercepts by solving ${f(x)=0}$. There may be two, one, or none.
  5. Plot these points. Reflect them across the axis to get more points. Then draw a smooth U shape.

Example 4: Sketch the graph of ${f(x)=-2x^2+4x+1}$. Find the maximum value and the range.

Solution:

Here ${a=-2}$, ${b=4}$, and ${c=1}$. Since ${a<0}$, the parabola opens downward.

The vertex is at

${x=-\dfrac{4}{2(-2)}=1}$.

Its ${y}$-value is

${f(1)=-2+4+1=3}$.

So the vertex is ${(1,3)}$, and the axis is ${x=1}$.

The ${y}$-intercept is ${f(0)=1}$. The point ${(0,1)}$ is ${1}$ unit left of the axis. Its mirror point is ${1}$ unit right of the axis: ${(2,1)}$.

For the ${x}$-intercepts, solve ${-2x^2+4x+1=0}$ with the quadratic formula:

$\begin{align*}&x\\&=\dfrac{-4\pm\sqrt{4^2-4(-2)(1)}}{2(-2)}\\&=\dfrac{-4\pm\sqrt{24}}{-4}\\&=1\mp\dfrac{\sqrt{6}}{2}\end{align*}$

So ${x\approx -0.22}$ and ${x\approx 2.22}$.

(1, 3)(0, 1)(2, 1)xy
The graph of ${f(x)=-2x^2+4x+1}$. The points ${(0,1)}$ and ${(2,1)}$ are mirror images across the axis ${x=1}$.

The parabola opens downward, so the vertex is the highest point. The maximum value is ${f(1)=3}$. The range is ${(-\infty,3]}$.

Applications

Many problems ask for the largest or smallest possible value of something. If that quantity is a quadratic function, the answer is at the vertex.

Example 5: A rectangle has a perimeter of ${20}$ cm. Find the width that gives the largest area. What is that area?

Solution:

On the functions page (Example 6), we found the area as a function of the width ${w}$:

${A(w)=w(10-w)=-w^2+10w}$

This is a quadratic function with ${a=-1}$ and ${b=10}$. Since ${a<0}$, the vertex gives the maximum. It is at

${w=-\dfrac{10}{2(-1)}=5}$.

The largest area is

${A(5)=5(10-5)=25}$.

So the width is ${5}$ cm, and the largest area is ${25}$ cm${^2}$. The length is also ${10-5=5}$ cm, so the best rectangle is a square.

Example 6: A ball is thrown straight up. It leaves the hand ${2}$ m above the ground. Its height after ${t}$ seconds is

${h(t)=-4.9t^2+19.6t+2}$ meters.

When does the ball reach its highest point? How high does it go?

Solution:

The ball goes up, slows down, and stops for an instant at the top. Then it falls. The height is a quadratic function of ${t}$ with ${a=-4.9<0}$. So its graph opens downward, and the vertex is the highest point.

The vertex is at

$t=-\dfrac{19.6}{2(-4.9)}=\dfrac{19.6}{9.8}=2$.

The height at that time is

$\begin{align*}&h(2)\\&=-4.9(2)^2+19.6(2)+2\\&=-19.6+39.2+2\\&=21.6\end{align*}$

The ball reaches its highest point after ${2}$ seconds. It is then ${21.6}$ m above the ground.

12345101520(2, 21.6)th
The height of the ball. The highest point of the parabola is the vertex ${(2,\,21.6)}$.

Example 7: A farmer has ${100}$ m of fence. It will enclose a rectangular field along a straight river. The river side needs no fence. What size gives the largest area?

Solution:

The fence covers three sides of the rectangle. Let ${x}$ be the length of each side that points away from the river. These two sides use ${2x}$ meters of fence. The rest, ${100-2x}$, goes along the far side, parallel to the river.

riverfieldxx100 − 2x
The fence (blue) runs along three sides. The river forms the fourth side.

The area is length times width:

${A(x)=x(100-2x)=-2x^2+100x}$

Here ${a=-2}$ and ${b=100}$. Since ${a<0}$, the vertex gives the maximum. It is at

${x=-\dfrac{100}{2(-2)}=25}$.

The far side is then ${100-2(25)=50}$ m. The largest area is

${A(25)=25\cdot 50=1250}$ m${^2}$.

So the field should be ${25}$ m by ${50}$ m, with the ${50}$ m side parallel to the river.

Summary