Sometimes we don't care if a number is positive (i.e., lies to the right of zero) or negative (i.e., lies to the left
of zero).
We just want to know its size—its distance from zero.
In these situations, the concept of absolute value comes to the rescue.
The notation
$\,|x|\,$
denotes the absolute value of $\,x\,$.
The number $\,|x|\,$ gives the distance between $\,x\,$ and $\,0\,$.
This definition of absolute value as distance from zero is often the easiest
one to use.
Whenever you see those two vertical bars that denote absolute value,
I like to have my
students do two ‘karate chops’ on them, saying:
$$
\cssId{s13}{\overset{\text{karate chop #1:}}{\overset{\text{DISTANCE}}{\overbrace{\ \ \ \ |\ \ \ \ }}}}
\cssId{s14}{\overset{\text{from}}{\ \ \ \ \ \strut\ \ \ \ \ }}
\cssId{s15}{\overset{\text{karate chop #2:}}{\overset{\text{ZERO}}{\overbrace{\ \ \ \ |\ \ \ \ }}}}
$$
However, there is also an algebraic definition of absolute value.
In particular, the algebraic definition is needed in the derivation of the
quadratic formula.
The algebraic definition of absolute value uses a piecewise-defined function.
A piecewise-defined function is used whenever different output formulas are needed for different inputs;
that is, more than one piece is needed to give a full description of what the function does!
Whenever you need one rule for one set of inputs, and another rule for a different
set of inputs,
then a piecewise-defined function comes to the rescue.
As you'll observe in the definition below, the following notation is used for piecewise-defined functions:
Here are some alternate presentations of this piecewise-defined function:
$$ \cssId{s40}{ {|x|} = \begin{cases} x &\text{for }\ x\ge 0 \\ -x &\text{for }\ x\lt 0 \end{cases}} $$ | $$ \cssId{s41}{ {|x|} = \begin{cases} x\,, &\text{if }\ x\ge 0 \\ -x\,, &\text{if }\ x\lt 0 \end{cases}} $$ | $$ \cssId{s42}{ {|x|} = \begin{cases} x\,, &\text{if }\ x\ge 0\,, \\ -x\,, &\text{if }\ x\lt 0 \end{cases}} $$ | $$ \cssId{s43}{ {|x|} = \begin{cases} x\,, &\text{for }\ x\ge 0\,, \\ -x\,, &\text{for }\ x\lt 0 \end{cases}} $$ |
The absolute value makes a useful appearance in the following formula:
So, what is $\,\sqrt{x^2}\,$?
There are two numbers which, when squared, give $\,x^2\,$:
$\,x\,$ and $\,-x\,$.
Which one do we want?
Answer: Whichever one is nonnegative!
Unless we happen to know the sign of $\,x\,$, then we won't know which one is nonnegative.
Absolute value comes to the rescue!
The number $\,|x|\,$ has the same size (distance from zero) as both $\,x\,$ and $\,-x\,$, and is always nonnegative.
Don't ever fall into a common trap and think that $\,\sqrt{x^2}\,$ is just $\,x\,$.
Sure, this ‘formula’ works if we know, ahead of time, that $\,x\,$ is nonnegative.
But, usually we're in situations where $\,x\,$ is allowed to be any real number.
For example, let $\,x = -5\,$.
Then, $\,x^2 = (-5)^2 = 25\,$.
Is $\,\sqrt{x^2}\,$ equal to $\,x\,$ in this case?
No!
$\,\sqrt{25}\ne -5\,$
However, it is true that
$\,
\cssId{s88}{\sqrt{x^2}}
\cssId{s89}{= \sqrt{(-5)^2}}
\cssId{s90}{= \overset{=\, |x|}{\overbrace{|-5|}}}
\cssId{s91}{= 5}\,$.