Why can't I simplify my expression?

I'm trying to simplify some expressions containing square roots, yet it seems that Mathematica has trouble dealing with them. For instance, consider the following:

Simplify[(1 + Sqrt[1 + z]) (-3 + Sqrt[5 + 4 Sqrt[1 + z] + z]) - z, Assumptions -> z > 0]


I do know that this is equal to 0, but Simplify is unable to figure this out. (Using Series still allows me to verify this). Since all rooted values are positive, there should be no issues because of sign.

I have a bunch of other functions similarly shaped, which certainly contain significant simplifications, but for which I don't know how to figure out the result (and for which Series is no help).

• Reduce sees it is zero. expr=(1+Sqrt[1+z]) (-3+Sqrt[5+4 Sqrt[1+z]+z])-z;Reduce[expr==0,z,Reals] gives z >= -1 but using this, FullSimplify can't simplify it to zero. May be it needs more special tricks for FullSimplify to do it. Otherwise, use Reduce. Apr 18 '18 at 2:32

FullSimplify seems to yield $0$ even without the assumption if the problem is reformulated

I think the problem is related to the assumed branchcut of square root function. I defined your expression as follows

givenExpression[z_] := (1 + Sqrt[1 + z]) (-3 + Sqrt[5 + 4 Sqrt[1 + z] + z]) - z;


which does not simplify any more as claimed:

FullSimplify[givenExpression[z]]


-z + (1 + Sqrt[1 + z]) (-3 + Sqrt[5 + z + 4 Sqrt[1 + z]])

However, if I change my variable $z$ to $z-1$, I immediately get $0$:

FullSimplify[givenExpression[z - 1]]


0

Possible issue with branchcut

It is actually easy to see the issue with branch cut. We see that

givenExpression[z - 1]


$-z+\left(\sqrt{z}+1\right) \left(\sqrt{z+4 \sqrt{z}+4}-3\right)+1$

and we see that FullSimplify assume

FullSimplify[Sqrt[4 + 4 Sqrt[z] + z] == 2 + Sqrt[z]]


True

However this is actually not so trivial. Indeed Reduce gives a warning and refuses to evaluate for the same expression:

Reduce[Sqrt[4 + 4 Sqrt[z] + z] == 2 + Sqrt[z]]


Reduce::useq: The answer found by Reduce contains unsolved equation(s) {0==2+Sqrt[z]-Sqrt[4+4 Power[<<2>>]+z]}. A likely reason for this is that the solution set depends on branch cuts of Wolfram Language functions.

which returns back

0 == 2 + Sqrt[z] - Sqrt[4 + 4 Sqrt[z] + z]

• Reduce just needs the assumption Assuming[z >= 0, Reduce[Sqrt[4 + 4 Sqrt[z] + z] == 2 + Sqrt[z]]] evaluates to True Apr 18 '18 at 5:05
• What I am showing above is that the equation is generically true even without the assumption: FullSimplify confirms it. However, this is probably a subtle result as Reduce refuses the confirm it due to branch cut issues, which can be avoided if the value of $z$ is restricted as you suggest. However, as I showed in the last part, even this result is only generically true as there seems to be $z>0$ values for which the result does not hold. Apr 18 '18 at 5:14
• If you use inexact numbers you should expect inexact results. If you Rationalize the random numbers the exact results are zero. Module[{numbers}, numbers = Rationalize[RandomReal[{0, 100}, 10], 0]; Grid[FullSimplify[Transpose@{numbers, givenExpression /@ numbers}]]] Apr 18 '18 at 15:05
• @Soner, look at my answer. The expression is zero for all (even complex) z. Apr 18 '18 at 16:12
• @Akku14 I show in the first part of my answer that FullSimplify yields zero for the expression without any assumptions if we reparametrize the questions. This means the result is already generically zero for any object, including but not limited to complex numbers. Apr 18 '18 at 16:45

Help Reduce writing the z as z = r*Exp[I*phi] , and it easily prooves the givenexpression to be zero.

For negative real z:

Simplify[Reduce[givenExpression[r E^(I Pi)] == 0 && r >= 0, r],
r >= 0]

(*   True   *)


For positive real z:

Simplify[Reduce[givenExpression[r E^(I 0)] == 0 && r >= 0, r], r >= 0]

(*   True   *)


And it also works for all complex numbers

Simplify[Reduce[givenExpression[r E^(I phi)] == 0 && r >= 0],
r >= 0 && phi \[Element] Reals]

(*   True   *)


Or Simply

Simplify[(1 + Sqrt[1 + z]) (-3 + Sqrt[5 + 4 Sqrt[1 + z] + z]) - z /.
z -> u - 1]
(* 0 *)