# Solve giving solution when there is no solution

I got a strange result from Solve.

I have the following relations:

eq =
{1/2 (-2 - c[31, 33]) == 0,
-c[31, 32] == 0,
1/2 (1 + 1/2 c[31, 33] - c[31, 32] c[32, 31] - 1/2 c[31, 32] c[32, 33]) != 0,
2/(1 + 1/2 c[31, 33] - c[31, 32] c[32, 31] - 1/2 c[31, 32] c[32, 33]) != 0};


I evaluated

sol = Solve[And @@ eq, {c[31,32],c[31,33]}]


and got

{{c[31, 32] -> 0, c[31, 33] -> -2}}

The solution is wrong since the second to last relation is not fulfilled. The system has no solution.

Reduce does the job, but that's beside the point.

I am using Mathematica 12.0.0 Kernel for Linux x86 (64-bit)

Has someone encountered a similar behavior and/or recognizes whats going wrong?

• same result on 10.4.1 for Microsoft Windows (64-bit). – AccidentalFourierTransform Nov 8 at 18:26
• There are more equations than the two unknowns for which you are solving. Use the option MaxExtraConditions and Solve will indicate that there is no solution: sol = Solve[eq, {c[31, 32], c[31, 33]}, MaxExtraConditions -> All] – Bob Hanlon Nov 8 at 21:39
• Moreover, Solve[And @@ eq, {c[31, 32], c[31, 33]}, Method -> Reduce] performs the same result {{c[31,32]->0,c[31,33]->-2}} in version 12.0 on Windows 10 32 bit. – user64494 2 days ago
• @BobHanlon Is the described behavior without "MaxExtraConditions -> All" expected? – Armin yesterday
• @Amin - "expected" by whom? What I would expect is to always verify solutions using eq /. sol and when the that verification raises questions, to look at Solve's (or other function's) options to see if they might help. – Bob Hanlon yesterday

Clear["Global*"]

eq = {
1/2 (-2 - c[31, 33]) == 0,
-c[31, 32] == 0,
1/2 (1 + 1/2 c[31, 33] - c[31, 32] c[32, 31] - 1/2 c[31, 32] c[32, 33]) !=
0,
2/(1 + 1/2 c[31, 33] - c[31, 32] c[32, 31] - 1/2 c[31, 32] c[32, 33]) !=
0};

sol = Solve[And @@ eq, {c[31, 32], c[31, 33]}]

(* {{c[31, 32] -> 0, c[31, 33] -> -2}} *)


However, the sol does not fully satisfy the system.

eq /. sol

(* Power::infy: Infinite expression 1/0 encountered.

{{True, True, False, True}} *)


From the documentation for Solve | Options | MaxExtraConditions, "By default, Solve drops inequation conditions on continuous parameters". The way you posed the question, c[32, 31] and c[32, 33] are continuous parameters involved in inequations. After dropping those inequations, the returned solution satisfies the remaining two equations.

Use the option MaxExtraConditions and Solve will indicate that there is no solution:

sol = Solve[eq, {c[31, 32], c[31, 33]}, MaxExtraConditions -> All]

(* {} *)
`