Algorithm Search⌘K

Proofs: Ferrari's method

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 ⋅\sqrt{\cdot} 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)s = b/(4a), C=c/aC = c/a, D=d/aD = d/a, E=e/aE = e/a, and p,q,rp, q, r as in line L2. Then 1a(ax4+bx3+cx2+dx+e)=y4+py2+qy+r\frac{1}{a}(ax^4 + bx^3 + cx^2 + dx + e) = y^4 + py^2 + qy + r for y=x+sy = x + s.

Proof. Put x=y−sx = y - s and 4s=b/a4s = b/a. Then (y−s)4=y4−4sy3+6s2y2−4s3y+s4(y - s)^4 = y^4 - 4sy^3 + 6s^2y^2 - 4s^3y + s^4, 4s(y−s)3=4sy3−12s2y2+12s3y−4s44s(y - s)^3 = 4sy^3 - 12s^2y^2 + 12s^3y - 4s^4, C(y−s)2=Cy2−2Csy+Cs2C(y - s)^2 = Cy^2 - 2Csy + Cs^2 and D(y−s)=Dy−DsD(y - s) = Dy - Ds. Adding these and EE, the y3y^3 terms cancel, the y2y^2 coefficient is C−6s2=pC - 6s^2 = p, the yy coefficient is D−2Cs+8s3=qD - 2Cs + 8s^3 = q and the constant is E−Ds+Cs2−3s4=rE - Ds + Cs^2 - 3s^4 = r. □\square

So xx is a root of the quartic with multiplicity kk if and only if y=x+sy = x + s is a root of the depressed quartic Q(y)=y4+py2+qy+rQ(y) = y^4 + py^2 + qy + r with multiplicity kk, and line L9 maps the roots back.

Lemma 2 (the splitting). Let m≠0m \ne 0 satisfy R(m)=8m3+8pm2+(2p2−8r)m−q2=0R(m) = 8m^3 + 8pm^2 + (2p^2 - 8r)m - q^2 = 0, let σ2=2m\sigma^2 = 2m, and let A=p2+m+q2σA = \frac{p}{2} + m + \frac{q}{2\sigma}, B=p2+m−q2σB = \frac{p}{2} + m - \frac{q}{2\sigma}. Then Q(y)=(y2−σy+A)(y2+σy+B)Q(y) = (y^2 - \sigma y + A)(y^2 + \sigma y + B).

Proof. σ≠0\sigma \ne 0 since m≠0m \ne 0. Expanding,

(y2−σy+A)(y2+σy+B)=y4+(A+B−σ2)y2+σ(A−B)y+AB.(y^2 - \sigma y + A)(y^2 + \sigma y + B) = y^4 + (A + B - \sigma^2)y^2 + \sigma(A - B)y + AB.

Here A+B−σ2=p+2m−2m=pA + B - \sigma^2 = p + 2m - 2m = p and σ(A−B)=σ⋅q/σ=q\sigma(A - B) = \sigma \cdot q/\sigma = q. Also AB=(p2+m)2−q24σ2=(p2+m)2−q28mAB = (\frac{p}{2} + m)^2 - \frac{q^2}{4\sigma^2} = (\frac{p}{2} + m)^2 - \frac{q^2}{8m}. This equals rr if and only if 8m(m2+pm+p24)−8mr−q2=08m(m^2 + pm + \frac{p^2}{4}) - 8mr - q^2 = 0, which is R(m)=0R(m) = 0. □\square

Lemma 3 (the zero case). The roots of RR are all zero if and only if p=q=r=0p = q = r = 0.

Proof. The roots of RR are all zero if and only if R(m)=8m3R(m) = 8m^3, that is 8p=08p = 0, 2p2−8r=02p^2 - 8r = 0 and q2=0q^2 = 0. □\square

Lemma 4 (QUAD). For any complex β,γ\beta, \gamma, lines L10 and L11 return the two roots, with multiplicity, of y2+βy+γy^2 + \beta y + \gamma.

Proof. The roots are t±=−(β±w)/2t_\pm = -(\beta \pm w)/2 with w2=β2−4γw^2 = \beta^2 - 4\gamma, and t+t−=(β2−w2)/4=γt_+ t_- = (\beta^2 - w^2)/4 = \gamma. Line L10 takes t∈{t+,t−}t \in \{t_+, t_-\} of larger modulus. If t=0t = 0 then t+=t−=0t_+ = t_- = 0, so the roots are 0,00, 0, which L11 returns. Otherwise the other root is γ/t\gamma/t. □\square

Theorem. For a≠0a \ne 0, FERRARI returns the four roots of ax4+bx3+cx2+dx+eax^4 + bx^3 + cx^2 + dx + e, with multiplicity.

Proof. If line L5 returns, the chosen mm of largest modulus is 00, so all roots of RR are 00, and p=q=r=0p = q = r = 0 by Lemma 3. Then Q(y)=y4Q(y) = y^4, and by Lemma 1 the quartic is a(x+s)4a(x + s)^4 with the root −s-s of multiplicity 4. Otherwise m≠0m \ne 0 is a root of RR, by the correctness of CARDANO. By Lemma 2, Q(y)=(y2−σy+A)(y2+σy+B)Q(y) = (y^2 - \sigma y + A)(y^2 + \sigma y + B), so the roots of QQ 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. □\square

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 QQ are y1,…,y4y_1, \ldots, y_4, Lemma 2 shows σ=y1+y2\sigma = y_1 + y_2 for the pair that the first factor holds, so the three roots of RR are (y1+y2)2/2(y_1 + y_2)^2/2, (y1+y3)2/2(y_1 + y_3)^2/2 and (y1+y4)2/2(y_1 + y_4)^2/2 (recall y1+⋯+y4=0y_1 + \cdots + y_4 = 0). Their product is q2/8q^2/8. The largest of them keeps ∣σ∣|\sigma| as large as possible, so the division by σ\sigma at L7 does not magnify the rounding errors in qq and mm. The pitfall on the page shows the error when a small root is taken. ■\blacksquare

Back to Ferrari's method