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

Graphs of logarithmic functions

The graph of y=log base 2 of x looks like a curve that increases at an ever-decreasing rate as x gets larger. It becomes very negative as x approaches 0 from the right. The graph of y=-log base 2 of x is the same as the first graph, but flipped over the x-axis. The graph of y=-log base 2 of (x+2) is the same as the first graph, but shifted to the left by 2. Created by Sal Khan.

Want to join the conversation?

Video transcript

Voiceover:We have a graph right over here, and we have 4 potential function definitions for that graph. What you might want to do is pause the video right now and think about which of these function definitions are actually being depicted in this graph right over here? I'm assuming you've given a go at it. Now let's work through it together. Before we even address these, we all see that they all have a log base 2 in the function definition. Let's just remind ourselves what y equals log base 2 of x even looks like, and then we could think about what happens if we were to add 1 or subtract 1 from it, or if we were to shift it a little bit. Let's just think about some interesting values here. Let's think about some interesting values. Let's think about what happens. We'll have x and y. Let's think about when x is equal to 2. I picked 2 because if x is equal to 2, you're saying log base 2 of 2, what power do I have to raise 2 to to get to 2? We'll have to raise it to the 1st power. What about when x is equal to ... Actually, let me do several of them. Let's do an x is equal to 8. Log base 2 of 8 is 3. I raise 2 to the 3rd power. I get 8. Let's do 4. Log base 2 of 4 is 2. 2 to the 2nd power is equal to 4. Let's do 2, where we started off with. That log base 2 of 2 is going to be 1. 2 to the 1st power is equal to 2. Now let's think about when x is equal to 1. We'd have to raise 2 too to get to 1. Well, I raise it to the 0th power. 2 to the 0th power is equal to 1. Now let's think about how we would get to 1/2. What do I have to raise 2 to to get to 1/2? 2 to the negative 1 power is going to be equal to 1/2, and I can keep going. What about 1/4? That's 2 to the negative 2 power is 1/4. I could go to 1/8. 2 to the negative 3 power is equal to 1/8. Now let's just graph some of these points. When x is equal to 8, y is equal to 3. When x is equal to 4, y is equal to 2. When x is equal to 2, y is equal to 1. When x is equal to 1, y is equal to 0. I think you see the general shape already forming. When x is 1/2, y is negative 1. When x is 1/4, y is negative 2. I think you see where this is going. When x is 1/8, y is negative 3. See, you have a graph that looks something like this. It looks something like this. I'm just connecting the dots. This is the behavior that we would expect. As x becomes really, really, really large, you think about what power do I have to raise 2 to, 2 to to get that x? Well, it's going to increase, but it's going to increase at an ever-decreasing rate. Then we see that as x approaches 0 from the right, to get closer and closer to 0, you have to raise 2 to more and more and more negative values, so the log, as we approach 0, it becomes very, very, very, very, very negative. We could never quite get to x equals 0. If you put an actual 0 right over here, what power would you have to raise 2 to to get to 0? Well, you can't. You could get close to 0 by raising 2 to a very, a very, very, very negative a very, very, very negative value, and this thing right over here is not going to be even defined for negative, for any, for non-positive x's. That's why we have it not defined for anything less than or equal to 0. This domain right over here is only for positive x's. That's log base 2 of x. How is this thing right over here, how does this thing right over here look different? Well, the obvious thing that jumps out at me is that it's flipped over the x-axis, so that's a pretty good sign that this is going ... we're going to have a negative log base 2 of x. Let's actually now graph. Let's graph that. What's y is equal to negative log base 2 of x going to look like? Each of these points, we're just going to flip it over, we're just going to flip it over the x-axis, so we're going to go there. We're going to go there. We're going to go there, and then this, this is going to go through that point right over here, and then let's see, instead of it 1/2, it's going to be like this. y equals negative log base 2 of x is going to look something like this. Let me see if I can draw it neatly. It's going to look something like this, something like this. We're getting close to the blue graph. That's y equals negative log base 2 of x. What's the difference between the green graph and the blue graph? If you look carefully, you see, you see that the blue graph is essentially the green graph shifted to the left by 2, shifted to the left. We've shifted it to the left by 2. At every one of these points, we have shifted to the left by 2. How do you shift to the left by 2? You would replace the x with an x plus 2. You would replace the x with an x plus 2. One way to think about it is in the original negative log base 2 of x, we see this asymptote at x equals 0. Now we're going to see the asymptote when this whole expression, x plus 2 is equal to 0, x plus 2 is equal to 0 when x is equal to negative 2. When x is equal to negative 2, you see the asymptote right over there. I encourage you, you could try values out if you like. You could essentially take all of these values. You could take all of these values and subtract 2 from them, and then when you add 2, you're going to get back to these values. If you shift to the left by 2, that's like replacing the x with an x plus 2. This is what is being graphed. Once again, try out the values if you don't believe me.