If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

Shifting functions introduction

The graph of y=f(x)+k (where k is a real number) is the same as the graph of y=f(x) only it's shifted up (when k>0) or down (when k<0). Similarly, the graph of y=f(x-h) (where h is a real number) is the same as the graph of y=f(x) only it's shifted to the right (when h>0) or to the left (when h<0).

Want to join the conversation?

  • orange juice squid orange style avatar for user Katie
    At , I am still confused about the explanation of why the graph shifted to right when we subtracted from x. I know this rule, but I still am not sure why this occurs! Like, is there a reason why it goes the opposite way?
    (27 votes)
    Default Khan Academy avatar avatar for user
    • duskpin ultimate style avatar for user Aditya Pawar
      When f(x)=y is defined as x^2 then for each x-value f will be its square but when we subtract 1 from x and then square it, then for each x value the y-value will be (x-1)^2.... in a simple manner, when y=x^2, y=0 when x=0 and y=1 when x=1, but when y=(x-1)^2, y=0 when x=1 and y=1 when x=2......therefore the graph appears to shift that many units added to the left... to shift a function up or down it should be of the form: f(x)+h where h is an integer. But when to shift a function towards left or right is should be of the form f(x+h) when h>0 the function shifts towards the left and when h<0 the function shifts towards the left.
      (19 votes)
  • blobby green style avatar for user Bharaneesh Sampath
    Hello every one, still now i can't understand that the graph shifted to right when we subtracted from x,is there a reason why it goes the opposite way?

    can any one explain with an example?
    (6 votes)
    Default Khan Academy avatar avatar for user
    • primosaur seed style avatar for user Ian Pulizzotto
      Suppose we have a graph of a function f(x) that passes through the point (2, 9), so f(2) = 9. We then shift this graph 3 units to the right to form the graph of a new function g(x). This new graph passes through the point (5, 9), so g(5) = 9. Because f(2) = 9, we need to compensate for adding the 3 by defining g(x) = f(x-3), so that g(5) = f(2) = 9. Note that if we had instead used g(x) = f(x+3), then g(5) would equal f(8), which may or may not equal 9.

      In short: because we shifted 3 units to the right, we need to subtract 3 from the new x-coordinate in order to achieve the same y-coordinate.
      (24 votes)
  • duskpin ultimate style avatar for user victoriamathew12345
    When you have a negative value for x, the graph moves to the right and vice versa, but why does this not apply to the vertical direction?
    (3 votes)
    Default Khan Academy avatar avatar for user
    • piceratops ultimate style avatar for user Hecretary Bird
      You should really take a look at some of the answers to similar questions here, they can really help.
      Basically, the reason we have to write the reverse for x-transformations but write the positive for up and negative for down in the vertical direction is because we express functions in terms of y.
      If you want to increase y by 1 (move the function up by 1), all you have to do is add 1 to every value of the function (tacking a +1 onto the end of the right side of the equation). If you want to transform horizontally, you can't directly just add a +1 to the other side of x as we don't have the function in terms of x. You'll have to manipulate it a bit to get it in terms of x - see this example.
      y = 2x^2
      x = +/- sqrt(y/2)
      Now that we have our function, to move it right 1 we just add 1 to the right side, but then we have to make this equation in terms of y again:
      x = +/- sqrt(y/2) + 1
      (x - 1)^2 = y/2
      y = 2(x - 1)^2
      As you can see, trying to shift the function to the right by 1 means that in the y= form, we do the opposite and subtract from x.
      (11 votes)
  • blobby green style avatar for user ERG
    So in general, this is just vertex form?
    (7 votes)
    Default Khan Academy avatar avatar for user
  • leaf green style avatar for user adhisivaraman
    How do i type an absolute value in desmos?
    (5 votes)
    Default Khan Academy avatar avatar for user
  • leaf blue style avatar for user cy133d
    Just addressing two questions that appeared a lot.

    Some people are confused why the graph shifted to the right when you subtracted from x (@ ).

    So we have (x-1)^2 + k.
    What value of x will make (x-1)^2 equal to zero?
    In other words, what value of x will make the expression equal to k?
    When x = 1, (x-1)^2 is zero, or (x-1)^2 + k is equal to 'k'.
    The answer, 1, is positive, so the graph shifted to the right instead of the left.

    Likewise, if you have (x+1)^2 + k, the value of 'x' would be -1. Since the answer (-1) is negative, the graph would shift to the left.

    Another question I noticed was: Why does the graph go up when k is positive
    (@ )?
    When k is a positive number, it is being added, so the graph moves up. When k is a negative number, it is being subtracted, therefore the graph shifts down.

    Hope this helps.
    (5 votes)
    Default Khan Academy avatar avatar for user
  • aqualine ultimate style avatar for user fdq09eca
    suppose f(x) = mx + c
    given b > 0
    f(x + b) = m(x+b) + c = mx + mb +c
    i do not see how it shifts f(x+b) left but not upward.
    (2 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user gracerodriguez704
    how are linear functions shifted if there's no vertex? or even any non-quadratic function.
    (3 votes)
    Default Khan Academy avatar avatar for user
    • mr pink green style avatar for user David Severin
      You can still shift the (0,0) point with transformations. If you have y=x+5, that shifts the parent function up 5. If you have y=-3x-4, it shifts down 4 with the same slope. For any function, you end up shifting point by point, so any one can be shifted.
      (3 votes)
  • aqualine ultimate style avatar for user Ru
    What is the reason for the graph being curved or with an angle? And do the graphs shown here go to infinity?
    (3 votes)
    Default Khan Academy avatar avatar for user
    • male robot donald style avatar for user Venkata
      They do go to infinity, as an infinite number of inputs will give you an infinity amount of outputs. But, note that unlike some other curves, this curve is defined for all values of the input (whatever value you plug in, you're bound to get a finite value)

      There's also a different kind of "curve going to infinity". For example, if the function is y = 1/x, this isn't defined for x =0, as you'll get 1/0. So, if you graph it out, you'll see that here too, it'll go onto infinity. But unlike the previous example (where every point had an output), 1/x doesn't have an output at x = 0 and hence, there exists an *asymptote* at x = 0.
      (2 votes)
  • aqualine ultimate style avatar for user Th3 Algpha King
    I am confused about & . Is K related to Y? Also why does (x-1)^2 or (x+1)^2 change the x?
    (2 votes)
    Default Khan Academy avatar avatar for user
    • leaf yellow style avatar for user SP
      No, k is not related to Y. k is just an independent variable that you could change, which affects the equation's location.

      I thought his explanation was pretty valid -- when x = 0, x^2 is 0, but when you add 1 or -1 to that, that becomes 1 or -1 ^2, which does not output 0, therefore moving it.
      (4 votes)

Video transcript

- [Instructor] So I am here at desmos.com, which is an online graphing calculator, and the goal of this video is to explore how shifts in functions happen. How do things shift to the right or left or how do they shift up and down? And what we're going to start off doing is just graph a plain vanilla function, f of x is equal to x squared. That looks as we would expect it to look, but now let's think about how we can shift it up or down. Well one thought is, well, to shift it up, we just have to make the value of f of x higher so we can add a value, and that does look like it shifted it up by one. Whatever f of x was before, we're now adding one to it so it shifts the graph up by one, that's pretty intuitive. If we subtract one, or actually, let's subtract three. Notice, it shifted it down. The vertex was right over here at zero, zero. Now it is at zero, negative three, so it shifted it down. And we can set up a slider here to make that a little bit clearer, so if I just replace this with, if I just replace this with the variable k, then let me delete this little thing here, that little subscript thing that happened. Then we can add a slider k here, and this is just allowing us to set what k is equal to, so here, k is equal to one, so this is x squared plus one, and notice, we have shifted up, and if we increase the value of k, notice how it shifts the graph up, and as we decrease the value of k, if k is zero, we're back where our vertex is right at the origin, and as we decrease the value of k, it shifts our graph down. And that's pretty intuitive, 'cause we're adding or subtracting that amount to x squared so it changes, we could say the y value, it shifts it up or down. But how do we shift to the left or to the right? So what's interesting here is to shift to the left or the right, we can replace our x with an x minus something, so let's see how that might work. So I'm gonna replace our x with an x minus, let's replace it with an x minus one. What do you think is going to happen? Do you think that's going to shift it one to the right or one to the left? So let's just put the one in. Well, that's interesting. Before, our vertex was at zero, zero. Now our vertex is at one, zero. So by replacing our x with an x minus one, we actually shifted one to the right. Now why does that make sense? Well, one way to think about it, before we put this x, before we replaced our x with an x minus one, the vertex was when we were squaring zero. Now, in order to square zero, squaring zero happens when x is equal to one. When x is equal to one, you do one minus one, you get zero, and then that's when you are squaring zero. So it makes sense that you have a similar behavior of the graph at the vertex now when x equals one as before you had when x equals zero. And to see how this can be generalized, let's put another variable here and let's add a slider for h. And then we can see that when h is zero and k is zero, our function is really then just x squared, and then if h increases, we are replacing our x with x minus a larger value. That's shifting to the right and that is, as h decreases, as it becomes negative, that shifts to the left. Now right here, h is equal to negative five. You typically won't see x minus negative five. You would see that written as x plus five, so if you replace your x's with an x plus five, that actually shifts everything five units to the left. And of course, we can shift both of them together, like this. So here, we're shifting it up, and then we are, we could get back to our neutral horizontal shift and then we can shift it to the right like that. And everything we did just now is with the x squared function as our core function, but you could do it with all sorts of functions. You could do it with an absolute value function. Let's do absolute value, that's always a fun one. So instead of squaring all this business, let's have an absolute value here. So I'm gonna put an absolute, whoops. Absolute value, and there you have it. You can start at, let me make both of these variables equal to zero, so that would just be the graph of f of x is equal to the absolute value of x. But let's say you wanted to shift it so that this point right over here that's at the origin is at the point negative five, negative five, which is right over there. So what you would do is you would replace your x with x plus five, or you would make this h variable to negative five right over here, 'cause notice, if you replace your h with a negative five, inside the absolute value, you would have an x plus five, and then if you want to shift it down, you just reduce the value of k, and if you want to shift it down by five, you reduce it by five, and you could get something like that. So I encourage you, go to desmos.com. Try this out for yourself, and really play around with these functions to give yourself an intuition of how things and why things shift up or down when you add a constant, and why things shift to the left or the right when you replace your x's with an x minus, in this case, an x minus h, but it really could be x minus some type of a constant.