The abs function is used when you need to get the size of a number and you don't care if the number is positive or negative. The absolute value just ignores the sign of a number.
f(x)=|x|=x if x>0 or −x if x<0
to the absolute value function:
\[ \sqrt{ x^2 } \equiv |x|. \]