3

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?

J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574
matrix42
  • 6,996
  • 2
  • 26
  • 62
  • 3
    Use e.g. ComplexExpand@(x /. Solve[x^3 - 3 x + 1 == 0, x]). This question concerns the same issue as http://mathematica.stackexchange.com/questions/17269/how-to-get-exact-roots-of-this-polynomial – Artes Jan 25 '13 at 15:31
  • 1
    Another related question : http://mathematica.stackexchange.com/questions/14726/eigensystem-eigenvalue-doesnt-output-nonreal-eigenvalues – Artes Jan 25 '13 at 15:43
  • 1
    Thanks. But I want Cos[π/9] + Sqrt[3] Sin[π/9] can be simplify to 2 Cos[(2 π)/9] – matrix42 Jan 25 '13 at 15:58

2 Answers2

3
(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]}}*)
chyanog
  • 15,542
  • 3
  • 40
  • 78
2

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]}} *)
Michael E2
  • 235,386
  • 17
  • 334
  • 747