# Sum of roots of a trigonometric equation

The equation $$\sin x + \sqrt{3} \cos x = 1,$$ where $x \in [-2\pi, 2\pi]$ has four roots $-\dfrac{3\pi}{2}$, $\dfrac{\pi}{2}$, $\dfrac{\pi}{2}$ and $\dfrac{11\pi}{6}$. Sum of roots of the given equation is $\dfrac{2\pi}{3}$. How do I tell Mathematica to do that?

I tried

Solve[{Sin[x] + Sqrt[3]*Cos[x] == 1, -2*π <= x <= 2*π}, {x}]


edit from comment

I repaired the given equation to

Solve[{Sin[x] + Sqrt[3]Cos[x] == 1, -2[Pi] <= x <= 2*[Pi]}, {x}]


and used

Simplify@Total[ x /. Solve[{Sin[x] + Sqrt[3] Cos[x] == 2, -2 Pi <= x <= 2 Pi}, {x}]],


and I got the answer

-4 [Pi] + 8 ArcTan[1/(2 + Sqrt[3])].


How do I get the answer -((5 [Pi])/3)?

## 2 Answers

One way :

Total[Reduce[Sin[x] + Sqrt[3] Cos[x] == 1 && -2 \[Pi] <= x <= 2 \[Pi], x] /. Or -> List /. x == rhs_ -> rhs] // Simplify

(* (2 \[Pi])/3 *)

• Thank Artes very much. Commented Sep 28, 2012 at 8:18

To answer your added question: try FullSimplify[]:

FullSimplify @ Total[ DeleteDuplicates[ x
/. Solve[{Sin[x] + Sqrt[3] Cos[x] == 2, -2 Pi <= x <= 2 Pi}, {x}]]]


returns

$\dfrac{-5 \pi}{3}$

Like Artes says you need DeleteDuplicates[] because of the multiple roots.

From the documentation:

FullSimplify[expr]
tries a wide range of transformations on expr involving elementary and special functions, and returns the simplest form it finds.