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

Identifying function transformations

Sal walks through several examples of how to write g(x) implicitly in terms of f(x) when g(x) is a shift or a reflection of f(x). Created by Sal Khan.

Want to join the conversation?

  • aqualine seedling style avatar for user Destiny
    What is f(x) = |x| - 3

    The fact that x is in between the absolute value sign confuses me. I know -3 would mean that we're going to the left on the horizontal plane, is that technically it?
    (17 votes)
    Default Khan Academy avatar avatar for user
    • hopper happy style avatar for user Rashel
      f(x)=|x|-3. It's like f(x)=x-3 except the 3 is inside absolute value brackets. The only difference is that you will take the absolute value of the number you plug into x.
      Remember that x just represents an unknown number.
      To find f(x) (you can think of f(x) as being y), you need to plug a number into x.
      f(x)=|x|-3
      x=-2
      Plug -2 into x
      |-2|-3
      The absolute value of any number is positive. Thus, -2 will become 2. Then subtract. 2-3=-1.
      When x=-2 y=-1
      (-2, -1)
      (33 votes)
  • blobby green style avatar for user Ryujin Jakka
    Are there more detailed videos that focus specifically on horizontal and vertical shifting and shrinking? Thanks
    (8 votes)
    Default Khan Academy avatar avatar for user
    • aqualine ultimate style avatar for user Lauren Edwardsen
      I use this reference formula g(x)=a*f((1/b)x-h)+k
      a is for vertical stretch/compression and reflecting across the x-axis.
      b is for horizontal stretch/compression and reflecting across the y-axis. *It's 1/b because when a stretch or compression is in the brackets it uses the reciprocal aka one over that number.
      h is the horizontal shift. *It's the opposite sign because it's in the brackets.
      k is the vertical shift.
      (11 votes)
  • blobby green style avatar for user Dontay Decker
    What would the transformation do if g(x)=(x+6)^2-10 and g(x) is in absolute value bars? Like this: |g(x)|.
    (5 votes)
    Default Khan Academy avatar avatar for user
    • leaf green style avatar for user kubleeka
      Taking the absolute value of a function reflects the negative parts over the x-axis, and leaves the positive parts unchanged. So a central segment of your parabola will be reflected so that it opens downward, with sharp corners at the roots.
      (3 votes)
  • blobby green style avatar for user mdmoore37
    At , Why is it f(x-2) instead of f(x+2)? If you do minus 2, the values will get more negative, (from -3 to -5) but if you do plus two, then you would get the values of g...
    Do you normally do the opposite when going left to right?
    (6 votes)
    Default Khan Academy avatar avatar for user
  • starky seedling style avatar for user david haywood
    can some one help me?
    What happens to the graph for f(x)=x when compared to the graph f(x)=x-5?
    (2 votes)
    Default Khan Academy avatar avatar for user
    • leaf orange style avatar for user A/V
      f(x)=x is equal to f(x)=x+0, just written in a more abstract way. This is useful when comparing to another linear functions such as your example.

      f(x)=x-5 is simply just f(x)=x brought down by 5 units, hence the "-5" for the b term. I recommend using desmos for a more visual interpretation, as writing down explanations can be more convoluted.

      Hopefully that helps !
      (6 votes)
  • piceratops seed style avatar for user Ramon M
    Could anyone ennumerate all the ways a function can be transformed? Thank you!
    (3 votes)
    Default Khan Academy avatar avatar for user
  • duskpin sapling style avatar for user Alexis313
    f(x)=x,g(x)=x+1
    would the transformation of the problem be translation
    (3 votes)
    Default Khan Academy avatar avatar for user
    • female robot grace style avatar for user loumast17
      Yep, for linear functions of the form mx+b m will stretch or shrink the function (Or rotate depending on how you look at it) and b translates. Then if m is negative you can look at it as being flipped over the x axis OR the y axis.

      For all other functions, so powers, roots, logs, trig functions and everything else, here is what is hopefully an easy guide.

      a*f(b(x+c))+d

      so for example if f(x) is x^2 then the parts would be a(b(x+c))^2+d

      a will stretch the graph by a factor of a vertically. so 5*f(x) would make a point (2,3) into (2,15) and (5,7) would become (5,35)

      b will shrink the graph by a factor of 1/b horizontally, so for f(5x) a point (5,7) would become (1,3) and (10,11) would become (2,11)

      c translates left if positive and right if negative so f(x-3) would make (4,6) into (7,6) and (6,9) into (9,9)

      d translates up if positive and down if negative, so f(x)-8 would make the points (5,5) and (7,7) into (5,-3) and (7,-1)

      Also should note -a flips the graph around the x axis and -b flips the graph around the y axis. Hope I didn't over explain, just proud of what I made tbh
      (4 votes)
  • mr pants teal style avatar for user Jasmina Hasikic
    When could you use this in a real life situation?
    (2 votes)
    Default Khan Academy avatar avatar for user
    • aqualine ultimate style avatar for user Fahem Moz
      You wouldn't really use this kind of things in real life unless you are planning on to a career that involves math, which is just about everything.

      Anyways, let's say f(x) is a parabola which models a rocket's path. You could translate the function, shift it to know how the rocket's path will differ.

      That is just one example I came up with, of course there are many others.
      (5 votes)
  • starky tree style avatar for user Tim Gatchalian
    For that example of the -3g(x), how do we know if there was a vertical movement AND a x3 (multiplication)?
    (4 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user Yasmeen Sardi
    How do you know if it is a vertical or horizontal stretch or shrink?
    (2 votes)
    Default Khan Academy avatar avatar for user

Video transcript

So this red curve is the graph of f of x. And this blue curve is the graph of g of x. And I want to try to express g of x in terms of f of x. And so let's see how they're related. So we pick any x. And we could start right here at the vertex of f of x. And we see that, at least at that point, g of x is exactly 1 higher than that. So g of 2-- I could write this down-- g of 2 is equal to f of 2 plus 1. Let's see if that's true for any x. So then we can just sample over here. Let's see, f of 4 is right over here. g of 4 is one more than that. f of 6 is right here. g of 6 is 1 more than that. So it looks like if we pick any point over here-- even though there's a little bit of an optical illusion-- it looks like they get closer together. They do if you look try to find the closest distance between the two. But if you look at vertical distance you see that it stays a constant 1. So we can actually generalize this. This is true for any x. g of x is equal to f of x is equal to f of x plus 1. Let's do a few more examples of this. So right over here, here is f of x in red again, and here is g of x. And so let's say we picked x equals negative 4. This is f of negative 4. And we see g of negative 4 is 2 less than that. And we see whatever f of x is, g of x-- no matter what x we pick-- g of x seems to be exactly 2 less. g of x is exactly 2 less. So in this case, very similar to the other one, g of x is going to be equal to f of x. But instead of adding, we're going to subtract 2 from f of x. f of x minus 2. Let's do a few more examples. So here we have f of x in red again. I'll label it. f of x. And here is g of x. So let's think about it a little bit. Let's pick an arbitrary point here. Let's say we have in red here, this point right over there is the value of f of negative 3. This is negative 3. This is the point negative 3, f of 3. Now g hits that same value when x is equal to negative 1. So let's think about this. g of negative 1 is equal to f of negative 3. And we could do that with a bunch of points. We could see that g of 0, which is right there-- let me do it in a color you can see-- g of 0 is equivalent to f of negative 2. So let me write that down. g of 0 is equal to f of negative 2. We could keep doing that. We could say g of 1, which is right over here. This is 1. g of 1 is equal to f of negative 1. g of 1 is equal to f of negative 1. So I think you see the pattern here. g of whatever is equal to the function evaluated at 2 less than whatever is here. So we could say that g of x is equal to f of-- well it's going to be 2 less than x. So f of x minus 2. So this is the relationship. g of x is equal to f of x minus 2. And it's important to realize here. When I get f of x minus 2 here-- and remember the function is being evaluated, this is the input. x minus 2 is the input. When I subtract the 2, this is shifting the function to the right, which is a little bit counter-intuitive unless you go through this exercise right over here. So g of x is equal to f of x minus 2. If it was f of x plus 2 we would have actually shifted f to the left. Now let's think about this one. This one seems kind of wacky. So first of all, g of x, it almost looks like a mirror image but it looks like it's been flattened out. So let's think of it this way. Let's take the mirror image of what g of x is. So I'm going to try my best to take the mirror image of it. So let's see... It gets to about 2 there, then it gets pretty close to 1 right over there. And then it gets about right over there. So if I were to take its mirror image, it looks something like this. Its mirror image if I were to reflect it across the x-axis. It looks something like this. So this right over here we would call-- so if this is g of x, when we flip it that way, this is the negative g of x. When x equals 4, g of x looks like it's about negative 3 and 1/2. You take the negative of that, you get positive. I guess it should be closer to here-- You get positive 3 and 1/2 if you were to take the exact mirror image. So that's negative g of x. But that still doesn't get us. It looks like we actually have to triple this value for any point. And you see it here. This gets to 2, but we need to get to 6. This gets to 1, but we need to get to 3. So it looks like this red graph right over here is 3 times this graph. So this is 3 times negative g of x, which is equal to negative 3 g of x. So here we have f of x is equal to negative 3 times g of x. And if we wanted to solve for g of x, right-- g of x in terms of f of x-- we would write, dividing both sides by negative 3, g of x is equal to negative 1/3 f of x.