A calculus of the absurd

4.3.2 Completing the square

One core idea is that we can write any quadratic in the form

\begin{equation} y = a(x + b)^2 + c \end{equation}

This is very important, because it allows us to find \(x\) given a value for \(y\), e.g. if \(y=0\), then

\begin{align} a(x + b)^2 + c = 0 \\ & (x+b^2)^2 = -\frac {c}{a} \\ & x + b^2 = \sqrt {-\frac {c}{a}} \\ & x = -b^2 + \sqrt {-\frac {c}{a}} \end{align}

How do we write a quadratic in this form? We can start by expanding,

\begin{equation} y = ax^2 + 2abx + ab^2 + c \end{equation}

From here, we can “compare coefficients”, for example for the quadratic

\begin{equation} y = 3x^2 + 36x + 42 \end{equation}

We know that for this to be true for all values of \(x\), it must be the case that by comparing coefficients we know that

\begin{align} \begin{cases} a = 3 \\ 2ab = 36 \\ ab^2 + c = 42 \end {cases} \end{align}

We can solve this by first substituting \(a=3\) in the second equation, i.e. we have that

\begin{equation} 2\cdot 3 \cdot b = 36 \end{equation}

From which we have that \(b = \frac {36}{6} = 6\). We can then substitute the value \(b=64\) into \(b^2 + c = 42\), which gives that

\begin{equation} 3\cdot 36 + c = 42 \end{equation}

And thus that \(c=42-108=-66\). Therefore,

\begin{equation} 3x^2 + 36x + 42 = 3(x+3)^2 - 66 \end{equation}