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

On my system, the result of this:

f[x_] := 2 Sin[x] + Sin[x]^2;
Reduce[f'[x] == 0, x]

contains the following expression twice:

x == -(Pi/2) + 2*Pi*C[1]

This is the entire result:

Element[C[1], Integers] && 
     (x == -(Pi/2) + 2*Pi*C[1] || x == Pi/2 + 2*Pi*C[1] || 
      x == -(Pi/2) + 2*Pi*C[1] || x == (3*Pi)/2 + 2*Pi*C[1])

Is there a reason the expression appears twice? Is this a bug?

share|improve this question
My guess is that this is because x == -(\[Pi]/2) + 2 \[Pi] C[1] is a double root of f'[x]. – Heike Feb 16 '12 at 10:30
Though written in an unusual way, I'd like to note that the result is correct. It'd be simpler to write is as $(k+\frac{1}{2})\pi, k \in \mathbb{Z}$ – Szabolcs Feb 16 '12 at 10:32
@Heike seems to have got it (try plotting your derivative, and note the behavior at crossings). In general for trigonometric functions, it vastly helps to confine your attention to a single period: Reduce[f'[x] == 0 && 0 <= x <= 2 Pi, x]. – J. M. Feb 16 '12 at 10:34

I'll try to sum up here the answers given so far in comments:

  • if you work in a single period, you get the expected results:

    In:=  Reduce[f'[x] == 0 && 0 <= x <= 2 Pi, x]
    Out=  x == \[Pi]/2 || x == (3 \[Pi])/2
  • if you work on the whole real domain, you can get the expression to be reduced by using Simplify:

    In:=  Simplify[Reduce[f'[x] == 0, x]]
    Out=  C[1] \[Element] Integers && (\[Pi] + 2 x == 4 \[Pi] C[1] || \[Pi] + 4 \[Pi] C[1] == 2 x || 2 x == \[Pi] (3 + 4 C[1]))
  • the reason why you get one of the elements twice in the first place is that it's a double root.

share|improve this answer
For more complex expressions, often applying LogicalExpand to the results from Reduce before using Simplify will yield better results than just Simplify alone. – rcollyer Mar 28 '12 at 16:43

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.