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

Graphing absolute value functions

We can graph any absolute value equation of the form y=k|x-a|+h by thinking about function transformations (horizontal shifts, vertical shifts, reflections, and scalings).

Want to join the conversation?

  • blobby green style avatar for user Prince Lawrence
    What if there is a number in front of X?(inside the absolute value bars)
    (27 votes)
    Default Khan Academy avatar avatar for user
    • blobby green style avatar for user mridu
      if f(x)=|x+3|, we know that the graph need be shifted 3 units to the left of the origin. this was obtained by equating x+3 to 0, which gives us x= -3. plugging x=-3 in f(x),
      f(x)=|-3+3|=0.
      this is the vertex of the graph; the point(-3,0) at which the value of y is least.
      if our f(x), for example, were to equal |2x+3|,
      doing 2x+3=0 would give x=-3/2.
      now, the vertex of the graph of our new f(x) would be (-3/2,0)
      (20 votes)
  • blobby green style avatar for user a person
    What if the +2 outside of the absolute value bars is a -2?
    (9 votes)
    Default Khan Academy avatar avatar for user
  • duskpin ultimate style avatar for user Hello
    Why does the graph get shifted to the left if the value inside the absolute value brackets is positive like if the equation is:

    Y = |x+4|

    Why does the function get shifted four to the left? Doesn’t that seem a bit counterintuitive and wrong? I know Sal has explained this multiple times in different videos. But i just don’t understand why. Could someone please explain this to me?
    (6 votes)
    Default Khan Academy avatar avatar for user
    • mr pink green style avatar for user David Severin
      There are several ways I look at it. Lets do y=|x+4|+3. We can see this moves 4 units to the left and 3 up. Let's subtract 3 to get y-3=|x+4| which is the equivalent equation. Note that now both x and y do the opposite of what we might "expect," y is 3 units up and x is 4 units to the left. The other idea is to think about it like "moving the zero" even though we do not actually do this. If we choose x=4, we end up moving the 0 4+4=8 units, but if we choose x=-4, we end up with the new -4+4=0. Think also of a circle (x-h)^2+(y-k)^2=r^2, in both cases, you have to change to signs of x and y to "move the 0." You are not the first to see it as counterintuitive, but that should not lead to the conclusion that it is wrong. This may not be very satisfying to you.
      (7 votes)
  • blobby green style avatar for user Silvana Siddiqui
    I am not understanding how to do stretching by factors
    (9 votes)
    Default Khan Academy avatar avatar for user
    • leaf green style avatar for user Nikolay
      As I've posted before many times, have you done linear equations before?

      In y = 2x, the slope is 2. For every x, we get a y that is twice as large. This causes the line to be quite steep; having a fraction makes the line less steep.

      Same thing here. y = 2|x| means that for every x, y is twice as large. The V-shape is compressed. However, y=1/2|x| would be stretched out.
      (0 votes)
  • male robot hal style avatar for user Mohammad
    what if we're taking the absolute value of 2-x?
    (4 votes)
    Default Khan Academy avatar avatar for user
  • hopper cool style avatar for user yunandarphyoe2004
    I really want to know where this function is used in real life
    (1 vote)
    Default Khan Academy avatar avatar for user
    • piceratops ultimate style avatar for user Lincoln Earley
      Tell me. When you do, for example, pushups, are you practicing being able to get up off the ground or push a bunch of rubble off your back like spider-man? No, you're trying to gain strength in certain muscle groups that will allow you to do harder things later. Same thing goes for this kind of math. Usually the things you learn here are to prepare you for harder math. It's a way to solidify the foundations for the next bricks of learning. It's to help you think in a new way that will make future math easier and will make it more intuitive.
      Hope this helps.
      (9 votes)
  • piceratops seedling style avatar for user TheSnowyOwl9455
    Does anyone else besides me think that this video and all of Sal's Absolute Value videos are explained poorly even though he says we should now be able to see all of this intuitively? I have had to scour the internet trying to make sense of absolute value function graphs because I don't understand the way Sal explains this. He just sort of skims over the topic without enough examples to what he means. Just my take.
    (4 votes)
    Default Khan Academy avatar avatar for user
  • aqualine tree style avatar for user seun.adek2309
    Why does he shift to the left instead of the right?
    (3 votes)
    Default Khan Academy avatar avatar for user
    • stelly blue style avatar for user Kim Seidel
      The standard absolute value graph y=|x| has its vertex at (0, 0). If you want to change the point to be at (3,0), that means you are making x=3. Notice, these are on opposite sides of the "=". if you need to place them on the same side of the "=", then you would have x-3=0. This is essentially what is being done in the function. The X and 3 are are on the same side of the equation. So, we use y=|x-3| to shift to x=3.

      By contrast, if you want to shift the vertex up/down, the "y" and the value to move are on opposite sides of the equation. So, we can use the same sign we want. y=|x|+4 moves the graph up 4, and y=|x|-4 moves the graph down 4.

      Hope this isn't too confusing. It may help if you try experimenting with the equation to see how it works.
      (3 votes)
  • leafers seed style avatar for user Aaron
    In this video the teacher says when x is less than -3, it makes the value negative, and the absolute value positive, and that's why it slopes down. And when above -3 it makes the value positive, and that's why it slopes up.
    But the line does not slope down or up because of a positive or negative value inside the absolute value lines, it's because the absolute value itself is always positive in this scenario.

    The way the teacher words things is so confusing sometimes and I sit here for an hour trying to re-teach myself what he could possibly mean when he says things like this.

    The value inside the absolute value doesn't determine the direction of the line, the positive or negative of the absolute value determines in. So if y=-|x+3|, the line to the left of -3 would slope up. Right? Because the y value would then be less than 0.
    (3 votes)
    Default Khan Academy avatar avatar for user
    • stelly blue style avatar for user Kim Seidel
      Absolute value functions create V-shaped graphs.
      The minus in front of your absolute value tells you that the V-shape will open downword. So, the line to the left of -3 will slope upward toward x=-3. And it will slope down as it moves to the right of -3.
      (2 votes)
  • primosaur seed style avatar for user Hafsa Mohamed
    why did he move from the red to the orange color? I understand what he did, but the why is confusing and doesn't make sense. Get back soon. Thanks.
    (2 votes)
    Default Khan Academy avatar avatar for user

Video transcript

- [Instructor] So we're asked to graph f of x is equal to two times the absolute value of x plus three, plus two. And what they've already graphed for us, this right over here, this is the graph of y is equal to the absolute value of x. So let's do this through a series of transformations. So the next thing I wanna graph, let's see if we can graph y. Y is equal is to the absolute value of x plus three. Now in previous videos we have talked about it. If you replace your x, with an x plus three, this is going to shift your graph to the left by three. You could view this as the same thing as y is equal to the absolute value of x minus negative three. And whatever you're subtracting from this x, that is how much you are shifting it. So you're going to shift it three to the left. And we're gonna do that right now and then we're gonna just gonna confirm that it matches up. That it makes sense. So let's first graph that. Get my ruler tool here. So if we shift three to the left, it's gonna look something like... It's gonna look something like this. So on that... When whatever we have inside the absolute value sign is positive, we're going to get essentially, this slope of one. And whenever we have inside the absolute value sign is negative, we're gonna have a slope of essentially negative one. So it's going to look... It's going to look like that. And let's confirm whether this actually makes sense. Below x equals negative three, for x values less than negative three, what we're gonna have here, is this inside of the absolute value sign, is going to be negative and so then we're gonna take it's opposite value and so that makes sense. That's why you have this downward line right over here. Now for x is greater than negative three, when you add three to it, you're gonna get a positive value and so that's why you have this upward sloping line right over here. And at x equals negative three, you have zero inside the absolute value sign, just as if you didn't shift it, you would have had zero inside the absolute value sign at x equals zero. So hopefully that makes a little bit more intuitive sense of why if you replace x, if you replace x with x plus three, and this isn't just true of absolute value functions, this is true of any function, if you replace x with x plus three, you are going to shift three to the left. All right, now let's keep building. Now let's see if we can graph y is equal to two times the absolute value of x plus three. So what this is essentially going to do is multiple the slopes by a factor of two. It's going to stretch it vertically by a factor of two. So for x values greater than negative three, instead of having a slope of one, you're gonna have a slope of two. So let me get my ruler out again and see if I can draw that. So let me put that there. And then, so here instead of a slope of one, I'm gonna have a slope of two. Let me draw that. It's gonna look like that, right over there. And then instead of having a slope of negative one for values less than x equals negative three, I'm gonna have a slope of negative two. Let me draw that right over there. So that is the graph of y is equal to two times the absolute value of x plus three. And now to get to the f of x that we care about, we now need to add this two. So now I wanna graph, and we're in the home stretch, I wanna graph, y is equal to two times the absolute value of x plus three, plus two. Well whatever y value I was getting for this orange function, I now wanna add two to it. So this is just gonna shift it up vertically by two. So instead of... So this is gonna be shifted up by two. This is going to be shifted. Every point is going to shifted up by two or you can think about shifting up the entire graph by two. Here, in the orange function, whatever y value I got for the black function, I'm gonna have to get two more than that. And so it's going to look... It's going to look like this. So let me see, I'm shifting it up by two. So for x less than negative three, it'll look like that. And for x greater than negative three, it is going to look like... It is going to look like that. And there you have it. This is the graph of y or f of x is equal to two times the absolute value of x plus three, plus two. And you could've done it in different ways. You could have shifted up two first, then you could have multiplied by a factor of two, and then you could have shifted, and then, so you could have moved up two first, then you coulda multiplied by a factor of two, then you could've shifted left by three. Or could have multiplied by a factor of two first, shifted up two and then shifted over. So there's multiple, there's three transformations going up here. This is an... This is a, let me color them all. So this right over here tells me... This over here says hey, shift left. Shift left by three. This told us, stretch vertically by two. Or essentially multiply the slope by two. Stretch vert by two. And then that last piece, says shift up by two. Shift up by two, which gives us our final result for f of x.