# Result of Reduce contains duplicate terms

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?

-
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.

-
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