Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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*\[Pi] <= x <= 2*\[Pi]}, {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)?

share|improve this question
up vote 3 down vote accepted

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 *)
share|improve this answer
Thank Artes very much. – minthao_2011 Sep 28 '12 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}]]]


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

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

From the documentation:

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

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.