# Cubic Equations

An cubic equation is an equation which can be represented in the form $ax^3+bx^2+cx+d=0$, where $a,b,c,d$ can be any number (may be complex if given so) where $a \neq 0$.

An cubic equation has $3$ roots (solutions), may be equal or not equal.

**Relation between coefficients and roots:**

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

Root expression | Equals to |

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

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

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

Given that, $p,q$ and $r$ are its roots, then $(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:

$(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 + [-(p+q+r)]x^2 + (pq+qr+pr)x + (-pqr) = 0$

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

- $p+q+r = -\frac{b}{a}$
- $pq+qr+pr = \frac{c}{a}$
- $pqr = -\frac{d}{a}$

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

Representing 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)$ (This is an algebraic identity and 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 = \boxed{3}$

## Practice Problems