Read · 2 min

Cardano's Formula: Solving the General Cubic Equation

The quadratic formula has been known to humans for thousands of years. It is fairly straightforward to derive, and can be done as follows.

A small refresher: the quadratic formula

ax2+bx+c=0ax^2 + bx + c=0

ax2+bx=−cax^2 + bx = -c

x2+bax=−cax^2 + \frac{b}{a}x = -\frac{c}{a}

x2+bax+(b2a)2=−ca+(b2a)2x^2 + \frac{b}{a}x + \big(\frac{b}{2a}\big)^2= -\frac{c}{a}+ \big(\frac{b}{2a}\big)^2

(x+b2a)2=−4ac4a2+b24a2=b2−4ac4a2\big(x+ \frac{b}{2a}\big)^2= -\frac{4ac}{4a^2}+ \frac{b^2}{4a^2} = \frac{b^2-4ac}{4a^2}

x+b2a=±b2−4ac2ax+ \frac{b}{2a} = \pm \frac{\sqrt{b^2-4ac}}{2a}

x=−b2a±b2−4ac2a=−b±b2−4ac2a.x = -\frac{b}{2a} \pm \frac{\sqrt{b^2-4ac}}{2a} = \frac{-b\pm \sqrt{b^2-4ac}}{2a}.

So we completed the square to find the square of x+b2ax + \frac{b}{2a}, and then took the square root and subtracted the b2a\frac{b}{2a} term. A slightly interesting thing happens if we consider a similar polynomial ay2+by+cay^2 + by + c, where y=x−b2ay = x - \frac{b}{2a}. Then we should get x−b2a+b2a=xx - \frac{b}{2a} + \frac{b}{2a}=x in that step, right? Let us see:

ay2+by+c=a(x−b2a)2+b(x−b2a)+cay^2 + by + c=a\big(x - \frac{b}{2a}\big)^2 + b\big(x - \frac{b}{2a}\big) + c

=a(x2−bax+b24a2)+b(x−b2a)+c=ax2−bx+b24a+bx−b22a+c=a\big(x^2 - \frac{b}{a}x + \frac{b^2}{4a^2}\big) + b\big(x - \frac{b}{2a}\big) + c = ax^2 -bx + \frac{b^2}{4a} + bx - \frac{b^2}{2a} + c

=ax2+(c−b24a)=ax^2 +\big(c-\frac{b^2}{4a}\big).

So as we see, making this substitution simplifies our quadratic equation into an equation of the form a′x2+c′a'x^2 +c' by eliminating the linear term. However, our reasoning behind this has yet to become clear.

The Cubic Formula

In the middle of the 16th century, Italian mathematician Niccolò Tartaglia discovered a method of solving the cubic equation, and told it to Cardano in exchange for a promise not to publish it. However, in 1543, Cardano found that the formula was discovered independently by Scipione del Ferro, and in 1545 published it anyway, believing that he was no longe obligated to keep the promise. The formula now bears Cardano's name.

Step 1: Eliminating the quadratic term

We consider the cubic ax3+bx2+cx+d=0ax^3+bx^2+cx+d=0 and apply a substitution similar to the one in the previous section: y=x+b3ay=x+\frac{b}{3a}, so x=y−b3ax=y-\frac{b}{3a}

Now comes quite a bit of algebraic manipulation:

0=a(y−b3a)3+b(y−b3a)2+c(y−b3a)+d0=a\bigg(y-\frac{b}{3a}\bigg)^3+b\bigg(y-\frac{b}{3a}\bigg)^2+c\bigg(y-\frac{b}{3a}\bigg)+d 0=ay3−3a(b3a)y2+3a(b3a)2y−a(b3a)3+by2−2b(b3a)y+b(b3a)2+cy−c(b3a)+d0 = ay^3-3a\bigg(\frac{b}{3a}\bigg)y^2+3a\bigg(\frac{b}{3a}\bigg)^2y-a\bigg(\frac{b}{3a}\bigg)^3+by^2 - 2b\bigg(\frac{b}{3a}\bigg)y+b\bigg(\frac{b}{3a}\bigg)^2+cy-c\bigg(\frac{b}{3a}\bigg)+d 0=ay3−by2+b23ay−b327a2+by2−2b23ay+b39a2+cy−bc3a+d0 = ay^3-by^2+\frac{b^2}{3a}y-\frac{b^3}{27a^2}+by^2 - \frac{2b^2}{3a}y+\frac{b^3}{9a^2}+cy-\frac{bc}{3a}+d 0=ay3+(−by2+by2)+(b23a−2b23a+c)y+(−b327a2+b39a2−bc3a+d)0 = ay^3+(-by^2+by^2)+\bigg(\frac{b^2}{3a}-\frac{2b^2}{3a}+c\bigg)y+\bigg(-\frac{b^3}{27a^2}+\frac{b^3}{9a^2}-\frac{bc}{3a}+d\bigg) ay3+(c−2b23a)y+(d−bc3a+2b327a2)=0ay^3+\bigg(c-\frac{2b^2}{3a}\bigg)y+\bigg(d-\frac{bc}{3a}+\frac{2b^3}{27a^2}\bigg) = 0

Finally, we can divide by aa since a≠0a \ne 0:

y3+(ca−2b23a2)y+(da−bc3a2+2b327a3)=0y^3+\bigg(\frac{c}{a}-\frac{2b^2}{3a^2}\bigg)y+\bigg(\frac{d}{a}-\frac{bc}{3a^2}+\frac{2b^3}{27a^3}\bigg) = 0   ⟹  y3+(ca−2b23a2)y=−(da−bc3a2+2b327a3)\implies y^3+\bigg(\frac{c}{a}-\frac{2b^2}{3a^2}\bigg)y = -\bigg(\frac{d}{a}-\frac{bc}{3a^2}+\frac{2b^3}{27a^3}\bigg)

Now for simplicity's sake, since we aren't dealing with actual given numbers but with general real numbers, we can call ca−2b23a2\frac{c}{a}-\frac{2b^2}{3a^2} and −(da−bc3a2+2b327a3)-\big(\frac{d}{a}-\frac{bc}{3a^2}+\frac{2b^3}{27a^3}\big) by other variables, such as pp and qq, leaving us with the cubic y3+py=qy^3 + py = q.

Step 2: Solving the new cubic

Now, we will solve the cubic as follows: we will find ss and tt such that 3st=p3st=p and that s3−t3=qs^3-t^3 = q. How does this help? Well, as it turns out, s−ts-t is a solution of the new cubic:

y3+py=q  ⟹  (s−t)3+(3st)(s−t)=s3−t3,y^3 +py = q \implies (s-t)^3 +(3st)(s-t) = s^3-t^3,

which is always true. So how do we find ss and tt? Well, we can solve for ss in terms of tt: 3st=p  ⟹  s=p3t3st=p\implies s=\frac{p}{3t}. Now we can substitute that into s3−t3=qs^3-t^3 = q to give (p3t)3−t3=q.\Big(\frac{p}{3t}\Big)^3 - t^3 = q.

Multiplying by t3t^3 and shifting everything to the LHS gives

t6+qt3−p327=0.t^6 + qt^3 - \frac{p^3}{27}=0.

This is a quadratic equation in t3t^3, and can be solved by the above quadratic formula.

t3=−q±q2−4p3272=−q2±q24−p327.t^3=\frac{-q\pm \sqrt{q^2-\frac{4p^3}{27}}}{2} = -\frac{q}{2}\pm \sqrt{\frac{q^2}{4}-\frac{p^3}{27}}.

A bit of algebra shows that no matter which of the two solutions we take, s−ts-t will still be the same, so WLOG we can take t3t^3 to be the one with the positive root. Thus t3=−q2+q24−p327t^3 = -\frac{q}{2} + \sqrt{\frac{q^2}{4}-\frac{p^3}{27}} and s3=t3+q=q2+q24−p327s^3 = t^3 + q = \frac{q}{2} + \sqrt{\frac{q^2}{4}-\frac{p^3}{27}} and

The corresponding root to the original cubic can be found by undoing the transformation that eliminated the x2x^2 term, i.e. by subtracting b3a\frac{b}{3a} from this root, and synthetic division finds the last two roots.

Read · 1 min

Is it possible to solve the cubic using Vieta's formulas?

Say we have a cubic P(x)=ax3+bx2+cx+dP(x) = ax^3+bx^2+cx+d (with a≠0a\ne0), and we want to find its roots r,s,tr,s,t. By Vieta's formulas for cubics, we know r+s+t=−bars+st+tr=carst=−da.\begin{align*} r+s+t &= \frac{-b}{a} \\ rs+st+tr &= \frac{c}{a} \\ rst &= \frac{-d}{a}. \end{align*} For ease of notation, let's call B=−baB = \frac{-b}{a}, C=caC = \frac{c}{a}, and D=−daD = \frac{-d}{a}.

Challenge to the community: Solve the system of equations in r,s,tr,s,t, to give an alternative proof of Cardano's formula. As a warm-up, try deriving the quadratic formula using Vieta's formulas for quadratics.

Type a concept, like “slope” or “photosynthesis”.

↑ ↓ to choose · Enter to openSearch explanations and problems