# What is the fastest way to find the range of functions having modulus: $f(x) = |x+3| - |x+1| - |x-1| + |x-3|$

While solving problems I saw a question in which I was supposed to find the range of a function $$f(x) = |x+3| - |x+1| - |x-1| + |x-3|$$ I know the way in which I can take different cases of $x$ larger than $3$ and then $x$ between $3$ and $1$ and so on. But it gets a bit long as there are 5 cases and the competitive exam for which I am getting my brain ready for wants me to solve a question in average 1.5 minutes. I want to know if there exists a faster way to find its range.

• There is no particular technical. – Surb Jan 27 '16 at 14:53
• @Surb I know that there are many ways to find the range but what is faster than the way i described in my question. – manshu Jan 27 '16 at 14:55
• I think it's the best way to do it (and I don't see an other way here). – Surb Jan 27 '16 at 14:56

Let us have a look at the two parts of your function. What is $|x-3|-|x-1|$? This is the distance of $x$ from $3$ minus the distance of $x$ from $1$. Can we say what this function looks like? If $x$ is on the right of the interval $[1,3]$, then the difference is obviously $-2$. If $x$ is on the left then the difference is clearly $2$. In the interval $[1,3]$ this function changes linearly between the two values.

The following graph is taken from WolframAlpha, but if you have seen a few such functions and you keep the above interpretation (absolute value as distance) in mind, you should be able to plot this graph easily by hand. In the same way we can plot $|x+3|-|x+1|$ which looks rather similar. And you want to add these two functions together. You can simply plot both of them into the same graph. • You can see that for $x<-3$ and for $x>3$, one of the values is $2$ and the other one is $-2$. So the sum will be zero.
• On the interval $(-1,1)$ both functions have value $2$, so their sum will be $4$.
• In the two intervals inbetween the functions changes linearly, since it is a sum of two linear functions.

Here is a plot from WolframAlpha. But again you should be able to sketch the graph of this function by hand. Let $g(x) = |x+3| + |x-3|$ and $h(x) = |x+1| + |x-1|.$ Then \begin{align} g(x) &= \begin{cases} 2|x| & \text{if $|x| \geq 3$} \\ 6 & \text{if $|x| < 3$} \end{cases} \\ h(x) &= \begin{cases} 2|x| & \text{if $|x| \geq 1$} \\ 2 & \text{if $|x| < 1$} \end{cases} \\ f(x) &= g(x) - h(x) \end{align} It should then be easy to see that $f(x) = 0$ when $|x| \geq 3$ and $f(x) = 4$ when $|x| < 1$. You just then have to confirm that $0 \leq f(x) \leq 4$ when $1 \leq |x| < 3$.

In this particular example, one short-cut you could use is to notice that the function is even, so to cut down on the work you would only need to consider the set $x\geq0$ to establish the range for the whole function.