Why does adding to the x variable move the graph LEFT?
There is a phenomenon that often confuses early math students. Consider any function \(y = f(x)\), which means that we label the input-values as x and the output-values as y. We start by just drawing any random graph of a function.
Graph of an arbitrary function, \(y=f(x)\).
We often learn that if you add anything to the output, you shift the graph by that much. For example, the function
$$ y = f(x)+1 $$
is the function shifted up (vertically) by 1. Its graph is shown to the right.
Red: \(y = f(x)\). Black: \(y = f(x)+1\).
Likewise we can multiply the output by 2 and scale the vertical values by 2. This is shown to the right.
Notice that when the red curve touches the x-axis, the y-values are 0. At these points, the purple curve also has y-coordinate 0 because they are determined by computing \(2\cdot 0 = 0\). This is just a small note to help understand why the graph looks the way it does.
Red: \(y = f(x)\). Purple: \(y = 2f(x)\).
But here’s the hitch
But it seems like the logic runs precisely in reverse when we do the corresponding manipulations to the input variable. Why?
To the right of this text is a graph of
$$y = f(x+1)$$
The red (original) curve is shifted left, shown in blue.
Then to the right that graph is the graph of
$$ y = f(2x)$$
which is contracted horizontally, rather than expanded, by a factor of 2.
Blue: \(y=f(x+1)\).
Green: \(y = f(2x)\).
So Why?
Well the first thing I want to point out is that, in fact,
There is no difference between the rule for the input and output variables!
It seems like the rule for the output is: It goes the way you’d think. And it seems like the rule for the output is: It goes the opposite of the way you’d think. So it seems like the rules are different, no?
Well, in fact, it only looks different because you’re actually subtly doing different operations in the two cases.
Notice that when you shift the function up, with
$$ y = f(x)+1 $$
you are not adding 1 to y. Instead you are adding 1 to the other side of the equation.
If you directly add 1 to the y variable, you would write
$$ y+1 = f(x) $$
which is equivalent to
$$ y = f(x)-1 $$
which is a downward shift!
So what this demonstrates is in fact, for both the input and the output variables, performing an operation directly on that variable causes the inverse manipulation.
Adding 1 to x causes a shift right.
Adding 1 to y causes a shift down.
Multiplying 2 to x causes a horizontal contraction by 2.
Multiplying 2 to y causes a vertical contraction by 2.
So I hope that I have convinced you of a first point in my explanation: There is no difference in the way that the rules work for the two variables. They both work the same way.
Ok, but that still doesn’t answer Why!
Yes, yes, you’re right, I’ve only explained why they share the same rule.
But this doesn’t explain why any operations should, intuitively, cause the inverse of what you would expect.
Why is it that adding 1 to x (or y) should cause a horizontal (or vertical) shift left (or down)?
I want to propose that in fact there are two ways to think about shifting the graph of a function:
You could grab the graph, lift it out of the graph paper, and move it wherever you want.
You could grab the graph, lift it out of the graph paper, and move the paper wherever you want.
The first one makes the most intuitive sense.
But when you add 1 to the x variable, it’s really the second one that you’re doing.
Before explaining why adding 1 to x is actually shifting the graph paper, rather than the graph, first just appreciate how this — if correct — would explain the apparent inversion. Imagine holding the graph still but shifting the paper right by 1. Relatively speaking, the graph appears to shift left by 1.
Adding 1 to x shifts the paper to the right by 1
Let’s now think carefully about exactly what the function given by \(y = f(x+1)\) is, relative to the function given by \( y = f(x)\).
Try plugging in 0 for x in \(y = f(x+1)\). What you get is \(y=f(0+1) = f(1)\). So what you get is the value that you would have gotten if you had plugged in 1 into \(y = f(x)\).
Try plugging in 1 for x in \(y = f(x+1)\). What you get is \(y = f(1+1)=f(2)\). So what you get is the value that you would have gotten if you had plugged in 2 into \(y = f(x)\).
An so on.
In general, what seems to be happening when we plug in a value into \(y = f(x+1)\) is
We are plugging into \(y = f(x)\) the value that is 1 to the right.
That is to say, the inputs themselves (i.e. the graph paper) has shifted right, not the graph of the function.
Try it yourself!
Now that I’ve explained why this works for adding 1 to x, you should imagine how this also works for many other variations.
Adding 1 to y shifts the graph paper up, and therefore relatively, the graph appears shifted down.
Multiplying the x by 2 expands the graph paper horizontally and therefore relatively, the graph appears contracted horizontally.
Multiplying the y by 2 expands the graph paper vertically and therefore relatively, the graph appears contracted vertically.
An important application of this idea: Circles and ellipses
At some point you hopefully have before, or will soon, see the equation of a (unit) circle (centered at the origin). It is the equation below.
$$ x^2+y^2 = 1 $$
Suppose that we would like to shift this right by 2. Using our understanding above, it now becomes utterly clear that subtracting 2 from x will accomplish the effect.
$$ (x-2)^2 + y^2 = 1 $$
Moreover, because the x and y variables obey the same rules, if we want to shift the circle down by 3 we can add 3 to y.
$$ (x-2)^2+(y+3)^2 = 1$$
Now the circle is centered at (2, -3)!
Moreover, if we want to stretch just the x variable, we can multiply just the x variable to accomplish this effect!
Say that we want to stretch the graph paper horizontally by 2. Notice that this would contract the circle (the graph) horizontally by a factor of 2.
Algebraically, this is represented by the following manipulation, applied to the most recent circle equation that we wrote down.
$$ (2x-2)^2+(y+3)^2 = 1 $$
How can we see the horizontal contraction in this?
We could factor out the 2:
$$ (2[x-1])^2 + (y+3)^2 = 1 $$
$$ 4 (x-1)^2 + (y+3)^2 = 1 $$
$$ \frac{(x-1)^2}{1/4} + (y+3)^2 = 1$$
Now at this point, if you’ve ever seen the equation of an ellipse, you’ll recognize that this equation has the form of an ellipse! Just as one would expect, if we are contracting the shape along the x-axis!
If you have never seen the equation of an ellipse, I believe you will soon — and now you’ll have a certain intuitive and geometric understanding of why it is the way that it is!