TITLE: What is the fastest way to find the range of functions having modulus: $f(x) = |x+3| - |x+1| - |x-1| + |x-3|$
QUESTION [6 upvotes]: 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.

REPLY [3 votes]: 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$.