The identity (x^a)^b = x^(ab) for real numbers x, a, b is only defined for positive x, i.e. when you write sqrt(x^2) = x, you necessarily assume (by definition!) that x > 0, but in the original function sqrt(x^2) x does not have to be positive, therefore functions y=sqrt(x^2) and {y=x AND x >0} are not equivalent (they differ in their domains). An equivalent function to sqrt(x^2) is abs(x).