Sign of square root of a real number May we write $\sqrt{x^2}=\pm x$.      
Is  $\sqrt{x^2}=\sqrt{(\pm x)^2}=\pm{x}$ true ?
 But we write $\sqrt{x^2}=|x|=x$
What is the actual logic? 

You are confused because there are two notions at play here which the standard treatment of the square root obfuscates: functions and solutions of equations.
The right way to think about the square root is as a function: given any positive number $a$, the square root function returns the square root $\sqrt a$ (I should technically write"nonnegative" instead of "positive," but I wanted to shoot for clarity over pedantry). And what is $\sqrt a$? The unique positive solution to the equation $x^2=a$. I can't emphasize the "positive" part of that definition enough. It would not make any sense to define the square root to be the solution to the equation $x^2=a$ since in general that equation has two solutions: for instance, the equation $x^2=4$ has the two solutions $x=2$ and $x=-2$. If we defined the square root of $2$ to be the solution to the equation $x^2=4$, we would not know what to do when it came time to actually compute $\sqrt4$ since we would have to choose between $2$ and $-2$. Mathematicians chose $\sqrt a$ to mean the positive solution to the equation $x^2=a$, but they could just as well have chosen it to mean the negative solution (although that would have been unpopular for aesthetic reasons).
My response is a little more rambling than I intended. Does that clear up the matter?
