<s>[INST] calculate cubic equation discriminant Let $p(x)=x^3+px+q$ a real polynomial.
Let $a,b,c$ the complex root of $p(x)$.
What is the easiest way to calculate $\Delta=(a-b)^2(b-c)^2(a-c)^2$ in function of $p,q$?
The result is $\Delta=-4p^3-27q^2$
Ps. $f=(x-a)(x-b)(x-c)$ and so   $a+b+c=0$; $ab+bc+ac=p$ and $abc=-q$; how to proceed?
 [/INST] Let me offer you a different method which can be useful when calculating other symmetric functions of the roots.
$\Delta$ is symmetric in the roots, of total degree $6$.
In general then, where the cubic is $X^3-e_1X^2+e_2 X-e_3$, $\Delta$ must be a sum of monomials $e_1^{k_1}e_2^{k_2}e_3^{k_3}$ with $k_1+2k_2+3k_3=6$. When $e_1=0$ we must have $\Delta= A e_2^3 +B e_3^2$.
We can find $A,B$ by evaluating $\Delta$ for the two easy cubics $X^3-X$ and $X^3-1$ whose discriminants are $4$ and $-27$.
</s>