I found this answer to this online firstly is it true and secondly please can you explain to me how so?
The question is what could the range be in this expression if x is any real number.
I found this answer to this online firstly is it true and secondly please can you explain to me how so?
The question is what could the range be in this expression if x is any real number.
On
So given the function $$f: \mathbb{R} \to \mathbb{R}: x \mapsto|x- 3| - |x+1|$$
what is the range of $f$?
We can rewrite this function in the following way:
$f(x) = \begin{cases} (x-3) - (x+1) = -4 \quad\quad \mathrm{if}\quad\quad 3 \leq x \\(3-x) - (x+1) = 2 - 2x \quad\quad \mathrm{if}\quad\quad -1 \leq x \leq 3\\(3-x) - (-(x+1)) = 4 \quad\quad \mathrm{if}\quad\quad x \leq -1 \end{cases}$
So we can have the values $\{-4,4\}$ for $x \in \mathbb{R}-[-1,3]$ and we have the values $\{-4,-3,-2,-1,0,1,2,3,4\}$ for $x \in (-1,3)$. Hence, the range of this expression is $\{-4,-3,-2,-1,0,1,2,3,4\}$ and the final answer is $\boxed{9}$
If $x>=3$ then the expression becomes $(x-3) - (x+1) = - 4$.
If $x<=-1$ then it becomes $(3-x)-(-x-1) = 4$.
If $-1<x<3$ then it is $(3-x)-(x+1)=2-2x$, which can take any value in $(-4,4)$.
So you are correct, there are 9 possible whole number values, from -4 to 4 inclusive.