# Viet Theorem

## Related calculator: Quadratic Equation Calculator

**Viet Theorem.** If quadratic equation `ax^2+bx+c=0` (reduced form is `x^2+b/a+c/a=0`) has roots `p` and `q`, then `color(green)(p+q=-b/a)`, `color(magenta)(pq=c/a)`, i.e. sum of the roots equals second coefficient, taken with opposite sign, and product of roots equals constant.

Indeed, let's start from equation `(x-p)(x-q)=0`. Note, that `p` and `q` are some numbers.

Product equals 0, only when at least one factor equals 0.

In other words, either `x-p=0` and `x-q=0`.

Thus, equation `(x-p)(x-q)=0` has two roots: `p` and `q`.

Next, apply FOIL to the left hand side:

`(x-p)(x-q)=x^2-px-qx+pq=x^2-(p+q)x+pq`.

We've got equivalent equation `x^2-(p+q)x+px=0`.

Original equation will have roots `p` and `q`, when coefficients of above equation equal coefficients of the original equation.

In other words, `p` and `q` are roots of the equation `x^2+b/ax+c/a=0`, when `-(p+q)=b/a` and `pq=c/a`.

From the last two equalities follows Viet Theorem.

**Example 1**. Without solving equation `ax^2+bx+c=0`, find `p^2+q^2`, in terms of `a`, `b` and `c`, where `p` and `q` are unknown roots of the equation.

By the Viet Theorem: `p+q=-b/a` and `pq=c/a`.

We need to complete the square: `p^2+q^2=p^2+q^2color(red)(+2pq-2pq)=(p+q)^2-2pq=(-b/a)^2-2c/a=b^2/a^2-(2ac)/a^2=(b^2-2ac)/a^2`.

**Answer**: `(b^2-2ac)/(a^2)`.

**Inverse Viet Theorem.** If numbers `p` and `q` are such, that `p+q=-b/a` and `pq=c/a`, then `p` and `q` are roots of the equation `ax^2+bx+c=0`.

**Example 2.** Solve the equation `x^2+3x-28=0`.

Let's try to find such two numbers `p` and `q` that `p+q=-3` and `pq=-28`.

It is not hard to see, that such numbers are `-7` and `4`. Thus, by the Inverse Viet Theorem, they are the roots of the given equation.

**Answer**: `-7` and `4`.