3
$\begingroup$

I am trying to simplify the following expression with terms inside the Sqrt function that can be simplified:

$$\sqrt{\frac{a}{(c-1) c}}-\frac{\sqrt{a}}{\sqrt{(c-1) c}}$$

Code:

Simplify[-(Sqrt[a]/Sqrt[(-1 + c) c]) + Sqrt[a/((-1 + c) c)]]

enter image description here

which basically returns the input, though the answer should be zero. How can I ensure that the output is zero?

$\endgroup$
1
  • 1
    $\begingroup$ Not necessarily true for complex inputs: e.g. FindInstance[-Sqrt[a]/Sqrt[(-1 + c) c]+Sqrt[a/((-1 + c) c)] != 0, {a, b, c}] returns a perfectly valid solution for $a, b, c$ for which the formula given does not equal 0. You can simplify assuming the reals however if you know that this isn't a potential issue: Simplify[..., Reals] $\endgroup$
    – eyorble
    Nov 30, 2022 at 23:20

2 Answers 2

7
$\begingroup$

$\sqrt\frac{a}{b}=\frac{\sqrt a}{\sqrt b}$ only under these conditions

Reduce[Sqrt[a/c] == Sqrt[a]/Sqrt[c], {a, c}, Reals]

Mathematica graphics

You can find the conditions for your case the same way

Reduce[Sqrt[a/((-1 + c) c)] == Sqrt[a]/Sqrt[(-1 + c) c], {a, c}, Reals]

Mathematica graphics

Then you can do

ClearAll[a, c]
Assuming[a >= 0 && (c < 0 || c > 1), 
 Simplify[-(Sqrt[a]/Sqrt[(-1 + c) c]) + Sqrt[a/((-1 + c) c)]]]

Mathematica graphics

$\endgroup$
2
$\begingroup$
expr = -(Sqrt[a]/Sqrt[(-1 + c) c]) + Sqrt[a/((-1 + c) c)];

Using PowerExpand:

The "universally correct" answer according to the docs will be:

PowerExpand[expr, Assumptions -> True]

$$\frac{\sqrt{a} \exp \left(i \pi \left\lfloor -\frac{\arg (a)}{2 \pi }+\frac{\arg (c-1)}{2 \pi }+\frac{\arg (c)}{2 \pi }+\frac{1}{2}\right\rfloor \right)}{\sqrt{c-1} \sqrt{c}}+\frac{\sqrt{a} \exp \left(i \pi \left(\left\lfloor -\frac{\arg (c-1)}{2 \pi }+\frac{1}{2}-\frac{\arg (c)}{2 \pi }\right\rfloor +1\right)\right)}{\sqrt{c-1} \sqrt{c}}$$


The expression has two parts and with default assumptions:

{PowerExpand[expr[[1]]], PowerExpand[expr[[2]]]}

$$\left\{\frac{\sqrt{a}}{\sqrt{c-1} \sqrt{c}},-\frac{\sqrt{a}}{\sqrt{c-1} \sqrt{c}}\right\}$$

PowerExpand[expr, Assumptions -> Automatic]

0

$\endgroup$

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