# Solve command returns duplicate answers

Mathematica 11.0.1.

In the documentation for the Solve command:

When a single variable is specified and a particular root of an equation has multiplicity greater than one, Solve gives several copies of the corresponding solution.

So this is understandable:

In[8]:= Solve[(x - 2)^2 (x - 1) == 0, x]

Out[8]= {{x -> 1}, {x -> 2}, {x -> 2}}


But this makes me curious.

In[10]:= Solve[Cos[2 t - π/2] == -1 && 0 <= t <= 2 Pi, t]

Out[10]= {{t -> (3 π)/4}, {t -> (3 π)/4}, {t -> (7 π)/
4}, {t -> (7 π)/4}}


I'm not sure why this is happening. Any thoughts?

• As the first derivative of the function is zero at the root, it is effectively a double root. Commented Oct 21, 2016 at 5:28

I don't know the exact reason, but you can avoid it by using NSolve

NSolve[TrigToExp@Cos[2 t - Pi / 2] == -1 && 0 <= t <= 2 Pi, t]


{{t -> 2.35619}, {t -> 5.49779}}

With Solve if you use 0 <= t <= 2.0 Pi you will get the same result with an error message about inexact coefficient.

So my guess is when you use Solve with exact numbers, it probably convert the trigonometric function into a polynomial, where it sees a double root - just a guess, though.

• you could do Union@Solve as well Commented Oct 21, 2016 at 17:13

We can predict the multiplicity of the root based on the number of zero derivatives at the root. For example

Solve[x^10 == 0, x] // Length
(* 10 *)


Consider

expr = -126 + 210 Cos[x] - 120 Cos[2 x] + 45 Cos[3 x] - 10 Cos[4 x] +
Cos[5 x];
Series[expr, {x, 0, 10}] // Normal
(* -(x^10/2) *)


which has is zero up to 10th order. This has a 10 fold root

sols = Solve[expr == 0 && Abs[x] < 1/5, x];
Union[sols]
Length[sols]
(* {{x -> 0}} *)
(* 10 *)


Reduce avoids duplicated answers

Plot[x^10, {x, -1, 1}]


sol = Reduce[x^10 == 0, x]


x == 0

To get a Solve-like output:

List@ToRules@sol


{{x -> 0}}