# Cubic Equations

A cubic equation is an equation which can be represented in the form $ax^3+bx^2+cx+d=0$, where $a,b,c,d$ are complex numbers and $a$ is non-zero. By the fundamental theorem of algebra, cubic equation always has $3$ roots, some of which might be equal.

**Relation between coefficients and roots:**

For a cubic equation $ax^3+bx^2+cx+d=0$, let $p,q,$ and $r$ be its roots, then the following holds:

Root expression | Equals to |

$p+q+r$ | $-\frac{b}{a}$ |

$pq+qr+rp$ | $\ \ \ \frac{c}{a}$ |

$pqr$ | $-\frac{d}{a}$ |

This is a special case of Vieta's formulas.

Given that, $p,q,$ and $r$ are its roots, $(x-p)(x-q)(x-r)=0$ is the required cubic equation. Since it can be represented in the form $ax^3+bx^2+cx+d=0 \implies x^3 + \frac{b}{a} x^2 + \frac{c}{a} x + \frac{d}{a} = 0$, we have the following approach:

$\begin{aligned} (x-p)(x-q)(x-r)&=0\\ (x-p)(x^2 - qx - rx + qr)&=0\\ x^3 - qx^2 - rx^2 + qrx - px^2 + pqx + prx - pqr&=0\\ x^3 +\big[-(p+q+r)\big]x^2 + (pq+qr+pr)x + (-pqr) &= 0. \end{aligned}$

Now comparing this with $x^3 + \left(\frac{b}{a}\right) x^2 + \left(\frac{c}{a}\right) x + \left(\frac{d}{a}\right) = 0$, we have

$\begin{aligned} p+q+r &= -\frac{b}{a}\\ pq+qr+pr &= \frac{c}{a}\\ pqr &= -\frac{d}{a}.\ _\square \end{aligned}$

Find the sum of the squares of the roots of the cubic equation $x^3 + 3x^2 + 3x = 3$.

We can represent it in the form $x^3 + 3x^2 + 3x - 3 = 0.$

Recall that $p^2 + q^2 + r^2 = (p+q+r)^2 - 2(pq+qr+pr),$ which is an algebraic identity and is not related solely to cubic equations.

From the relations between the coefficients and its roots, we have $p+q+r = -\frac{b}{a} = -3$ and $pq+qr+pr = \frac{c}{a} = 3$. Plugging it in the relation, we have

$p^2 + q^2 + r^2 = (p+q+r)^2 - 2(pq+qr+pr) = (-3)^2 - 2(3) = 9-6 = 3.\ _\square$

## Practice Problems