%output=pdf

\environment layout

\starttext

\section{Absolute Value}

One of the most important applications of piecewise functions is
absolute value.  In previous courses, a simplistic notion of
absolute value is sufficient, but this will not be the case in
advanced courses such as calculus.  However, your intuitive notion
of absolute value remains valid: the absolute value of a number
produces a nonnegative\footnote{A nonnegative number is a number
that is not negative; i.e., the number is either positive or
zero.} result.

There are two distinct cases to consider.  First, if a number is
nonnegative (positive or zero) its absolute value is itself. For
example,

\placeformula[-]
 \startformula
  \eqalign{
   |0|&=0,\cr
   |1|&=1,\cr
   |2|&=2,\cr
  }
 \stopformula

that is, if $x\ge 0$, then $|x|=x$.  The second case is similar,
but somewhat counter intuitive at first inspection.  If a number
is negative, then the absolute value negates the number so that
the resulting number is positive.  For example,

\placeformula[-]
 \startformula
  \eqalign{
   |-3|&=-(-3)=3,\cr
   |-2|&=-(-2)=2,\cr
   |-1|&=-(-1)=1.\cr
  }
 \stopformula

That is, if $x<0$, then $|x|=-x$.  Let's summarize these results
in a definition.

\startdefinition[section4:definition1] If x is any real number
then

\placeformula[-]
 \startformula
  |x|=
  \cases{
   -x,& if $x<0$,\cr
   x,& if $\ge 0$.\cr
  }
 \stopformula

\stopdefinition

It is helpful to be familiar with the graph of the absolute value
function.

\startexample[section4:example1] Sketch the graph of $y=|x|$.

{\bf Solution}.  According to
\in{Definition}[section4:definition1], there are two cases. First,
if $x<0$, then $y=-x$.  The graph of $y=-x$ is a line with the
slope $-1$ that passes through the origin.  Calculate two points
that satisfy the equation $y=-x$.  If is essential you use the
endpoint at $x=0$, but you can select any other $x$-value,
provided $x<0$.  Thus,

\placeformula[-]
 \startformula
  \eqalign{
   x&=0\Longrightarrow y=-0=0,\cr
   x&=-1\Longrightarrow y=-(-1)=1.\cr
  }
 \stopformula

Plot these points, then draw a ray, emanating from $(0,0)$ and
passing through the point $(-1,1)$, as shown in
\in{Figure}[section4:fig1].

%\placefigure
% [here][section4:fig1]
% {The graph of $y=-x$, $x<0$.}
% {\externalfigure[section4figs.pdf][page=1]

In the second case, if $x\ge 0$, the
\in{Definition}[section4:definition1] tells us that $y=x$.  This
is a line with slope 1 that passes through the origin.  However,
$y=x$ only if $x\ge 0$, so we must keep this in mind when
selecting $x$-values.  We have to use the endpoint at $x=0$, but
we are free to pick any second value of $x$ as long as it is
greater than zero.  Thus,

\placeformula[-]
 \startformula
  \eqalign{
   x&=0\Longrightarrow y=0,\cr
   x&=1\Longrightarrow y=1.\cr
  }
 \stopformula

Plot these points, then draw a ray, emanating from the origin at
$(0,0)$ and passing through the point $(1,1)$.  This result is
added to \in{Figure}[section4:fig1] and shown in
\in{Figure}[section4:fig2].

%\placefigure
% [here][section4:fig2]
% {Adding the line $y=x$, $x\ge 0$, to the partial result shown in \in{Figure}[section4:fig1]}
% {\externalfigure[section4figs.pdf][page=2]

The final graph, shown in \in{Figure}[section4:fig3], should be
memorized, as it is absolutely fundamental to a proper
understanding of absolute value.

%\placefigure
% [here][section4:fig3]
% {The completed graph of $y=|x|$.}
% {\externalfigure[section4figs.pdf][page=3]

\subsection{Using the Number Line}

When working with absolute value, it's helpful to summarize sign
information on a number line.

\startexample[section4:example2] Analyze the sign of $f(x)=x-2$
and summarize your findings on a number line.

{\bf Solution}.  First, note that the function is zero at $x=2$.
The value $x=2$ is ``critical'' to the discussion of the sign
$f(x)=x-2$.  Locate $x=2$ on a number line, as shown in
\in{Figure}[section4:fig4].

%\placefigure
% [here][section4:fig4]
% {A ``critical'' value at $x=2$.}
% {\externalfigure[section4figs.pdf][page=4]

Note that the critical value at $x=2$ divides the number line in
two pieces.  You need to evaluate the sign of $f(x)=x-2$ on each
side of the critical value on the number line.  This is most
easily accomplished by evaluating the function at a particular
$x$-value on each side of the critical value.  For example, if
$x=1$, then $f(1)=1-2=-1$ is negative.  Indeed, the function is
negative for any $x$-value selected to the left of 2 (check this).
This fact is indicated by placing a negative sign below the number
line to the left of 2, as shown in \in{Figure}[section4:fig5].

%\placefigure
% [here][section4:fig5]
% {Caption}
% {\externalfigure[section4figs.pdf][page=5]

Next, evaluate the function at an $x$-value that lies to the right
of the critical value at $x=2$.  For example, if $x=3$, then
$f(x)=3-2=1$ is positive.  Again, the function is positive for any
$x$-value you select to the right of 2 (check this).  This fact is
indicated by placing a plus sign below the number line, as shown
in \in{Figure}[section4:fig6].

%\placefigure
% [here][section4:fig6]
% {Caption}
% {\externalfigure[section4figs.pdf][page=6]

Therefore, if $x<2$, $f(x)=x-2$ is negative, and if $x>2$, then
$f(x)=x-2$ is positive.

\stopexample

\subsection{Piecewise Definition of Absolute Value}

By analyzing the sign of the function bound by absolute value
bars, you can remove the absolute value bars and craft a piecewise
definition for your function.

\startexample[section4:example3] Craft a piecewise definition for
$f(x)=|x-2|$.  Use your definition to sketch the graph of $f$.

{\bf Solution}.  We did complete analysis of the sign of $x-2$ in
\in{Example}[section4:example2].  If $x<2$, we see in
\in{Figure}[section4:fig6] that $x-2$ is negative.  If $x-2$ is
negative, then the absolute value must change $x-2$ into a
positive number.  This is accomplished by negating $x-2$.  Thus,

\placeformula[-]
 \startformula
  x-2<0\Longrightarrow|x-2|=-(x-2).
 \stopformula

Equivalently,

\placeformula[-]
 \startformula
  x<2\Longrightarrow|x-2|=-x+2.
 \stopformula

That is, if $x$ is to the left of the critical number at 2.  Then,
$|x-2|=\x+2$.  This fact is summarized on the number line in
\in{Figure}[section4:fig7].

%\placefigure
% [here][section4:fig7]
% {If $x<2$, then $|x-2|=-x+2$.}
% {\externalfigure[section4figs.pdf][page=7]

On the other hand, in \in{Figure}[section4:fig6], not that $x-2$
is positive, then the absolute value has nothing to do.  That is,

\placeformula[-]
 \startformula
  x-2>0\Longrightarrow|x-2|=x-2.
 \stopformula

Equivalently,

\placeformula[-]
 \startformula
  x>2\Longrightarrow|x-2|=x-2.
 \stopformula

That is, if $x$ lies to the right of the critical number at 2,
then $|x-2|=x-2$.  This is summarized on the number line in
\in{Figure}[section4:fig8].

%\placefigure
% [here][section4:fig8]
% {If $x\ge 2$, then $|x-2|$=x-2$.}
% {\externalfigure[section4figs.pdf][page=8]

The information provided by the number line in
\in{Figure}[section4:fig8] allows us to easily create a piecewise
definition for the function $f(x)=|x-2|$.

\placeformula[-]
 \startformula
  f(x)=|x-2|=
  \cases{
   -x+2,& if $x<2$,\cr
   x-2,& if $x\ge 2$.\cr
  }
 \stopformula

If $x<2$, then $f(x)=-x+2$ and the graph is a line with slope $-1$
and intercept 2.  Calculate two points, one of which is the
endpoint at $x=2$, the other having $x$-value less than 2.

\placeformula[-]
 \startformula
  \eqalign{
   f(2)&=-2+2=0\cr
   f(1)&=-1+2=1\cr
  }
 \stopformula

Thus, the graph of $f(x)=-x+2$ is a ray, emanating from the point
$(2,0)$ and passing through the point $(1,1)$, as shown in
\in{Figure}[section4:fig9].

%\placefigure
% [here][section4:fig9]
% {If $x<2$, then $|x-2|=-x+2$.}
% {\externalfigure[section4figs.pdf][page=9]

If $x>2$, then $f(x)=x-2$ and the graph is aline with slope 1 and
intercept $-2$.  Calculate two points, one of which is the
endpoint at $x=2$, the other having $x$-value greater than 2.

\placeformula[-]
 \startformula
  \eqalign{
   f(2)&=2-2=0\cr
   f(3)&=3-2=1\cr
  }
 \stopformula

\stopexample

\stoptext
