# Piecewise functions

1. Sep 2, 2009

### Loppyfoot

1. The problem statement, all variables and given/known data
Express the function in piecewise form without using absolute values.

2. Relevant equations
g(x) = |x| + |x-1|

3. The attempt at a solution
Alright, so I can do this problem when there is only one absolute value piece, but there are two different ones; so I do not know where to begin. Are the breakpoints at 0 and 1? How do I go about generating a piece wise function when both of them are absolute values?

2. Sep 2, 2009

### Hootenanny

Staff Emeritus
As you say, there are two 'breakpoints', therefore you will need to split the domain into three sections:
1. x<0
2. 0<x<1
3. x>1

3. Sep 2, 2009

### Loppyfoot

Could you explain how you got those? I have always struggled with piecewise functions, and I want to master them. Also, how does one get the left side of the piecewise? (ie; not the inequality part)

4. Sep 2, 2009

### Hootenanny

Staff Emeritus
As you know, we only need to worry about the mod function when the argument becomes negative. So when x < 0, the arguments of both mod functions is negative. When 0 < x < 1, the argument of the first mod function is positive whilst the second is negative. Finally, when x > 1 the arguments of both mod functions are positive and we therefore don't need to worry about them any more.

5. Sep 2, 2009

### Loppyfoot

The back of my good has this;
1-2x ; x<0
1; 0<x<1
2x-1; x>1
I understand that we do not need to worry about the mod functions after the one breakpoint, but how does my book come up with the "(1-2x, 1, and 2x-1)?

Thanks

6. Sep 2, 2009

### Hootenanny

Staff Emeritus
Let's consider the case of x < 0. In this case do you agree that the argument of both mod functions is negative?

How does the presence of the mod function affect the argument if it is negative?

7. Sep 2, 2009

### Loppyfoot

Let's consider the case of x < 0. In this case do you agree that the argument of both mod functions is negative? So if x<0, wouldn't the absolute value be positive? Is this the mod function?

8. Sep 2, 2009

### Hootenanny

Staff Emeritus
The mod function is defined as follows

$$\left|x\right| = \left\{\begin{array}{lll} x & \text{for} & x \geq 0 \\ -x & \text{for} & x < 0 \end{array}\right.$$

Do you understand?

9. Sep 2, 2009

### Loppyfoot

Ok, I see that now; that is the first mod function.

10. Sep 2, 2009

### VietDao29

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:

1. x >= a:
When x >= a, x - a is non-negative, right? So, we have: |x - a| = x - a​
2. 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:

1. 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​
2. 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.​
3. x >= 1:
This part should be simple too, just follow my example. :)​

Last edited: Sep 2, 2009