12
$\begingroup$

When I try and simplify this expression:

In[1]:= FullSimplify[Sqrt[ x^2 + 2 y^2 + 2 y Sqrt[x^2 + y^2] ], (x | y) \[Element] Reals]
Out[1]= 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[2]:= 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[2]= 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?

$\endgroup$
2
$\begingroup$

Possibly because the second simplification request is much easier than the first. Consider:

enter image description here

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:

enter image description here

$\endgroup$
  • $\begingroup$ 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? $\endgroup$ – Joe Oct 25 '12 at 6:55
  • $\begingroup$ @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? $\endgroup$ – m_goldberg Oct 25 '12 at 13:06
  • 5
    $\begingroup$ 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. $\endgroup$ – Joe Oct 25 '12 at 16:17
  • $\begingroup$ 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. $\endgroup$ – Joe Oct 31 '12 at 18:48
7
$\begingroup$

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 ...

$\endgroup$
  • $\begingroup$ 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. $\endgroup$ – Joe Oct 31 '12 at 18:44
  • $\begingroup$ 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. $\endgroup$ – Stan Sep 10 '16 at 14:28
2
$\begingroup$

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]]

$\endgroup$
0
$\begingroup$
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]}
*)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.