1
$\begingroup$

I am wanting to write a piecewise function for the following:

$$f(x)= \mid x+3\mid -\mid x-1\mid $$

I know how to write piecewise functions for functions that have a single set of absolute value brackets, but I don't know how to deal with two sets of brackets. A hint would be appreciated.

$\endgroup$

4 Answers 4

7
$\begingroup$

Deal with three separate cases :

  1. When $x+3\geqslant0$ and $x-1\geqslant0$.
  2. When $x+3\lt0$ and $x-1\geqslant0$.
  3. When $x+3\geqslant0$ and $x-1\lt0$.
  4. When $x+3\lt0$ and $x-1\lt0$.

Alternatively you can use a table to see the signs that are being taken by each expression inside the absolute values :

$$ \begin{array}{|c|lcccr|}\hline x & -\infty & -3 & & 1 & \infty \\ \hline x-1 &\qquad \color{green}{-} & \big| & \color{green}- & 0 & \color{red}+\qquad \\ \hline x+3 & \qquad\color{green}- & 0 & \color{red}+ & \big| & \color{red}+\qquad \\ \hline -|x-1| & \,\,\,\,\,\,\,x-1 & \big| & x-1 & \big| & -x+1\quad \\ \hline |x+3| & \,\,\,-x-3 & \big| & x+3 & \big| & x+3\quad \\ \hline \end{array} $$ From the table, if $x\in(-\infty,-3\,]$ then $f(x)=(x-1)+(-x-3)=\ldots$ if $x\in[-3,1]$ then $f(x)=(x-1)+(x+3)=\ldots$ if $x\in[1,\infty)$ then $f(x)=(-x+1)+(x+3)=\ldots$ I guess you can continue from here.

$\endgroup$
9
  • $\begingroup$ I made a similar table; according to my table, the graph is positive when x is less than -3, negative between -3 and 1, and positive when x is greater than 1. Is this correct? $\endgroup$
    – McB
    Jan 13, 2015 at 20:48
  • $\begingroup$ @McB Are you talking about the graph of $f(x)$? $\endgroup$
    – Workaholic
    Jan 13, 2015 at 20:49
  • $\begingroup$ Yes, I'm talking about the graph of $f(x)$. $\endgroup$
    – McB
    Jan 13, 2015 at 20:49
  • $\begingroup$ @McB You made a mistake. $\endgroup$
    – Workaholic
    Jan 13, 2015 at 20:52
  • $\begingroup$ Okay. So according to your table then, where is the graph positive and where is it negative? $\endgroup$
    – McB
    Jan 13, 2015 at 20:53
3
$\begingroup$

The idea is the following:

The absolute value of $y$ is given by $$|y| = \begin{cases} y&\text{if } y\geq 0\\-y&\text{if } y<0\end{cases}$$ The point is now to check when $x+3$ and $x-1$ are positive, and when they are negative.

Let us look at the case where $x-1\geq 0$ first. Then $x\geq 1$, and it trivially follows that $x+3\geq 0$ as well. So for now we can write \begin{align}f(x) = |x+3|-|x-1| &= \begin{cases} x+3-(x-1)&\text{if } x\geq 1\\\text{To be determined}&\text{otherwise }\end{cases}\\ &= \begin{cases} 4&\text{if } x\geq 1\\\text{To be determined}&\text{otherwise }\end{cases}.\end{align}

Next let's consider the case where $x+3<0$, i.e. $x<-3$ and it trivially follows that $x-1<0$ as well. We can now write

\begin{align}f(x) = |x+3|-|x-1| &= \begin{cases} 4&\text{if } x\geq 1\\-(x+3)-(-(x-1))&\text{if } x<-3\\\text{To be determined}&\text{otherwise}\end{cases}\\ &= \begin{cases} 4&\text{if } x\geq 1\\-x-3+x-1&\text{if } x<-3\\\text{To be determined}&\text{otherwise}\end{cases}\\ &=\begin{cases} 4&\text{if } x\geq 1\\-4&\text{if } x<-3\\\text{To be determined}&\text{otherwise}\end{cases}.\end{align}

Lastly, we should consider the case where $-3 \leq x<1$. Then $x+3\geq 0$ and $x-1<0$, so finally \begin{align}f(x) = |x+3|-|x-1| &= \begin{cases} 4&\text{if } x\geq 1\\x+3-(-(x-1))&\text{if } -3\leq x < 1\\-4&\text{if }x<-3\end{cases}\\ &=\begin{cases} 4&\text{if } x\geq 1\\x+3+x-1&\text{if } -3\leq x < 1\\-4&\text{if }x<-3\end{cases}\\ &=\begin{cases} 4&\text{if } x\geq 1\\2x+2&\text{if } -3\leq x < 1\\-4&\text{if }x<-3\end{cases}. \end{align} And that is the final result.

$\endgroup$
2
$\begingroup$

HINT:Split the function into 3 intervals,$(-\infty,-3],(-3,1],(1,+\infty)$

$\endgroup$
0
$\begingroup$

know that in every segment, the graph of $f$ is a line. you only need to know the $x$ values where the graph has a cusp. that happens at the critical numbers $3$ and $1$ now take one point to the left of the smallest and one to right of the largest critical numbers. evaluate the function at these points and join them by straight line segments.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .