# Full Simplify not cancelling terms, even with Assumptions

I'm having a problem getting Mathematica in vanishing the following expression:

$\frac{-3 \:\sqrt{6}\: x \sqrt{\frac{y}{3 x-2 \sqrt{3}}}+ \:6 \sqrt{2} \: \sqrt{\frac{y}{3 x-2 \sqrt{3}}}+\: \sqrt{6}\: \sqrt{\left(3 x-2 \sqrt{3}\right) y}}{12 \sqrt{\pi } \:x}$

When I plug it into Mathematica:

    FullSimplify[((
6 Sqrt[2] Sqrt[-(y/(2 Sqrt[3] - 3 x))] -
3 Sqrt[6] x Sqrt[-(y/(2 Sqrt[3] - 3 x))] +
Sqrt[6] Sqrt[(-2 Sqrt[3] + 3 x) y])/(12 Sqrt[\[Pi]] x))]


it obviously cannot cancel the terms since I have not specified what the forms x and y take (real, complex, positive etc.).

Now I know the result is zero for real values of $x>\frac{\sqrt{3}}{2}$ and $y\neq0$. I can actually get Mathematica to give me these exact conditions by using Reduce:

    Reduce[{(6 Sqrt[2] Sqrt[-(y/(2 Sqrt[3] - 3 x))] -
3 Sqrt[6] x Sqrt[-(y/(2 Sqrt[3] - 3 x))] +
Sqrt[6] Sqrt[(-2 Sqrt[3] + 3 x) y])/(12 Sqrt[\[Pi]] x) == 0,
y > 0, x \[Element] Integers}, {x, y}, Reals]


I have added the condition $x \in \mathbb{Z}$ which then gives me the correct answer:

    x \[Element] Integers && x >= 2 && y > 0


Perfect! These are the conditions I need to specify to FullSimplifyfor the cancelling to occur. However, when I try

    FullSimplify[(
6 Sqrt[2] Sqrt[-(y/(2 Sqrt[3] - 3 x))] -
3 Sqrt[6] x Sqrt[-(y/(2 Sqrt[3] - 3 x))] +
Sqrt[6] Sqrt[(-2 Sqrt[3] + 3 x) y])/(12 Sqrt[\[Pi]] x),
x \[Element] Integers && x >= 2 && y > 0]


it still is not able to give me 0 as an answer, it just spits out the answer again. What exactly is happening here? I'm at my wits' end.

The problem is caused by the square roots not properly simplifying. To avoid it, you can use PowerExpand to force Mathematica to consider numerator and denominator inside the square roots as separate:

expr = (6 Sqrt[2] Sqrt[-(y/(2 Sqrt[3] - 3 x))] -
3 Sqrt[6] x Sqrt[-(y/(2 Sqrt[3] - 3 x))] +
Sqrt[6] Sqrt[(-2 Sqrt[3] + 3 x) y])/(12 Sqrt[\[Pi]] x);

FullSimplify[
PowerExpand@expr,
x \[Element] Integers && x >= 2 && y > 0
]
(* 0 *)


• Why would FullSimplify not use PowerExpand in its procedure and why would Reduce be able to work this out but not FullSimplify? – OldTomMorris Mar 14 '17 at 13:49
• @OldTomMorris hard to say. The heuristics used by FullSimplify to simplify expressions do not always give the results one would expect, which is to be expected by such a complex function. After all, it may make sense to not expand certain expression to simplify. With Reduce you are specifically asking for conditions that make the expression zero, which is an entirely different (and much simpler under many points of view) kind of problem. – glS Mar 14 '17 at 14:37
• @OldTomMorris In general you should not expect functions like FullSimplify to just give you the result you want. They are "magic" black boxes that often just work, but lots of other times they need suggestions on the user part on the kind of result that is wanted. This is where more specific functions like PowerExpand, Together, Expand and so on come into play. – glS Mar 14 '17 at 14:39
• This is the thing though, I don't see what other conditions I would need for the terms to cancel. I guessed what conditions would be needed for the $x$ and $y$, I also used Reduce to double check and still no good for Full Simplify. There's got to be an explanation for this behaviour. – OldTomMorris Mar 14 '17 at 17:25