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

I understand that the graph of a real-valued function $g$ where $g(x)=f(x-h)$ is a horizontal translation of the graph of $f$. But is this true for certain piecewise-defined functions?

In particular, I'm thinking of something like

$$ f(x) = \left\{ \begin{array}{lr} x-2, \;\;\; x≥0\\ -2x,\;\;\;\; x<0 \end{array} \right.$$

Now consider the function $g(x) = f(x + 3)$. Normally I would feel comfortable substituting $x + 3$ for $x$ in $f(x)$ to get a rule for $g$, but I'm not totally sure how to do that here. Is $g$ given by

$$ g(x) = \left\{ \begin{array}{lr} x+1, \;\;\;\;\;\;\; x≥0\\ -2x - 6,\;\;\; x<0 \end{array} \right.$$ or by $$ g(x) = \left\{ \begin{array}{lr} x+1, \;\;\;\;\;\;\; x≥-3\\ -2x - 6,\;\;\; x<3 \end{array} \right.$$ The second is a horizontal translation of $f$, but the first is not. I feel slightly queasy about substituting $x+3$ for $x$ in the intervals used in the piecewise definition in the second case above. I'm not sure why I'd be justified in doing this, though it's the only way to get the expected translation out of $g(x) = f(x + 3)$.

So, which one is correct, and why?

share|cite|improve this question
up vote 1 down vote accepted

Of course, there's nothing wrong with referring to your new function $g$ by $g(x)$, as $x$ is just a letter, but you're better off using $g(y)=f(x-a)$ for translation by $a$ to make things simpler - that way you're in no danger of getting confused about which $x$ you're talking about, which I suspect is your main problem. Then it's just a case of changing occurences of $x$ to $x-a$ in the definition of $f$:

$g(y)=f(x-a) = \left\{ \begin{array}{lr} (x-a)-2, \;\;\; x-a≥0\\ -2(x-a),\;\;\;\; x-a<0 \end{array} \right.$


$g(y)=f(x-a)= \left\{ \begin{array}{lr} x - (a+2), \;\;\; x≥a\\ 2a-2x,\;\;\;\; x<a \end{array} \right.$

In other words, it's done in exactly the same way as for functions that aren't defined in pieces. If you still feel uncomfortable about it, you can just consider $f(x)=f_{+}(x)+f_{-}(x)$, where $f_{+}$ conincides with $f$ for non-negative $x$ and is 0 elsewhere, and $f_{-}$ coincides with $f$ for negative $x$, and is 0 elsewhere, and then translate each of these functions before putting them back together to get $g$.

share|cite|improve this answer
It's not the confusion between which $x$ that was causing me trouble. It's clear to me that they're different. Without getting too much into the background of how this question came up, I was imagining translating the graph of $f$ so that each half of the plane sort of disappears under the $y$-axis as you shift left and right, and that made a weird sort of sense to me. My gut told me it was wrong though, but I couldn't figure it algebraically. I was imagining $x+3$ as the "input" of $f$, and it wasn't clear that this "input" also is substituted for $x$ in the restrictions of the domain. – Richard Sullivan Oct 18 '12 at 23:07
But I get it now. Mostly just a brainfart brought on by end of the day sloppiness. – Richard Sullivan Oct 18 '12 at 23:09

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.