# A calculus of the absurd

##### 4.3.2 Completing the square

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

$$y = a(x + b)^2 + c$$

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,

$$y = ax^2 + 2abx + ab^2 + c$$

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

$$y = 3x^2 + 36x + 42$$

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

$$2\cdot 3 \cdot b = 36$$

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

$$3\cdot 36 + c = 42$$

And thus that $$c=42-108=-66$$. Therefore,

$$3x^2 + 36x + 42 = 3(x+3)^2 - 66$$