<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] Note that
$$f(x)=(x-a)(x-b)(x-c)$$
$$f'(x)=(x-a)(x-b)+(x-a)(x-c)+(x-b)(x-c)$$
$$\boxed{f'(a)=(a-b)(a-c)}$$
and its cyclic variants.
We have that
$$\prod_\text{cyc}f'(a)=\prod_\text{cyc} (a-b)(a-c)$$
$$\prod_\text{cyc} f'(a)=-(a-b)^2(b-c)^2(a-c)^2$$
Hence, our expression is equivalent to $-f'(a)f'(b)f'(x)$
Since $f'(x)=3x^2+p$, this is equivalent to
$$-(3a^2+p)(3b^2+p)(3c^2+p)$$
$$\boxed{-(27a^2b^2c^2+9p(a^2b^2+b^2c^2+a^2c^2)+3p^2(a^2+b^2+c^2)+p^3)}$$
Using viete's, we get the following identites
1.
$$a^2b^2c^2$$
$$=(abc)^2$$
$$=(-q)^2$$
$$=q^2$$
2.
$$a^2b^2+b^2c^2+a^2c^2$$
$$=(ab+bc+ac)^2-abc(a+b+c)$$
$$=p^2-0q$$
$$=p^2$$
3.
$$a^2+b^2+c^2$$
$$=(a+b+c)^2-2(ab+bc+ac)$$
$$=0^2-2p$$
$$=-2p$$
Substituting these 3 identities into our expression gives
$$-(27q^2+9p^3-6p^3+p^3)$$
$$\boxed{-4p^3-27q^2}$$
</s>