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 logarithmic functions (example 1)

We can graph y=2log₂(-x-3) by viewing it as a transformation of y=log₂(x).

Want to join the conversation?

  • blobby green style avatar for user Mohammed Qadir
    What is the use of changing y=2log₂(-x-3) to y=2log₂(-(x+3)) ? Even shifting graph by 3 to the left doesn't really make a sense to me, cuz y=2log₂(-(x+3)) should end up in the previous form y=2log₂(-x-3) and then we should have shifted by 3 to the right instead ... I don't know but I am stuck :(
    (25 votes)
    Default Khan Academy avatar avatar for user
    • leafers tree style avatar for user Robert
      It's easier to understand by first looking at a simpler transformation. If you have y=x^2, and you shift to y=(x-3)^2, you've shifted the graph three to the right. Why? For y=x^2, when x=0, y=0. For y=(x-3)^2, where does y=0? At x=3. I.e., in the new graph, the old vertex (which was at x=0) is now at x=3, hence the graph has shifted 3 to the right. Similar principle in this video's equations -- we now have to change x to '-3' to get the same result as when x was '0' before, so the new function has moved over 3 to the left. It's easiest to see that when it's written -(x+3) rather than (-x-3). -(x+3) is also better because it more clearly displays the horizontal transformation that's taking place by pulling out that -, since -(x...) represents a horizontal transformation.
      (15 votes)
  • leaf orange style avatar for user Brendan
    Should a negative always be factored out when both the x and a constant are negative such as in: (-x-3) to -(x+3) to help with a transformation?
    What about:
    (-x+3) to -(x-3) or
    (x-3) to -(-x+3) or
    (x+3) to -(-x-3)
    (6 votes)
    Default Khan Academy avatar avatar for user
    • leaf orange style avatar for user Brendan
      I played about with demos graphing calculator and basically the answer to my own question is: we dont want the x to be negative if we want to assume the correct shifting behavior. Meaning, (x+3) is a shift to the left 3 or (x-3) is a shift to the right three but having the negative on the x such as (-x+3) does the opposite of what we should expect (this shifts the graph to the right 3), Thus (-x+3) or (-x-3) the negative should be factored out to assume regular behavior.
      (24 votes)
  • hopper cool style avatar for user Garfield
    At around , Sal says that the function moves 3 to the left. Why? It doesn't really make sense to me because it is in the form of -(x+3). I get that you need to shift 3 to the left but isn't there a negative sign at the front? Doesn't that have any influence on the shifting? I'm very confused.
    (8 votes)
    Default Khan Academy avatar avatar for user
    • leaf red style avatar for user Ritika Gurjar
      The -(x+3) is done so that it equals (-x-3) in the equation. Trying to graph (-x-3) will not work, because the negative sign in front of the x stops us from making any transformations. Think about it as g(x) = f(-(x+3)). If we just look at the negative part, as in g(x) = f(-x), the graph will get flipped over the x axis. If we look at the other half, so g(x) = f(x+3), and we take x as 5, then g(5) = g(8). In this way, if you map it out, the entire graph is shifted left. Both of these transformations result in f(-(x+3)). Let me know if you have further questions!
      (7 votes)
  • leaf blue style avatar for user Smit
    I got lost about when Sal started talking about -(x+3) x--3 and he says that moves the graph to the left. I thought negative numbers moved the graph to the right?
    (7 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user Alex Lee
    Why does Sal say at that the y values in y = log_2(-x) are the same as when the x values were positive? He then says that the "log base two of the negative of negative four, well that's still log base two of four, so that's still going to be two", and he doesn't say where the second negative came from.
    (3 votes)
    Default Khan Academy avatar avatar for user
  • female robot grace style avatar for user StudyBuddy
    Does it matter what order I pick apart my function in? Like, if I did the times 2 first and then the -x and then shifted 3 units to the left?
    (2 votes)
    Default Khan Academy avatar avatar for user
  • cacteye blue style avatar for user Naik Aiden
    If I have an equation like: -2log₂(x+3), Should I reflect the graph over the x axis first (because of the negative sign), or multiply my y values first, or multiple my y values by negative 2? Can someone please explain this transformation to me, I'm very confused.

    Thank You!
    (2 votes)
    Default Khan Academy avatar avatar for user
    • starky ultimate style avatar for user KLaudano
      All three options will give the same end result because of the commutative property of multiplication. So, reflecting the graph and multiplying by 2, multiplying by 2 and reflecting the graph, or multiplying by -2 are all valid.
      (3 votes)
  • blobby green style avatar for user alicebir28
    he forget the apply reflective transformation which is indeed when there is a "minus" in front of (x+3) variable.
    (2 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user Anthony
    can you pls do a video on how to do y=-2log2x+4
    (2 votes)
    Default Khan Academy avatar avatar for user
  • duskpin ultimate style avatar for user P,
    Any aswer to the previous question?
    (2 votes)
    Default Khan Academy avatar avatar for user

Video transcript

- [Instructor] We are told the graph of y is equal to log base two of x is shown below, and they say graph y is equal to two log base two of negative x minus three. So pause this video and have a go at it. The way to think about it is that this second equation that we wanna graph is really based on this first equation through a series of transformations. So I encourage you to take some graph paper out and sketch how those transformations would affect our original graph to get to where we need to go. All right, now let's do this together. So what we already have graphed, I'll just write it in purple, is y is equal to log base two of x. Now the difference between what I just wrote in purple and where we wanna go is in the first case we don't multiply anything times our log base two of x, while in our end goal we multiply by two. In our first situation, we just have log base two of x while in here we have log base two of negative x minus three. And in fact we could even view that as it's the negative of x plus three. So what we could do is try to keep changing this equation and that's going to transform its graph until we get to our goal. So maybe the first thing we might want to do is let's replace our x with a negative x. So let's try to graph y is equal to log base two of negative x. In other videos we've talked about what transformation would go on there, but we can intuit through it as well. Now whatever value y would have taken on at a given x-value, so for example when x equals four log base two of four is two, now that will happen at negative four. So log base two of the negative of negative four, well that's still log base two of four, so that's still going to be two. And if you were to put in let's say a, whatever was happening at one before, log base two of one is zero, but now that's going to happen at negative one 'cause you take the negative of negative one, you're gonna get a one over here, so log base two of one is zero. And so similarly when you had at x equals eight you got to three, now that's going to happen at x equals negative eight we are going to be at three. And so the graph is going to look something like what I am graphing right over here. All right, fair enough. Now the next thing we might wanna do is hey let's replace this x with an x plus three, 'cause that'll get us at least, in terms of what we're taking the log of, pretty close to our original equation. So now let's think about y is equal to log base two of, and actually I should put parentheses in that previous one just so it's clear, so log base two of not just the negative of x, but we're going to replace x with x plus three. Now what happens if you replace x with an x plus three? Or you could even view x plus three as the same thing as x minus negative three. Well we've seen in multiple examples that when you replace x with an x plus three that will shift your entire graph three to the left. So this shifts, shifts three to the left. If it was an x minus three in here, you would should three to the right. So how do we shift three to the left? Well when the point where we used to hit zero are now going to happen three to the left of that. So we used to hit it at x equals negative one, now it's going to happen at x equals negative four. The point at which y is equal to two, instead of happening at x equals negative four, is now going to happen three to the left of that which is x equals negative seven, so it's going to be right over there. And the point at which the graph goes down to infinity, that was happening as x approaches zero, now that's going to happen as x approaches three to the left of that, as x approaches negative three, so I could draw a little dotted line right over here to show that as x approaches that our graph is going to approach zero. So our graph's gonna look something, something like this, like this, this is all hand-drawn so it's not perfectly drawn but we're awfully close. Now to get from where we are to our goal, we just have to multiply the right hand side by two. So now let's graph y, not two, let's graph y is equal to two log base two of negative of x plus three, which is the exact same goal as we had before, I've just factored out the negative to help with our transformations. So all that means is whatever y value we were taking on at a given x you're now going to take on twice that y-value. So where you were at zero, you're still going to be zero. But where you were two, you are now going to be equal to four, and so the graph is going to look something, something like what I am drawing right now. And we're done, that's our sketch of the graph of all of this business. And once again, if you're doing it on Khan Academy, there would be a choice that looks like this and you would hopefully pick that one.