I encounterd the problem of absolute sign of the below equation.
$$\sqrt{x^2+a^2+2xa}-\sqrt{x^{2}+a^{2}-2xa}=(x+a)-|x-a|$$
$$a,x>0$$
The below stuff are what I tried.
$f(x):=\sqrt{x^2+a^2+2xa}-\sqrt{x^{2}+a^{2}-2xa}$
$f(x)=\sqrt{(x+a)^{2}}-\sqrt{(x-a)^{2}}$
=$\left((x+a)^{2}\right)^{\frac{1}{2}}-\left((x-a)^{2}\right)^{\frac{1}{2}}$
=$\left(x+a\right)^{\frac{1}{1}}-\left((x-a)^{2}\right)^{\frac{1}{2}}$
=$\left(x+a\right)-\left((x-a)^{2}\right)^{\frac{1}{2}}$
So the problem is the rightmost term.
As we develop it greedily,
$f(x)=\left(x+a\right)-\left((x-a)^{2}\right)^{\frac{1}{2}}$
$=\left(x+a\right)-\left(x-a\right)^{\frac{1}{1}}$
$=2a$
However the below equations also be held.
$f(x)=\left(x+a\right)-\left((x-a)^{2}\right)^{\frac{1}{2}}$
$=\left(x+a\right)-\left((-1)^{2}(x-a)^{2}\right)^{\frac{1}{2}}$
$=\left(x+a\right)-\left((a-x)^{2}\right)^{\frac{1}{2}}$
$=\left(x+a\right)-\left(a-x\right)$
$=2x$
What is going on?
We have $$\sqrt{x^2+a^2+2ax} - \sqrt{x^2+a^2-2ax} = |x+a|-|x-a|$$ Now we should deal with the absolute values. By its definition, $$|y| = \begin{cases} y, & y \ge 0 \\ -y, & y < 0 \end{cases}$$ we have $|x+a| = x+a$ since $x+a > 0$ and $$|x-a| = \begin{cases} x-a, & x-a \ge 0 \\ -(x-a), & x-a < 0 \end{cases}$$ Therefore, we leave the latter one with absolute values since we do not know whether $x \ge a$ or $x < a$.