Toolkit 30

Vieta's Formula

For a quadratic: \text{For a quadratic: }
ax2+bx+c=0(roots: r1,r2)ax^2+bx+c=0\quad(\text{roots: }r_1,r_2)
r1+r2=ba,r1r2=car_1+r_2=-\frac{b}{a},\qquad r_1r_2=\frac{c}{a}
For a cubic: ax3+bx2+cx+d=0(roots: r1,r2,r3)\text{For a cubic: }ax^3+bx^2+cx+d=0\quad(\text{roots: }r_1,r_2,r_3)
r1+r2+r3=ba,r1r2+r1r3+r2r3=ca,r1r2r3=dar_1+r_2+r_3=-\frac{b}{a},\quad r_1r_2+r_1r_3+r_2r_3=\frac{c}{a},\quad r_1r_2r_3=-\frac{d}{a}
For a general polynomial: anxn+an1xn1++a1x+a0=0(roots: r1,,rn)\text{For a general polynomial: }a_nx^n+a_{n-1}x^{n-1}+\cdots+a_1x+a_0=0\quad(\text{roots: }r_1,\dots,r_n)
r1+r2++rn=an1anr_1+r_2+\cdots+r_n=-\frac{a_{n-1}}{a_n}
1i<jnrirj=an2an\sum_{1\le i<j\le n}r_ir_j=\frac{a_{n-2}}{a_n}
1i<j<knrirjrk=an3an\sum_{1\le i<j<k\le n}r_ir_jr_k=-\frac{a_{n-3}}{a_n}
r1r2rn1=(1)n1a1anr_1r_2\cdots r_{n-1}=(-1)^{n-1}\frac{a_1}{a_n}
r1r2rn=(1)na0anr_1r_2\cdots r_n=(-1)^n\frac{a_0}{a_n}

Proof

For a quadratic polynomial with roots r1r_1 and r2r_2,

ax2+bx+c=a(xr1)(xr2).ax^2+bx+c = a(x-r_1)(x-r_2).

Expanding the right-hand side,

a(xr1)(xr2)=a(x2(r1+r2)x+r1r2)=ax2a(r1+r2)x+ar1r2.\begin{aligned} a(x-r_1)(x-r_2) &= a\left(x^2-(r_1+r_2)x+r_1r_2\right) \\ &= ax^2 - a(r_1+r_2)x + ar_1r_2. \end{aligned}

Comparing corresponding coefficients gives

b=a(r1+r2)b = -a(r_1+r_2)

and

c=ar1r2.c = ar_1r_2.

Therefore,

r1+r2=ba,r1r2=ca.r_1+r_2 = -\frac{b}{a}, \qquad r_1r_2 = \frac{c}{a}.

For a cubic polynomial with roots r1,r2,r3r_1, r_2, r_3,

ax3+bx2+cx+d=a(xr1)(xr2)(xr3).ax^3+bx^2+cx+d = a(x-r_1)(x-r_2)(x-r_3).

Expanding,

a(xr1)(xr2)(xr3)=a(x3(r1+r2+r3)x2+(r1r2+r1r3+r2r3)xr1r2r3).\begin{aligned} a(x-r_1)(x-r_2)(x-r_3) &= a\Bigl(x^3 - (r_1+r_2+r_3)x^2 \\ &\qquad + (r_1r_2+r_1r_3+r_2r_3)x - r_1r_2r_3\Bigr). \end{aligned}

Comparing coefficients gives

r1+r2+r3=ba,r_1+r_2+r_3 = -\frac{b}{a},
r1r2+r1r3+r2r3=ca,r_1r_2+r_1r_3+r_2r_3 = \frac{c}{a},

and

r1r2r3=da.r_1r_2r_3 = -\frac{d}{a}.

More generally, suppose

anxn+an1xn1++a1x+a0=an(xr1)(xr2)(xrn).a_nx^n+a_{n-1}x^{n-1}+\cdots+a_1x+a_0 = a_n(x-r_1)(x-r_2)\cdots(x-r_n).

We expand the right-hand side and compare corresponding coefficients term by term.

Coefficient of xnx^n: choosing xx from every factor gives

an=an.a_n = a_n.

Coefficient of xn1x^{n-1}: pick the constant term ri-r_i from exactly one factor and xx from all others. Summing over the choice of factor gives

an1=an(r1+r2++rn),a_{n-1} = -a_n(r_1+r_2+\cdots+r_n),

so

r1+r2++rn=an1an.r_1+r_2+\cdots+r_n = -\frac{a_{n-1}}{a_n}.

Coefficient of xn2x^{n-2}: pick a constant term ri-r_i from exactly two factors and xx from all remaining factors. Summing over the pairs {i,j}\{i,j\} gives

an2=an(r1r2+r1r3++rn1rn),a_{n-2} = a_n\bigl(r_1r_2+r_1r_3+\cdots+r_{n-1}r_n\bigr),

so

r1r2+r1r3++rn1rn=an2an.r_1r_2+r_1r_3+\cdots+r_{n-1}r_n = \frac{a_{n-2}}{a_n}.

Coefficient of xn3x^{n-3}: pick a constant term ri-r_i from exactly three factors and xx from all remaining factors. Summing over the triples gives

an3=an(r1r2r3+r1r2r4++rn2rn1rn),a_{n-3} = -a_n\bigl(r_1r_2r_3+r_1r_2r_4+\cdots+r_{n-2}r_{n-1}r_n\bigr),

so

r1r2r3+r1r2r4++rn2rn1rn=an3an.r_1r_2r_3+r_1r_2r_4+\cdots+r_{n-2}r_{n-1}r_n = -\frac{a_{n-3}}{a_n}.
\vdots

Continuing in the same way, the coefficient of xx (the case j=n1j=n-1) comes from picking the constant term from all but one factor:

r1r2rn1++r2r3rn=(1)n1a1an,r_1r_2\cdots r_{n-1}+\cdots+r_2r_3\cdots r_n = (-1)^{n-1}\frac{a_1}{a_n},

and the constant term comes from picking the constant term from every factor:

r1r2rn=(1)na0an.r_1r_2\cdots r_n = (-1)^n\frac{a_0}{a_n}. \quad\square