Vieta's solution of a cubic by trisecting an angle

Select the coefficients p and q in x^3 -px - q = 0

p = 15; q = 4;

To have real roots, we need to check that

q^2/4 - p^3/27 <= 0

a = Sqrt[p/3];
b = 3 * q / p;
angle = ArcCos[b/(2a)]

Now trisect the angle

theta = angle/3

And we have a solution

x1 = 2*a * Cos[theta]//N

Check that it satisfies the original equation

x1^3 - p x1 - q

For another solution add 2*Pi to angle, 2*Pi/3 to theta

x2 = 2*a * Cos[theta+2*Pi/3]//N

x2^3 - p x2 - q

For the third solution add 4*Pi to angle, 4*Pi/3 to theta

x3 = 2*a * Cos[theta+4*Pi/3]//N

x3^3 - p x3 - q

Now we have the three factors of the original cubic

Clear[x]

(x - x1)(x - x2)(x - x3)//Expand