### Basic functions: Polynomial functions

### Completing the square

**Completing the square** is a useful method for computing the vertex and zeros of a quadratic function. Finding zeros boils down to the reduction of a quadratic equation of the form\[ax^2+bx+c=0\] to an equation of the form \[a(x+p)^2+q=0\] for some real numbers \(a\), \(b\), \(c\), \(p\), and \(q\) with \(a\neq 0\).

Once a quadratic function is in the form \(a(x+p)^2+q\), then the coordinates of the vertex are equal to \((-p,q)\).

\(\phantom{x}\)

An example explains the method.

Example of completing the square In order to solve the equation \[x^2+6x-7=0\] we rewrite it as \[x^2+6x+9=16\] because the left-hand side is now a square, namely \((x+3)^2\). Indeed \[x^2+6x+9=(x+3)^2\] The established equation can be solved by the basic techniques: \[x+3=4\quad\text{or}\quad x+3=-4\] and so the solution is \[x=1\quad\text{or}\quad x=-7\]

General method of finding solutions by completing the square The method in the example above works in general for the quadratic equation \(ax^2+bx+c=0\): if the coefficient of \(x^2\) is equal to 1, then \(p=1\). Otherwise, you divide the equation first by \(a\) to get a leading coefficient that is equal to \(1\). Next, take half of the coefficient of \(x\) to make a square on the left-hand side, that is, choose this numerical value for \(q\). In other words, set \(p=\frac{b}{2}\). Determine the constant on the right-hand side of the equation, in other words, calculate \(-q=\frac{b^2}{4}-c\). If the constant \(-q\) is negative, then there is no solution. If this constant is equal to zero, then there is exactly one solution, namely \(x=-q\). If this constant is positive, then there are two solutions.

\(\phantom{x}\)

We give other examples of completing the square, also with a coefficient of \(x^2\) unequal to one.

We write down the steps in completing the square \[\begin{aligned} x^2+x+1=0 & \phantom{abcxyz} \blue{\text{the given quadratic equation}} \\ \\ \left(x+{{1}\over{2}}\right)^2-\left({{1}\over{2}}\right)^2+1=0 &\phantom{abcxyz} \blue{\text{completing the square}}\\ \\ \left(x+{{1}\over{2}}\right)^2+{{3}\over{4}}=0& \phantom{abcxyz} \blue{\text{simplification}}\\ \\ \left(x+{{1}\over{2}}\right)^2=-{{3}\over{4}}& \phantom{abcxyz} \blue{\text{isolation of the square}}\\ \\ \text{no solution} & \blue{\phantom{abcxyz}\text{the square of a real number cannot be negative}} \end{aligned}\]

#\phantom{x}#

Mathcentre videos

Completing the Square - Animation (1:50)

#\phantom{x}#

Completing the Square by Inspection (19:38)