# How can I move one term with Sqrt to the right side of equation?

How can I automatically identify the term containing a radical (Sqrt[x^2 + (2 + y)^2]) in an equation and move it to the right side:

1 + 2 y + Sqrt[x^2 + (2 + y)^2] == 0

1 + 2 y == -Sqrt[x^2 + (2 + y)^2]


If the equation contains two radical terms, only one of them should be moved to the right:

Sqrt[x^2 + (-2 + y)^2] + Sqrt[x^2 + (2 + y)^2] == 6

Sqrt[x^2 + (-2 + y)^2] == 6-Sqrt[x^2 + (2 + y)^2]



If the equation contains two roots, simply move any of them to the right side of the equation. The purpose is to have one radical on each side of the equation.

• In future, please do not significantly change the question when you already got answers to the initial question. Apr 19, 2023 at 12:03
• When running such code, new problems arise when trying various practical application scenarios Apr 19, 2023 at 14:13
• Well, of course, but then either explore your problem a bit more thoroughly in the first place before asking the question, or ask a new question :) Apr 19, 2023 at 14:20

eq = 1 + 2 y + Sqrt[x^2 + (2 + y)^2] == 0;
SubtractSides[eq, FirstCase[List @@ First@eq, Sqrt[__]]]
(* 1 + 2 y == -Sqrt[x^2 + (2 + y)^2] *)

eq = Sqrt[x^2 + (-2 + y)^2] + Sqrt[x^2 + (2 + y)^2] == 6;
SubtractSides[eq, FirstCase[List @@ First@eq, Sqrt[__]]]
(* Sqrt[x^2 + (2 + y)^2] == 6 - Sqrt[x^2 + (-2 + y)^2] *)

• 5 (-5 + Sqrt[x^2 + (-2 + y)^2]) + 2 y == 0If there are coefficients before the radical, how can we move such a radical to the right side of the equation? Apr 19, 2023 at 14:12
• @csn899, I don't want to come off as snarky, but if you want to learn Mathematica, you should try understanding the answers we give you and grasp the main concepts. For example, in FirstCase, the second argument is a pattern. Have you tried learning them? Then you will see that you can modify Sqrt[__] to k_*Sqrt[__] to match also radicals with a coefficient. However, you will also need to Expand your equation beforehand. Apr 19, 2023 at 14:33
• Clear["Global*"] expr = EuclideanDistance[{0, 2}, {x, y}] + EuclideanDistance[{0, -2}, {x, y}] == 10 eq1 = Refine[Simplify[expr], Assumptions -> {x \[Element] Reals, y \[Element] Reals}] // FullSimplify eq2 = SubtractSides[eq1, FirstCase[List @@ First@eq1, Sqrt[__]]] eq3 = ApplySides[#^2 &, eq2] // Expand eq4 = Apply[Subtract, eq3] == 0 eq5 = SubtractSides[eq4, FirstCase[List @@ First@eq4, k_*Sqrt[__]]] eq6 = ApplySides[#^2 &, eq5] // Simplify Apr 19, 2023 at 14:44
• Why use K_* The form of Sqrt [__] cannot shift terms when the coefficient before the radical is 1. Is there any way to unify and transfer terms for all coefficients before the radical that are one? Apr 19, 2023 at 15:01
• @csn899, again, try learning patterns. There is a way to make part of a pattern Optional: k_.*Sqrt[__]` Apr 19, 2023 at 15:08