# Removing Abs with ComplexExpand not working

Here is what I have used for this.
From this link, Why do I get empty graph when adding 'Abs' function? I know that I can remove Abs with ComplexExpand
Input

ComplexExpand[Sqrt[1 - Abs[x]^2]]


Output

((1 - x^2)^2)^(1/4) Cos[1/2 Arg[1 - Abs[x]^2]] +
I ((1 - x^2)^2)^(1/4) Sin[1/2 Arg[1 - Abs[x]^2]]


However, it works just fine when I use Plus in the Sqrt.
Input

ComplexExpand[Sqrt[1 + Abs[x]^2]]


Output

Sqrt[1 + x^2]


Is there anyone who can explain this?

• Maybe you can try setting the option TargetFunctions->{Re, Im} to ComplexExpand? – QuantumDot Jul 26 '20 at 5:44
• Documentation says ComplexExpand assumes all variables are real. Since your example doesn't work, perhaps they missed a case. Or you can use Simplify[Sqrt[1+ Abs[x]^2],Element[x,Reals]] which works with both + and - and get on with the work you need to do. – Bill Jul 26 '20 at 6:02
• @QuantumDot, your method is not working – kile Jul 26 '20 at 6:16

Maybe adding Simplify gives you what you want.

ComplexExpand[Sqrt[1 - Abs[x]^2]] // Simplify
(*Piecewise[{{I*((x^2 - 1)^2)^(1/4), Abs[x] > 1}}, ((x^2 - 1)^2)^(1/4)]*)


or

\$Assumptions = -1 < x < 1

ComplexExpand[Sqrt[1 - Abs[x]^2]] // Simplify
(*Sqrt[1 - x^2]*)


The plus case is different because the value inside the Sqrt is always positive. It is generally a good idea to add Simplify to any result ComplexExpand returns.

• I think there is no need to add ComplexExpand. You pan get the same result with only Simplify used here – kile Jul 27 '20 at 4:13