These are the human proofs of Ferrari's method, at full length.
Correctness of Ferrari's method full
This proof shows: correctness, termination.
We work in exact complex arithmetic, where ⋅ returns some square root and CARDANO returns the three roots of a cubic with multiplicity (proved on the page Cardano's formula).
Lemma 1 (the shift). Let s=b/(4a), C=c/a, D=d/a, E=e/a, and p,q,r as in line L2. Then a1(ax4+bx3+cx2+dx+e)=y4+py2+qy+r for y=x+s.
Proof. Put x=y−s and 4s=b/a. Then (y−s)4=y4−4sy3+6s2y2−4s3y+s4, 4s(y−s)3=4sy3−12s2y2+12s3y−4s4, C(y−s)2=Cy2−2Csy+Cs2 and D(y−s)=Dy−Ds. Adding these and E, the y3 terms cancel, the y2 coefficient is C−6s2=p, the y coefficient is D−2Cs+8s3=q and the constant is E−Ds+Cs2−3s4=r. □
So x is a root of the quartic with multiplicity k if and only if y=x+s is a root of the depressed quartic Q(y)=y4+py2+qy+r with multiplicity k, and line L9 maps the roots back.
Lemma 2 (the splitting). Let m=0 satisfy R(m)=8m3+8pm2+(2p2−8r)m−q2=0, let σ2=2m, and let A=2p+m+2σq, B=2p+m−2σq. Then Q(y)=(y2−σy+A)(y2+σy+B).
Proof.σ=0 since m=0. Expanding,
(y2−σy+A)(y2+σy+B)=y4+(A+B−σ2)y2+σ(A−B)y+AB.
Here A+B−σ2=p+2m−2m=p and σ(A−B)=σ⋅q/σ=q. Also AB=(2p+m)2−4σ2q2=(2p+m)2−8mq2. This equals r if and only if 8m(m2+pm+4p2)−8mr−q2=0, which is R(m)=0. □
Lemma 3 (the zero case). The roots of R are all zero if and only if p=q=r=0.
Proof. The roots of R are all zero if and only if R(m)=8m3, that is 8p=0, 2p2−8r=0 and q2=0. □
Lemma 4 (QUAD). For any complex β,γ, lines L10 and L11 return the two roots, with multiplicity, of y2+βy+γ.
Proof. The roots are t±=−(β±w)/2 with w2=β2−4γ, and t+t−=(β2−w2)/4=γ. Line L10 takes t∈{t+,t−} of larger modulus. If t=0 then t+=t−=0, so the roots are 0,0, which L11 returns. Otherwise the other root is γ/t. □
Theorem. For a=0, FERRARI returns the four roots of ax4+bx3+cx2+dx+e, with multiplicity.
Proof. If line L5 returns, the chosen m of largest modulus is 0, so all roots of R are 0, and p=q=r=0 by Lemma 3. Then Q(y)=y4, and by Lemma 1 the quartic is a(x+s)4 with the root −s of multiplicity 4. Otherwise m=0 is a root of R, by the correctness of CARDANO. By Lemma 2, Q(y)=(y2−σy+A)(y2+σy+B), so the roots of Q with multiplicity are the roots of the two factors together, which line L8 computes by Lemma 4. Line L9 maps them to the roots of the quartic by Lemma 1. □
Termination. There is no loop. FERRARI runs lines L1 to L9 once, with one call of CARDANO (which has no loop either) and two calls of QUAD. So it ends after a fixed number of operations.
Why the root of largest modulus. Not needed for correctness, by Lemma 2 any nonzero root works. If the roots of Q are y1,…,y4, Lemma 2 shows σ=y1+y2 for the pair that the first factor holds, so the three roots of R are (y1+y2)2/2, (y1+y3)2/2 and (y1+y4)2/2 (recall y1+⋯+y4=0). Their product is q2/8. The largest of them keeps ∣σ∣ as large as possible, so the division by σ at L7 does not magnify the rounding errors in q and m. The pitfall on the page shows the error when a small root is taken. ■