Loppyfoot said:
Ok, I see that now; that is the first mod function.
Well, I'm not sure if you really get the concept of absolute value of a (real) number. So I'm going over it again. If you find any steps, or explanation confusing, just don't hesitate to shout it out.
The
absolute value of a (
real) number a is defined as follow:
|a| = \left\{ \begin{array}{cl} a & \mbox{, if } a \geq 0 \\ -a & \mbox{, if } a < 0 \end{array} \right.
Or:
|a| = \left\{ \begin{array}{cl} a & \mbox{, if } a > 0 \\ -a & \mbox{, if } a \leq 0 \end{array} \right.
Since |0| = 0 = -0, so the 2 definitions are actually the same.
Since, the
former one is more common, we'll be working with it. So, if a is non-negative, then just simply keep it, i.e: |a| = a. For example: |4| = 4, |0| = 0.
If a is negative, we then take the opposite (additive inverse) of it, i.e: |a| = -a. For example: |-7| = -(-7) = 7, |-100| = -(-100) = 100.
Or, roughly speaking, the absolute value of a number is always non-negative, and is the "distance" from that number to 0 (the origin), in the real number line.
--------------
Ok, I'll give you an example:
Example:
Express the following function in piecewise form.
f(
x) = |
x - a|, for a is any real constant.
The first step of this type of questions is to solve for x, where the function(s) inside the absolute signs are 0.
x - a = 0 => x = a.
So, the breakpoint is at a.
Split it into 2 cases:
- x >= a:
When x >= a, x - a is non-negative, right? So, we have: |x - a| = x - a
- x < a:
When x < a, x - a is always negative, right? So, we have: |x - a| = -(x - a) = -x + a
So, our piecewise function is:
|f(x)| = \left\{ \begin{array}{cl} x - a & \mbox{, if } x \geq a \\ a - x & \mbox{, if } x < a \end{array} \right.
--------------
Back to your question, after finding the 2 breakpoints, namely 0, and 1. We then, split it into 3 different parts:
- x < 0:
When x < 0, x is negative, right? So |x| = -x
When x < 0, x - 1 is also negative, right? So |x - 1| = -(x - 1) = -x + 1
So, when x < 0, your function will be (without absolute signs) f(x) = |x| + |x - 1| = -x + (-x + 1) = -2x + 1
- 0 <= x < 1: (pay attention to the <= sign, it should be less than or equal, not just less than, since you should consider x = 0 as well)
This can be worked out in almost the same manner.
- x >= 1:
This part should be simple too, just follow my example. :)