From school I know that
$\sqrt{x^2} = |x|$.
But if we rewrite the above equation in another way
$\sqrt{x^2} = (x^2)^{\frac{1}{2}} = x^{\frac{2}{2}} = x^1 = x$
then we get another answer.
How is it possible that rewritting an equation changes the answer? And which answer is right, $x$ or $|x|$?
[Converted from comment to answer]
The equality $x^{m/n}=(x^m)^{1/n}$ for arbitrary positive integers $m$ and $n$ can only be guaranteed true if $x$ is a nonnegative real number (here I assume you intend $a^{1/n}$ to denote the nonnegative root). In other cases, the expressions may be multi-valued.