Quadratic equations are problems with squares, or “quadratus” in Latin. In 2000 BC, the Babylonians developed an approach to solve problems which, in current notation would be a quadratic equation. A arbitrary example of this is:

A field has a perimeter of 40 and an area of 96. What are the dimensions of this field?”

Around 300 BC, the Greek mathematician Euclid produced a general method to solve quadratic equations.

## Introduction

Before we introduce quadratic polynomials, let’s start by multiplying two linear functions (lines).

### Multiplying linear functions

Let \(g(x)\) and \(h(x)\) be linear functions $$ \left\{ \begin{array}{c} g(x)=x-s\\[5pt] h(x)=x-t \end{array} \right. $$ where \(x\) is a variable and \(s\) and \(t\) are constants.

The function value equals \(0\) at the \(x\)-intercepts. $$\left\{\begin{array}{c} g(x_0)\equiv 0 \Rightarrow& x_0-s\equiv 0 \Rightarrow& x_0=s\\[5pt] h(x_0)\equiv 0 \Rightarrow& x_0-t\equiv 0 \Rightarrow& x_0=t \end{array}\right.$$

First, we define function \(f(x)\) as a scalar \(a\) multiplied with the functions \(g(x)\) and \(h(x)\) $$ f(x)\equiv a\,g(x)\,h(x)=a(x-s)(x-t) \label{eq:GxHxFactorized} $$ This equation results in the parabola \(f(x)\) that shares \(x\)-intercepts with the two lines.

The interactive graph above visualizes the *zero product property*:

If the product of two quantities is equal to zero, then at least one of the quantities must be equal to zero. zero-product property

### Expand

The expression \((x-s)(x-t)\) from function \(\eqref{eq:GxHxFactorized}\) can be expanded geometrically by representing the quantities \(x, -s, -t\) as line segments, and representing the products of two quantities by the area of a rectangle.

Now we multiply this expanded form with scalar \(a\): $$ ax^2-a(s+t)x+a\,s\,t\label{eq:exanded} $$

The equation now fits in the standard form for a single variable quadratic polynomial expression.
$$
\begin{array}{c}
ax^2+bx+c \\
\text{where}\ \ t=-a(s+t),\ \ c=a\,s\,t
\end{array}\label{eq:quadraticExp}
$$
This is called a quadratic expression, or a *second order polynomial* since the greatest power in the equation is two.

## Solutions to Quadratic Equation

In the previous section we showed that multiplying two linear functions creates a quadratic function. Here we will do the opposite and bring the standard form quadratic \(\eqref{eq:quadraticExp}\) back to its factorized form. $$ ax^2 + bx + c \equiv a(x-r_1)(x-r_2)\label{eq:quadratic} $$ We replaced the constants \(s\) and \(t\) with \(r_1\) and \(r_2\) to clearly denote them as the roots.

According to \(\eqref{eq:quadraticExp}\) these roots should add up to \(-\frac{b}{a}\) and while their product equals \(\frac{c}{a}\) $$ r_1+r_2=-\frac{b}{a}\quad\land\quad r_1\,r_2=\frac{c}{a} \label{eq:factorize} $$

In the following section, we will derive a general formula for the roots using a method called “completing the square”.

### Derive the Quadratic Formula

In the factorized form, \(r_1\) and \(r_2\) are the values of \(x\) for which the expression equals \(0\). $$ a(x-r_1)(x-r_2)=0\ \Rightarrow\ \left|\begin{array}{l} x=r_1 \\ x=r_2 \end{array} \right. $$

This implies that the expanded form \(\eqref{eq:quadratic}\) must equal \(0\) for the same values of \(x\). $$ ax^2+bx+c\equiv 0\label{eq:derive0} $$

Now we solve the equation \(\eqref{eq:derive0}\) by isolating \(x\) on the left $$ x^2+\frac{b}{a}x=-\frac{c}{a} \label{eq:derive1} $$

The variable \(x\) occurs twice, which makes the equation hard to solve. We can find the solutions by working towards the identity:

$$ \color{green}{p}^2+2\color{green}{p}\color{purple}{q}+\color{purple}{q}^2=(\color{green}{p}+\color{purple}q)^2\nonumber $$Then we multiply equation \(\eqref{eq:derive1}\) by \(4a^2\)and add \(\color{purple}b^2\) to both sides. $$ \begin{equation} \begin{split} x^2+\frac{b}{a}x &=-\frac{c}{a} & \times 4a^2 \nonumber\\ \Leftrightarrow\quad(\color{green}{2ax})^2+4abx &=-4ac & +b^2 \nonumber\\ \Leftrightarrow\quad(\color{green}{\underline{2ax}})^2+2(\color{green}{\underline{2ax}})\color{purple}{\underline{b}}+\color{purple}{\underline{b}}^2&=-4ac+\color{purple}{b}^2 \end{split}\label{eq:derive2} \end{equation} $$

The left side now fits the format of the identify, where \(\color{green}p=\color{green}{2ax}\) and \(\color{purple}q=\color{purple}b\). Now we apply the identity to equation \(\eqref{eq:derive2}\) $$ \begin{equation} \begin{split} (\color{green}{2ax}+\color{purple}{b})^2&=b^2-4ac & \text{take the }\sqrt{\color{white}{1}}\nonumber\\ 2ax+b &= \pm\sqrt{b^2-4ac} & \text{solve for }x\nonumber\\ 2ax &= -b\pm\sqrt{b^2-4ac}\nonumber\\ x&=\frac{-b\pm\sqrt{b^2-4ac}}{2a} \end{split}\label{eq:roots} \end{equation} $$

The roots found by this equation are the values of \(x\) that are solutions to \(\eqref{eq:roots}\). This implies that the expression \(ax^2+bx+c\) can be factorized as: $$ \shaded{ \begin{equation} \begin{split} a^2+bx+c &=a(x-r_1)(x-r_2) \nonumber\\ \text{where}\ \ r_{1,2} &=\frac{-b\pm\sqrt{b^2-4ac}}{2a}\nonumber \end{split} \end{equation} }\label{eq:quadroots} $$

### Discriminant

A polynomial of the second power always has two roots, though they may or may not be distinct or real.

The expression under the square root sign in \(\eqref{eq:quadroots}\) is called the *discriminant*, or \(D\).
$$
D = b^2-4ac
$$

The discriminant determines the nature of the roots.

- when \(D>0\), there are two distinct real roots.
- when \(D=0\), there is a double real root.
- when \(D<0\), there are two complex roots.

The unit Complex Numbers defined the imaginary unit \(i\) as \(i^2=-1\) and showed that each complex number \(z\) consists of a real part \(x\) and an imaginary part \(iy\), where \(x\) and \(y\) are real numbers. Using \(i\) as the imaginary unit, we can denote any complex number \(z\) as: $$ z = x+iy\label{eq:zdef} $$

These complex numbers extend the number line to a two-dimensional \(\mathbb{C}\)-plane as shown below.

### Real roots

The distinct or double real roots can be easily visualized by plotting the function and finding the \(x\)-intercepts. These intercepts are the roots.

In the figures above the function depicted in the graph on the left has real roots at \(1\) and \(3\), and the function on the right has a double root at \(2\).

### Where are the imaginary roots?

When the roots of a function are complex, the quadratic function \(\eqref{eq:quadratic}\) has a graph that doesn’t intersect the \(x\)-axis as shown below. So where are those roots?

The quadratic formula \(\eqref{eq:quadroots}\) tells us that the roots for the function depicted in the graph above are \(2+2j\) and \(2-2j\). $$ x^2-4x+8=(x-2-2j)(x-2+2j)\label{eq:zquadratic} $$

To find these complex roots visually, we need to broaden our perspective and allow the independent variable \(x\) to have complex values. After all, these roots are complex values. From here on we will name the variable \(z\) instead of \(x\) to emphasize that \(z\in\mathbb{C}\). We will reuse \(x\) for the real part of \(z\).

Evaluate quadratic expression \(\eqref{eq:quadratic}\) with variable \(z\) follows $$ \begin{equation} \begin{split} f(z) &= az^2+bz+c &\forall_{z\in\mathbb{C}}\\ \text{where}\quad z &\equiv x+jy &\forall_{x,y\in\mathbb{R}}\\ \text{and}\ \ f(z) &\equiv u+vj \end{split}\label{eq:fzdef} \end{equation} $$

With a complex function argument \(x+yj\) \(\eqref{eq:zdef}\) and a complex function value \(u+iv\) \(\eqref{eq:fzdef}\), we need four mutually perpendicular axes \(x,y,u,v\) to graph the function. The catch: we can’t graph a 4-dimensional function.

To reduced the graph to a 3-dimensions, either

- Only consider variables \(z\) for which the function value is a real number, and graph the function value on z-axis perpendicular to the \(\mathbb{C}\)-plane. The roots will be where the graph intersects the \(\mathbb{C}\)-plane.
- Consider all variables \(z\in\mathbb{C}\), but take only the modulus of the function value \(|f(z)|\).

The following sections describe each of two visualization techniques. ^{[1]
}

#### Plotting real function values

Now we graph the function \(\eqref{eq:zquadratic}\), considering only values of \(z\) for which the function value \(f(z)=u+jv\) is real (v=0).

We can let the variable be \(z=x+jy\) and split the function value \(\eqref{eq:fzdef}\) into real and imaginary parts $$ \begin{equation} \begin{split} f(z)&=az^2+bz+c & z\equiv x+iy\nonumber\\ &=a(x+jy)^2+b(x+jy)+c &\text{expand}\nonumber\\ &=ax^2+2axjy-ay^2+bx+jby+c &\text{split Re/Im}\nonumber\\ &=\underbrace{(ax^2-ay^2+bx+c)}_{\text{real part}} + \underbrace{y(2ax+b)j}_{\text{imaginary part}} \end{split} \end{equation} $$

The imaginary part of the function value must be \(0\). $$ y(2ax+b)=0 \ \Rightarrow\ \left| \begin{array}{l} y=0 \\ x=-\frac{b}{2a} \end{array} \right. $$

Substitute the value \(y=0\) in \eqref{eq:zdef} $$ \begin{equation} \begin{split} z_r&=x+jy &\text{subst }y=0 \nonumber\\ &=x+0j &\forall_{x\in\mathbb{R}} \end{split}\label{eq:zr} \end{equation} $$ Do the same for \(x=-\tfrac{b}{2a}\) $$ \begin{equation} \begin{split} z_c &=x+yj &\text{subst }x=-\tfrac{b}{2a} \nonumber \\ &=-\tfrac{b}{2a}+yj &\forall_{y\in\mathbb{R}} \end{split}\label{eq:zc} \end{equation} $$

This implies that the function \(\eqref{eq:zquadratic}\) has a real-value

- when evaluated for \(z=x\) where \(x\in\mathbb{R}\), or
- when evaluated for \(z=-\frac{b}{2a}+yj\) where \(y\in\mathbb{R}\)

In the first case, evaluating for \(z=x\) where \(x\in\mathbb{R}\), means evaluating along the familiar \(x\)-axis. This is how we visualized the real roots. $$ \begin{equation} \begin{split} f(z_r) &= az^2+bx+c &\text{subst }z_r=x\text{ from }\eqref{eq:zr}\nonumber\\ \Rightarrow\quad f(x) &= ax^2+bx+c \end{split}\label{eq:fx} \end{equation} $$

In the second case, evaluating for \(z=-\tfrac{b}{2a}+yj\) where \(y\in\mathbb{R}\), means evaluating along a line that intersects the point \(\left(-\frac{b}{2a}+0j\right)\) and runs parallel to the imaginary \(y\)-axis as shown in the figure below.

Substituting \(-\frac{b}{2a}+yj\) for \(z\) in \(\eqref{eq:zquadratic}\). $$ \begin{equation} \begin{split} f(z) &= az^2+bz+c \quad\quad\quad\text{subst }z=-\frac{b}{2a}+yj\text{ from }\eqref{eq:zc}\\ f\left(-\frac{b}{2a}+yj\right) &= a\left(-\frac{b}{2a}+yj\right)^2+b\left(-\frac{b}{2a}+yj\right)+c\nonumber\\ &= {\ccancel[red]{a}}\frac{b^2}{4a^{\ccancel[red]{2}}}-{\ccancel[red]{2a}}\frac{\cbcancel[blue]{b}}{\ccancel[red]{2a}}{\cbcancel[blue]{yj}}-ay^2-\frac{b^2}{2a}+{\cbcancel[blue]{byj}}+c \end{split}\label{eq:fy0} \end{equation} $$

This makes \eqref{eq:fy0} a function of \(y\) because \(a,b\) and \(j\) are constants. $$ \shaded{f(y)=-ay^2-\frac{b^2}{4a}+c\quad\forall_{y\in\mathbb{R}}}\label{eq:fy} $$

Similar to how the graph for \(f(x)\) intersects the \(\mathbb{C}\)-plane at the *real roots*, the graph for \eqref{eq:fy} intersects the \(\mathbb{C}\)-plane at the *complex roots* of the function.

The interactive graph shown below visualizes this concept. Click `Interact`

and wait for the model to load.

#### Plotting the modulus of the function values

Here we graph the function \(\eqref{eq:zquadratic}\) by considering all values of \(z\), but only plotting the modules of the function value \(f(z)\). The modulus \(|f(x+jy)|\) is defined as:

$$ |f(x+jy)|\triangleq\sqrt{x^2+y^2}\nonumber $$

To find the modulus of the function value, we can apply the definition \(\eqref{eq:zdef}\) to the quadratic equation \(\eqref{eq:zquadratic}\). $$ \begin{equation} \begin{split} f(z) &= az^2+bz+c\nonumber\\\ f(x+jy) &= (ax^2-ay^2+bx+c) +y(2ax+b)j\nonumber\\ \Rightarrow\quad |f(x+jy)| &= \sqrt{(ax^2-ay^2+bx+c)^2 +y^2(2ax+b)^2}\\ \text{where}\quad x &\in\mathbb{R}\ \land\ y\in\mathbb{R}\nonumber \end{split} \end{equation} $$

This equation implies that the function arguments are two independent variables. In the graph we depict them as a horizontal complex plane with points \(z=x+jy\). The \(z\)-axis of the graph is used for the modulus of the function value. In this so called *modulus surface*, color is used to show the angle of the function value.

While this surface is well suited to depict real and complex values, it has some drawbacks. The most obvious one is that it shows the modulus of the function where \(|f(z)|\geq0\). As a consequence, the parabolic shape is harder to recognize.

In the graph below, we added the real function values \(f(z_c)\) from the previous visualization technique that showed negative values. In the surface plot, these same function values are represented on the positive \(z\)-axis but shown in red to signify an angle of \(\varphi=\pi\), where \(\mathrm{e}^{j\pi}=-1\).

To draw a modulus surface, you can either use the model below, or you can using the code shown in Appendix A. Click `Interact`

, wait for the model to load and click on \(|f(z)|\).

## Appendix A

2BD: introduceclear [x,y] = meshgrid(-10: 0.1: 10); z = x + i*y; fz = z.^2 - 4.*z + 8; surf(x,y,abs(fz), angle(fz)); zlim([0,20]); xlabel("x"); ylabel("y"); zlabel ("|f(x+jy)|"); shading interp;

## References

[1] | The Complex Roots of a Quadratic Equation: A Visualization Carmen Q Artino, Professor in Mathematics at The College of Saint Rose, Albany, NY. Parabola Volume 45, Issue 3 (2009) |