Cardano's formula returns the three roots of the cubic with multiplicity full
This proof shows: correctness.
We work in exact complex arithmetic. Let a=0 and f(x)=ax3+bx2+cx+d.
Lemma 1 (the shift). With s=b/(3a), C=c/a, D=d/a, p=C−3s2 and q=D−sC+2s3, we have f(t−s)=a(t3+pt+q) for all t.
Proof. f(x)/a=x3+3sx2+Cx+D, since b/a=3s. Put x=t−s:
(t−s)3+3s(t−s)2+C(t−s)+D=t3−3st2+3s2t−s3+3st2−6s2t+3s3+Ct−Cs+D. The t2 terms cancel, the t terms give (C−3s2)t=pt, and the constants give 2s3−sC+D=q. □
So x is a root of f of multiplicity m if and only if t=x+s is a root of g(t)=t3+pt+q of multiplicity m, and it suffices to show that t0,t1,t2 are the roots of g with multiplicity, that is, g(t)=(t−t0)(t−t1)(t−t2).
Lemma 2 (the quadratic). The numbers −q/2±r with r2=q2/4+p3/27 are the two roots of h(z)=z2+qz−p3/27. So their sum is −q and their product is −p3/27.
Proof. (z+q/2)2−r2=z2+qz+q2/4−q2/4−p3/27=h(z), and (z+q/2)2−r2=(z+q/2−r)(z+q/2+r). Vieta's formulas for a monic quadratic give the sum and product. □
Case w=0. Line L4 picks the root of h of larger modulus. If it is 0, both roots are 0, so their sum −q=0 and their product −p3/27=0, so p=q=0. Then g(t)=t3 has the triple root 0, and line L5 returns x=−s three times, which is correct by Lemma 1.
Case w=0. Let u be a cube root of w (line L6), so u=0. For k=0,1,2 put uk=ωku and vk=−p/(3uk), so that line L9 gives tk=uk+vk. Write v=v0=−p/(3u). Since ω3=1, vk=ω−kv=ω2kv, and ukvk=uv=−p/3.
Step 1: u3+v3=−q. We have u3=w, one root of h, and v3=−p3/(27u3)=(−p3/27)/w. By Lemma 2, the product of the two roots of h is −p3/27, so v3 is the other root of h (this also holds if the two roots are equal). Their sum is −q.
Step 2: the elementary symmetric functions of t0,t1,t2. Use 1+ω+ω2=0.
- t0+t1+t2=u(1+ω+ω2)+v(1+ω2+ω4)=0, since ω4=ω.
- t02+t12+t22=∑k(ω2ku2+2uv+ω4kv2)=u2⋅0+6uv+v2⋅0=6uv. Hence e2=∑j<ktjtk=21((∑tk)2−∑tk2)=−3uv=p.
- t0t1t2=(u+v)(ωu+ω2v)(ω2u+ωv). The product of the last two factors is ω3u2+ω2uv+ω4uv+ω3v2=u2−uv+v2, using ω2+ω4=ω2+ω=−1. So t0t1t2=(u+v)(u2−uv+v2)=u3+v3=−q.
Step 3. By Step 2, (t−t0)(t−t1)(t−t2)=t3−(∑tk)t2+e2t−t0t1t2=t3+pt+q=g(t). So t0,t1,t2 are the roots of g with multiplicity, and by Lemma 1, xk=tk−s are the roots of f with multiplicity. ■
Remark (why line L9 and not a second cube root). The proof uses ukvk=−p/3. Two independent cube roots u′ of −q/2+r and v′ of −q/2−r satisfy only (u′v′)3=−p3/27, so u′v′=ωj(−p/3) for some j∈{0,1,2}. If j=0 and p=0, then u′+v′ is in general not a root.
Remark (the irreducible case). For real p,q with q2/4+p3/27<0, r is imaginary and w and wˉ are the two roots of h, with ∣w∣2=−p3/27. Then ∣u∣2=−p/3, so v=−p/(3u)=uˉ and tk=2Re(ωku) is real for each k. The three roots are real, and the formula reaches them through non-real u.