# Simplifying expressions with Abs

I have a long expression which seems really complicated due to some Abs[] terms that should be simplified. However, even with the right assumptions, the expression is not simplified.

For example

Assuming[-1 <= a <= 1 && 0 <= b <= π/4 && L ∈ Integers && 1 - (-1)^L Sqrt[1 - a^2] Cos[2 b] >= 0, Abs[1 - (-1)^L Sqrt[1 - a^2] Cos[2 b]] == 1 - (-1)^L Sqrt[1 - a^2] Cos[2 b] // FullSimplify]


should return True, but instead it returns (-1)^L Sqrt[1 - a^2] Cos[2 b] <= 1. On the contrary

Assuming[-1 <= a <= 1 && 0 <= b <= π/4 && L ∈ Integers && 1 - E^(I π L) Sqrt[1 - a^2] Cos[2 b] >= 0, Abs[1 - E^(I π L) Sqrt[1 - a^2] Cos[2 b]] == 1 - E^(I π L) Sqrt[1 - a^2] Cos[2 b] // FullSimplify]


returns True.

Why is that?

Note that the trick to replace (-1)^L with E^(I π L) do not always works, as in the case of

Assuming[-1 <= a <= 1 && 0 <= b <= π/4 && 0 <= Q <= 1 && L ∈ Integers && 1 - E^(I π L) Sqrt[1 - a^2] Cos[2 b] >= 0 && 1 - 2 Q + E^(I π L) Sqrt[1 - a^2] Cos[2 b] > 0, Sqrt[Abs[(1 - E^(I π L)  Sqrt[1 - a^2] Cos[2 b])/(1 - 2 Q + E^(I π L)  Sqrt[1 - a^2] Cos[2 b])]] == Sqrt[(1 - E^(I π L)  Sqrt[1 - a^2] Cos[2 b])/(1 - 2 Q + E^(I π L) Sqrt[1 - a^2] Cos[2 b])] // FullSimplify]

• All three return True in Version 9.0.1.0 (Windows 8 x64).
– kglr
Commented Mar 3, 2015 at 4:57
• I am using version 10.0 (Windows 7 Home Premium x64)... are you aware of any differences or issues? Commented Mar 3, 2015 at 5:11
• Nicola, search this site for Version 10 returns quite a few differences/issues:) See also: Version 10 Simplify, Version 10 Abs and Version 10 FullSimplify
– kglr
Commented Mar 3, 2015 at 5:22
• Thank you. I wonder if someone else with Version 10 has my same results Commented Mar 3, 2015 at 5:34
• I can confirm Nicola's results ((-1)^L Sqrt[1 - a^2] Cos[2 b] <= 1,True,etc.) and I am on Mathematica 10.0.2 running on Mac OS X Yosemite. Commented Mar 3, 2015 at 10:01

The problem seems like a bug, a rather silly one on the surface. Consider the returned value in the OP's first bit of code. When it is simplified using the equivalent assumption as coded by the OP, it does not return True. A simple transformation of the inequality gets us to the result.

Simplify[(-1)^L Sqrt[1 - a^2] Cos[2 b] <= 1,
1 - (-1)^L Sqrt[1 - a^2] Cos[2 b] >= 0]
Simplify[(-1)^L Sqrt[1 - a^2] Cos[2 b] <= 1,
1 - (-1)^L Sqrt[1 - a^2] Cos[2 b] >= 0 /. lhs_ >= rhs_ :> -lhs <= -rhs // Simplify]
(*
(-1)^L Sqrt[1 - a^2] Cos[2 b] <= 1
True
*)


If we do the same in the OP's code, we get the desired result. It is hard to guess the scope of this restriction. Apparently there is no normal form for an inequality.

Assuming[-1 <= a <= 1 && 0 <= b <= π/4 && L ∈ Integers &&
1 - (-1)^L Sqrt[1 - a^2] Cos[2 b] >= 0 /. lhs_ >= rhs_ :> -lhs <= -rhs // Simplify,
Abs[1 - (-1)^L Sqrt[1 - a^2] Cos[2 b]] == 1 - (-1)^L Sqrt[1 - a^2] Cos[2 b] // Simplify]
(*
True
*)


It seems particularly odd, because I suspect that the inequality that the OP's code produces is transformed from the assumptions. For instance, compare

Assuming[1 - (-1)^L x >= 0 && L ∈ Integers,
Simplify[Abs[1 - (-1)^L x] == 1 - (-1)^L x]]
Assuming[L ∈ Integers,
Simplify[Abs[1 - (-1)^L x] == 1 - (-1)^L x]]
(*
(-1)^L x <= 1
(-1)^L x + Abs[1 + (-1)^(1 + L) x] == 1
*)


It is also connected to the factor (-1)^L:

Assuming[1 - x >= 0, Simplify[Abs[1 - x] == 1 - x]]
(*  True  *)


The following does not answer the Question, but may shed some light on it.

For convenience, name the two equations eq1 and eq2, respectively.

eq1 = Abs[1 - (-1)^L Sqrt[1 - a^2] Cos[2 b]] == 1 - (-1)^L Sqrt[1 - a^2] Cos[2 b];
eq2 = Abs[1 - E^(I π L) Sqrt[1 - a^2] Cos[2 b]] == 1 - E^(I π L) Sqrt[1 - a^2] Cos[2 b];


The essence of the matter appears to be whether FullSimplify can recognize that the argument of Abs is non-negative, in which case it strips off the Abs, and recognizes the expression to be True. Consider first the effect of making the first three assumptions listed in the Question

FullSimplify[{eq1[[1]], eq1[[2]], eq1}, -1 <= a <= 1 && 0 <= b <= π/4 && L ∈ Integers]
FullSimplify[{eq2[[1]], eq2[[2]], eq2}, -1 <= a <= 1 && 0 <= b <= π/4 && L ∈ Integers]


Both give the same result,

(* {Abs[-1 + (-1)^L*Sqrt[1 - a^2]*Cos[2*b]], 1 + (-1)^(1 + L)*Sqrt[1 - a^2]*
Cos[2*b], (-1)^L*Sqrt[1 - a^2]*Cos[2*b] <= 1} *)


Even with enough information to do so, FullSimplify is unable to determine that the argument of Abs is non-negative, as can be seen in the first entry. Yet, FullSimplify of eq1 (or eq2) itself returns, in effect, 1 - (-1)^L*Sqrt[1 - a^2]*Cos[2*b] >= 0. It is as though Mathematica, being unable to simplify the equation, returns the (correct) answer to another question but does not use that answer to simplify Abs.

Consider instead the effect of making only the last assumption listed in the Question

FullSimplify[{eq1[[1]], eq1[[2]], eq1}, 1 - (-1)^L Sqrt[1 - a^2] Cos[2 b] >= 0]


gives the same answer, even when told explicitly that the argument of Abs is non-negative. On the other hand,

FullSimplify[{eq2[[1]], eq2[[2]], eq2}, 1 - E^(I π L) Sqrt[1 - a^2] Cos[2 b] >= 0]


returns

(* {1 - Sqrt[1 - a^2]*E^(I*L*Pi)*Cos[2*b], 1 - Sqrt[1 - a^2]*E^(I*L*Pi)*Cos[2*b], True} *)


In this case, Mathematica uses the assumption to eliminate Abs, and the equation reduces to True.