Using Vieta's theorem for cubic equations to derive the cubic discriminant
Solution 1:
The tedious way is to expand $(x_1 - x_2)^2 (x_2 - x_3)^2 (x_1 - x_3)^2$ out completely and then write it in terms of $x_1 + x_2 + x_3$ and so forth. You are guaranteed that this is possible by the fundamental theorem of symmetric polynomials, the proof of which even gives an algorithm for doing this, but it's a pain to do by hand (although it's not a bad exercise in algebraic manipulation).
A less tedious way is to argue as follows. We will first work under the assumption that $p = 0$. Now, $q, r$ are polynomials of degrees $2, 3$, and the discriminant is a polynomial of degree $6$, so the discriminant must be a linear combination of the two monomials $q^3, r^2$. Thus we can write $$\Delta = a q^3 + b r^2$$
for two constants $a, b$, where $\Delta$ is the discriminant. Setting $q = -1, r = 0$ we get the polynomial $x^3 - x = 0$ with roots $0, 1, -1$. We compute that the discriminant is equal to $4$, from which it follows that $a = -4$.
Setting $q = 0, r = -1$ we get the polynomial $x^3 - 1 = 0$ with roots $1, \omega, \omega^2$ where $\omega$ is a primitive third root of unity. Using the identity $$(\omega - 1)^2 = \omega^2 - 2 \omega + 1 = - 3 \omega$$
we compute that the discriminant is equal to $-27$, from which it follows that $b = -27$. Thus $$\Delta = -4 q^3 - 27 r^2.$$
To get from here to an arbitrary choice of $x_1, x_2, x_3$, apply the above formula to the polynomial with roots $x_1 - \frac{p}{3}, x_2 - \frac{p}{3}, x_3 - \frac{p}{3}$ and note that subtracting the same constant from each of the three roots doesn't change the discriminant.