# Why doesn't Mathematica simplify a square root of an expression that equals a square of a positive real?

When I try and simplify this expression:

In:= FullSimplify[Sqrt[ x^2 + 2 y^2 + 2 y Sqrt[x^2 + y^2] ], (x | y) \[Element] Reals]
Out= Sqrt[x^2 + 2 y (y + Sqrt[x^2 + y^2])]


it does not simplify properly.
However, Mathematica knows it equals a simpler expression:

In:= FullSimplify[ Sqrt[x^2 + 2 y^2 + 2 y Sqrt[x^2 + y^2] ] == Sqrt[x^2 + y^2] + y, (x | y) \[Element] Reals]
Out= True


Why doesn't Mathematica simplify this expression, and how can I make it do it anyway, even if the expression is part of a larger expression?

Possibly because the second simplification request is much easier than the first. Consider: Also, the second FullSimplify can be done by Simplify. Not surprising since all MMA has to do is square both sides.

edit: Perhaps this will suggest an approach: • This is true, but why is the first simplification so hard that Mathematica doesn't find it? And is there a way to make it find it? – Joe Oct 25 '12 at 6:55
• @Joe Why is it so important to you that FullSimplify be able to carry out this simplification? Why can't you just apply your knowledge of the equality of the two expressions directly to whatever work you are doing? – m_goldberg Oct 25 '12 at 13:06
• Since I am trying to simplify a very long expression that contains multiple versions of the expression I'm asking about, and I don't want to go through my long expression manually. – Joe Oct 25 '12 at 16:17
• Great idea! It can be a bit simplified by using just one replacement rule: x_^2 + 2 y_^2 + 2 y_ Sqrt[x_^2 + y_^2] -> (Sqrt[x^2 + y^2] + y)^2. – Joe Oct 31 '12 at 18:48

Change to polar coordinates, {x -> r Cos[t], y -> r Sin[t]}:

FullSimplify[ Sqrt[2 y Sqrt[x^2 + y^2] + x^2 + 2y^2] /.
{x -> r Cos[t], y -> r Sin[t]}, r > 0 && 0 < t< 2Pi]

r (Sin[t] + 1)


This should simplify your long expression ...

• Nice! Then I just add /.{r -> Sqrt[x^2 + y^2], t -> ArcTan[x, y]} and simplify again and I have the simplified expression in my original variables. On the other hand, I have this expression appearing multiple times with different variables instead of x and y, and I'm not sure if your approach can be generalized to such a case. – Joe Oct 31 '12 at 18:44
• Awesome tip! I had trouble that Mathematica wouldn't simplify expressions with complex numbers properly, and would take ages to handle them. Now I just write them in polar co-ordinates, and add assumptions that the real and imaginary parts are real, which increases the performance immensely. – Stan Sep 10 '16 at 14:28

You might do this:

Simplify[Sqrt[x^2 + 2 y^2 + 2 y Sqrt[x^2 + y^2]] /. x^2 -> u^2 - y^2, {u > 0, y > 0}] /. u -> Sqrt[x^2 + y^2]


The result is here: y + Sqrt[x^2 + y^2]

I required that both u and y are positive. If they are not:

Simplify[Sqrt[x^2 + 2 y^2 + 2 y Sqrt[x^2 + y^2]] /.x^2 -> u^2 - y^2, {u < 0, y < 0}] /. u -> Sqrt[x^2 + y^2]


You get another result: Abs[-y + Sqrt[x^2 + y^2]]

x^2 + 2 y^2 + 2 y Sqrt[x^2 + y^2] == Expand[(Sqrt[a] + Sqrt[b])^2]
(*x^2 + 2 y^2 + 2 y Sqrt[x^2 + y^2] == a + 2 Sqrt[a] Sqrt[b] + b*)

Solve[{a + b == x^2 + 2 y^2, 2 Sqrt[a b] == 2 y Sqrt[x^2 + y^2]}, {a, b}, Reals]
Simplify[Sqrt[a] + Sqrt[b] /. %, Element[{x, y}, Reals]] // Union // Normal

(*
{{a -> ConditionalExpression[y^2, y > 0],  b -> ConditionalExpression[x^2 + y^2, y > 0]},
{a -> ConditionalExpression[x^2 + y^2, y > 0],  b -> ConditionalExpression[y^2, y > 0]}}

{y + Sqrt[x^2 + y^2]}
*)