Complex Numbers for Solving the Cubic

| math

Tristan Needham in his brilliant book Visual Complex Analysis explains how introducing the complex numbers via solving quadratic equations is an unintuitive piece of historical fiction, because the appearance of negative numbers under the square root geometrically simply indicates that the parabola does not cross the line \(y = 0.\) So there is no motivation to do calculations with these numbers.

Instead, the more compelling case for them arises when solving cubic equations. This post just recapitulates Needham's introduction to complex numbers and fills in the gaps left as exercises to the reader. I start out with the general cubic function. $$ f(x) = a_0 x^3 + b_0 x^2 + c_0 x + d_0 $$

Scaling the graph

First I'll get rid of the first coefficient by dividing both sides by \(a_0\) (we can assume \(a_0 \neq 0\), otherwise we wouldn't be dealing with a cubic function). $$ \frac{f(x)}{a_0} = x^3 + \frac{b_0}{a_0}x^2 + \frac{c_0}{a_0}x + \frac{d_0}{a_0} $$

This is a bit unwieldy, but a rebranding of the form \(S = \frac{S_0}{a_0}\) helps. $$ f_1(x) = x^3 + b x^2 + c x + d $$ The new function is just the old one scaled by the inverse of its first coefficient.

Inflection point

The most important point of the cubic function is arguably its inflection point. Where does it occur? The point of inflection is where the curvature changes sign, or in other words, the instantaneous rate of change of the slope of the tangent lines is reversing. The slope of the tangent lines is, of course, given by the first derivative, which is the following quadratic function. $$ f_1'(x) = 3 x^2 + 2b x + c $$

The instantaneous rate of change of this function (the slope of its tangent lines) is again the derivative. $$ f_1''(x) = 6 x + 2b $$

That the values of this function are reversing just means that they change from negative to positive or vice versa. So I'm looking for an \(x\) such that \(f''(x) = 0\), which is \(x = -\frac{b}{3}.\) Now it's pretty clear from the function definition that \(f''(x) \lt 0\) if \(x \lt -\frac{b}{3}\) and \(f''(x) \gt 0\) if \(x \gt -\frac{b}{3}\), so this indeed is the inflection point.

Centering the graph

Adding the x-value of the inflection point to the input of \(f_1\), that is, defining a new function \(f_2(x) = f_1(x - \frac{b}{3})\), has the effect of centering the graph at \(x = 0\). Geometrically, it's now clear that the coefficient of the quadratic term in the new function \(f_2\) must be zero. Why? For all \(|x| \lt 1\), we have \(x^2 > x^3\). So for any coefficient other than zero, the function values \(f_2(x)\) in some small neighborhood of \(x=0\) would increase or decrease in both directions and we wouldn't be looking at an inflection point, but a maximum or minimum.

Let me verify this algebraically using the binomial theorem (ok, actually I used SymPy). $$ \begin{align*} f_2(x) &= (x-\frac{b}{3})^3 + b (x-\frac{b}{3})^2 + c (x-\frac{b}{3}) + d \\ &= x^3 + \left( c - \frac{b^2}{3} \right) x + \left( \frac{2b^3}{27} - \frac{bc}{3} + d \right) \end{align*} $$

As you can see, there is no quadratic term.

Solving the cubic equation

To find the real root(s) of the cubic function, the points where the cubic function crosses the x-axis, we need to solve \(f_2(x) = 0\). The cubic function \(f_2\) can be written as $$ f_2(x) = x^3 - 3px - 2q $$

with $$ \begin{align*} p &= \frac{b^{2}}{9} - \frac{c}{3} \\ q &= - \frac{b^{3}}{27} + \frac{b c}{6} - \frac{d}{2} \end{align*} $$

I make what Needham calls an inspired substitution \(x = s+t\). $$ \begin{align*} (s+t)^3 &= 3p (s+t) + 2q\\ 3(st)s + 3(st)t + \left( s^3 + t^3 \right) &= 3ps + 3pt + 2q \end{align*} $$

Clearly \(x\) solves the equation if \(st = p\) and \(s^3 + t^3 = 2q\). I solve the first equation for \(t\) and plug the result into the second equation to get rid of \(t\). $$ s^3 + \left( \frac{p}{s} \right)^3 = 2q $$

This can be interpreted as a quadratic equation in \(s^3\). $$ (s^3)^2 - 2qs^3 = -p^3 $$

I solve for \(s^3\) by completing the square. $$ \begin{align*} (s^3)^2 - 2qs^3 + q^2 &= q^2 - p^3\\ (s^3 - q)^2 &= q^2 - p^3\\ s^3 &= q \pm \sqrt{q^2 - p^3} \end{align*} $$

By symmetry, we arrive at \(t^3 = q \pm \sqrt{q^2 - p^3}\). And by substituting \(s^3\) into \(s^3 + t^3 = 2q\), we see that \(\pm\) in \(t^3\) stands for the opposite of \(\pm\) in \(s^3\). (Probably my notation here is suboptimal.) $$ t^3 = 2 q - \left( q \pm \sqrt{q^2 - p^3} \right) = q \pm \sqrt{q^2 - p^3} $$ Since \(x = s + t\), we always get one term with the positive and one with the negative square root. $$ x = \sqrt[3]{q + \sqrt{q^2 - p^3}} + \sqrt[3]{q - \sqrt{q^2 - p^3}} $$

Complex numbers

Now if \(p^3 > q^2\), the expression under the square roots is negative. In case of the quadratic formula, this indicates that there are no real solutions. However, it's known that the cubic always has at least one real solution. Take Bombelli's example of \(p = 5\) and \(q = 2\). $$ x^3 = 15x + 4 $$ The real solution should be \(x = 4\). $$ \begin{align*} x &= \sqrt[3]{2 + \sqrt{2^2 - 5^3}} + \sqrt[3]{2 - \sqrt{2^2 - 5^3}}\\ &= \sqrt[3]{2 + \sqrt{-11}} + \sqrt[3]{2 - \sqrt{-11}} \end{align*} $$ Assume \(i = \sqrt{-1}\) to simplify the calculations. $$ x = \sqrt[3]{2 + 11i} + \sqrt[3]{2 - 11i} $$ What appears under the roots are complex numbers. Ideally, the rules of calculation for these numbers should be such that the imaginary parts in this example cancel out while the real parts are added. It's natural to start with what's familiar: the rules for calculating with real numbers. So \(i\) is treated just as any regular real variable. To calculate \(x\), we'd like to find complex numbers \((2 + ni)^3 = 2 + 11i\) and \((2 -ni)^3 = 2 - 11i \). I'll multiply this out using the binomial theorem. $$ \begin{align*} (2 + in)^3 &= 2^3 + 3 \cdot 2^2 in + 3 \cdot 2 (in)^2 + (in)^3 \\ &= 8 + 12 in + 6 i^2 n^2 + ii^2 n^3 \\ &= 8 - 6n^2 + i (12n - n^3) \end{align*} $$ Clearly \(n = 1\) gives us the desired terms and everything falls into place. $$ \begin{align*} x &= \sqrt[3]{(2 + i)^3} + \sqrt[3]{(2 - i)^3} \\ &= 2 + 2 + i - i \\ &= 4 \end{align*} $$

Complex addition and multiplication

In general, complex addition follows from the familiar field properties associativity and distributivity. $$ (a_1 + i a_2) + (b_1 + i b_2) = (a_1 + b_2) + i(a_2 + b_2) $$ Multiplication follows from \(i^2 = -1\), distributivity and commutativity. $$ \begin{align*} (a_1 + ia_2) (b_1 + ib_2) &= a_1 b_1 + a_1 ib_2 + ia_2 b_1 + i^2 a_2 b_2\\ &= a_1 b_1 + i (a_1 b_2 + a_2 b_1) + i^2 a_2 b_2 \\ &= a_1 b_1 - a_2 b_2 + i (a_1 b_2 + a_2 b_1) \end{align*} $$

Although all this looks familiar, the complex numbers do behave differently from the reals. They do not form an ordered field, so we cannot compare them with greater or less than. Apparently this puzzled mathematicians for quite some time in the past.

Needham, T. (1997). Visual complex analysis. Oxford University Press.