Is differentiating on both sides of an equation allowed? Let's say we have $x^2=25$
So we have two real roots ie $+5$ and $-5$.
But if we were to differentiate on both sides with respect to $x$ we'll have the equation $2x=0$ which gives us the only root as $x=0$.
So does differentiating on both sides of an equation alter it? If it does, then how do we conveniently do it in Integration by substitutions?
If not then what exactly is going on here ?

Like algebraic addition or multiplication on both sides of an equation you cannot differentiate if there is no functional dependence between quantities on either side of a given equation. 
Differentiation is performed mostly when rates of change have to be found, for example in finding a derivative, to find extrema or to find relationship with other variables. Also constants will disappear on differentiation.
