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)
    (23 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)
      (15 votes)
  • blobby green style avatar for user a person
    What if the +2 outside of the absolute value bars is a -2?
    (8 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user Silvana Siddiqui
    I am not understanding how to do stretching by factors
    (6 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 Shayan
    what if we're taking the absolute value of 2-x?
    (4 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?
    (4 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.
      (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
  • starky tree style avatar for user Rishi Prabhu
    What do you do if there is a negative fraction in the absolute value. ex. |-1/2x + 3| -10?
    (1 vote)
    Default Khan Academy avatar avatar for user
    • piceratops ultimate style avatar for user Hecretary Bird
      I'll assume you're asking how to graph the equation. If you have a coefficient of x inside the absolute value sign, one thing you can do is try and isolate it a little bit, by setting it as a factor to the rest of the inside of the absolute value. If you do that to this problem, you'll get this:
      y = |(-1/2)(x - 6)| - 10
      Now you're taking the absolute value of something (x - 6) times a negative. Because absolute value doesn't care about the sign, you can effectively just remove the negative on the 1/2. Now that the equation has been simplified to y = |1/2 (x - 6)| - 10, you can get to graphing.
      For any function, if you have a coefficient inside the operation of the function (the absolute value bars in this case), it basically does the opposite of a coefficient on the outside. While a high coefficient on the outside would increase every y-value by a certain factor (vertically stretch the graph), a high coefficient on the inside would increase every x-value by a certtain factor (horizontally stretch, which makes the graph wider). Since we have a low (<1) coefficient inside the function, the graph will horizontally get squished, or vertically stretch. So our correct graph should be less steep than a normal absolute value function, and translated down and to the right.
      To actually put numbers onto this, you would lookk at your equation to get the vertex of the function (6, -10) and use the positive and negative slope to draw the two parts of the function.
      (5 votes)
  • blobby green style avatar for user Valerie Coffman
    How do I graph f(x)=-|x|
    (1 vote)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user Sosa
    How can you tell where the X or Y is increasing or decreasing?
    (2 votes)
    Default Khan Academy avatar avatar for user
    • mr pants teal style avatar for user VincentTheFrugal
      In general, you only care about the dependent variable increasing or decreasing ("y" in this case). It doesn't exactly make sense to think about the independent variable ("x") to be increasing or decreasing.

      To be able to tell if "y" is increasing or decreasing, you should look at the graph. Read the graph from left-to-right. When it goes down, it's "decreasing", when it goes up, it's "increasing".

      If you don't have access to the graph, look at the coefficient on "x" (look at the number to the left of the absolute value symbols). If that number is positive, then it opens up, and to the left of the vertex is decreasing, and to the right is increasing. If the coefficient is negative, it opens down, and the to the left of the vertex is increasing, and to the right is decreasing.
      (3 votes)

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.