# How do I get the solutions of a cubic equation in trigonometric form?

I know $x^3-3 x+1=0$ has three roots that can be expressed in trigonometric form: $\{2\sin(10^\circ),\,-2\cos(20^\circ),\,2\cos(40^\circ)\}$.

How can I get this result with Mathematica?

-
Use e.g. ComplexExpand@(x /. Solve[x^3 - 3 x + 1 == 0, x]). This question concerns the same issue as mathematica.stackexchange.com/questions/17269/… – Artes Jan 25 '13 at 15:31
Another related question : mathematica.stackexchange.com/questions/14726/… – Artes Jan 25 '13 at 15:43
Thanks. But I want Cos[π/9] + Sqrt[3] Sin[π/9] can be simplify to 2 Cos[(2 π)/9] – mathe Jan 25 '13 at 15:58

## 2 Answers

You can apply an identity directly:

ComplexExpand@
Solve[x^3 - 3 x + 1 == 0, x] /. (A_: 1) Cos[t_] + (B_: 1) Sin[t_] :>
Sqrt[A^2 + B^2] Cos[t - ArcTan[A, B]]

(* {{x -> 2 Cos[(2 π)/9]}, {x -> 2 Sin[π/18]}, {x -> -2 Cos[π/9]}} *)

-
(ComplexExpand@Solve[x^3 - 3 x + 1 == 0, x] /. Pi/9 -> t // TrigFactor) /. t -> Pi/9

(*{{x -> 2 Cos[(2 π)/9]}, {x -> 2 Sin[π/18]}, {x -> -2 Cos[π/9]}}*)

-