Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Theres a question I've been having trouble with:

$G(x)$ is the function $|x+2|+|x-2|$. Show that if $-2<x<2$ then $G(x) = 4$.

Any help would be greatly appreciated. No calculus please :D

share|cite|improve this question

For problems with absolute values, break into cases. Remember, $$|y|=\begin{cases}\hphantom{-}y & \text{if }y\geq 0,\\ -y & \text{if }y<0.\end{cases}$$ Thus, $$\begin{align*} |x+2|&=\begin{cases}\hphantom{-(}x+2 & \text{if }x+2\geq 0,\\ -(x+2) & \text{if }x+2<0\end{cases}\\\\\\ &=\begin{cases}\hphantom{-}x+2 & \text{if }x\geq -2,\\ -x-2 & \text{if }x<-2\end{cases} \end{align*}$$ and $$\begin{align*} |x-2|&=\begin{cases}\hphantom{-(}x-2 & \text{if }x-2\geq 0,\\ -(x-2) & \text{if }x-2<0\end{cases}\\\\\\ &=\begin{cases}\hphantom{-}x-2 & \text{if }x\geq 2,\\ -x+2 & \text{if }x<2.\end{cases} \end{align*}$$ Putting it all together, $$\begin{align*} G(x)&=|x+2|+|x-2|\\\\\\ &=\begin{cases} \hphantom{-}x+2+|x-2| &\text{if }x\geq -2=\begin{cases}\hphantom{-}x+2+x-2 &\text{if }x\geq -2\textbf{ and }x\geq 2,\\ \hphantom{-}x+2-x+2 &\text{if }x\geq -2\textbf{ and }x<2 \end{cases}\\\\\\\\\\\\\\\\ -x-2+|x-2| &\text{if }x< -2=\begin{cases}-x-2+x-2 &\text{if }x<-2\textbf{ and }x\geq 2,\\ -x-2-x+2 &\text{if }x<-2\textbf{ and }x<2 \end{cases} \end{cases}\\\\\\ &=\begin{cases} \hphantom{-}2x & \text{if }x\geq -2\textbf{ and }x\geq 2,\\ \hphantom{-}4 & \text{if }x\geq -2\textbf{ and }x<2,\\ -4 & \text{if }x<-2 \textbf{ and }x\geq 2\; (\color{red}{\text{impossible}}),\\ -2x & \text{if }x<-2\textbf{ and }x<2 \end{cases}\\\\\\\\\\ &=\begin{cases} \hphantom{-}2x & \text{if }x\geq 2,\\ \hphantom{-}4 & \text{if }-2\leq x<2,\\ -2x & \text{if }x<-2. \end{cases} \end{align*}$$

share|cite|improve this answer

If $x>-2$, then $x+2>0$, thus $|x+2|=x+2$.

Likewise, if $x<2$, then $x-2<0$, thus $|x-2| = -(x-2) = 2-x$.

Thus, for $-2<x<2$ we have $|x+2|+|x-2| = x+2+2-x = 4$.

share|cite|improve this answer

The graph of $x \mapsto |x + 2|$ is a vee-shape that touches the $x$ axis at $x = -2$ and then goes up with a gradient of 1 from there. The graph of $x \mapsto |x - 2|$ is a vee-shape that touches the $x$ axis at $x = 2$ and to the left of that has a gradient of $-1$. So when you add them together, the gradients (between $-2$ and $2$) will cancel out and you'll get a flat line, i.e. a constant function. It's now only necessary to work out how high up the flat line is – but just work out what it is for any value of $x$ ($x = 2$ is good) and the flat line must be at that height all the way across.

share|cite|improve this answer

Draw a number line. In general, $|x-a|$ is the distance from $x$ to $a$. So $|x-2|$ is the distance from $x$ to $2$. And $|x+2|=|x-(-2)|$ is the distance from $x$ to $-2$.

Thus $|x+2|+|x+2|$ is the sum of the distances from $x$ to $-2$ and to $2$. If $x$ is anywhere in the interval $=2\le x\le 2$, the sum of its distances from $-2$ and $2$ is always equal to the distance between $-2$ and $2$, which is $4$.

A more informal way of seeing it is to suppose that you are standing on the number line at $-2$, and start walking slowly to the right. At the beginning, the sum of your distances from $-2$ and $2$ is $4$. For every tiny step $s$ that you take, your distance from $-2$ increases by $s$. But your distance from $2$ decreases by $s$, so the sum of your distances from $-2$ and $2$ does not change. This continues until you reach $2$, at which point the sum of your distances from $-2$ and $2$ starts to increase.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.