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

Indefinite integral of 1/x

In differential ​calculus we learned that the derivative of ln(x) is 1/x. Integration goes the other way: the integral (or antiderivative) of 1/x should be a function whose derivative is 1/x. As we just saw, this is ln(x). However, if x is negative then ln(x) is undefined! The solution is quite simple: the antiderivative of 1/x is ln(|x|). Created by Sal Khan.

Want to join the conversation?

Video transcript

What I want to do in this video is think about the antiderivative of 1/x. Or another way of thinking about it, another way of writing it , is the antiderivative of x to the negative 1 power. And we already know, if we somehow try to apply that anti-power rule, that inverse power rule over here, we would get something that's not defined. We would get x to the 0 over 0, doesn't make any sense. And you might have been saying, OK, well, I know what to do in this case. When we first learned about derivatives, we know that the derivative-- let me do this in yellow-- the derivative with respect to x of the natural log of x is equal to 1 over x. So why can't we just say that the antiderivative of this right over here is equal to the natural log of x plus c? And this isn't necessarily wrong. The problem here is that it's not broad enough. When I say it's not broad enough, is that the domain over here, for our original function that we're taking the antiderivative of, is all real numbers except for x equals 0. So over here, x cannot be equal to 0. While the domain over here is only positive numbers. So over here, x, so for this expression, x has to be greater than 0. So it would be nice if we could come up with an antiderivative that has the same domain as the function that we're taking the antiderivative of. So it would be nice if we could find an antiderivative that is defined everywhere that our original function is. So pretty much everywhere except for x equaling 0. So how can we rearrange this a little bit so that it could be defined for negative values as well? Well, one one possibility is to think about the natural log of the absolute value of x. So I'll put little question mark here, just because we don't really know what the derivative of this thing is going to be. And I'm not going to rigorously prove it here, but I'll I will give you kind of the conceptual understanding. So to understand it, let's plot the natural log of x. And I had done this ahead of time. So that right over there is roughly what the graph of the natural log of x looks like. So what would the natural log of the absolute value of x is going to look like? Well, for positive x's, it's going to look just like this. For positive x's you take the absolute value of it, it's just the same thing as taking that original value. So it's going to look just like that for positive x's. But now this is also going to be defined for negative x's. If you're taking the absolute value of negative 1, that evaluates to just 1. So it's the natural log of 1, so you're going to be right there. As you get closer and closer and closer to 0 from the negative side, you're just going to take the absolute value. So it's essentially going to be exactly this curve for the natural log of x, but the left side of the natural log of the absolute value of x is going to be its mirror image, if you were to reflect around the y-axis. It's going to look something like this. So what's nice about this function is you see it's defined everywhere, except for-- I'm trying to draw it as symmetrically as possible-- except for x equals 0. So if you combine this pink part and this part on the right, if you combine both of these, you get y is equal to the natural log of the absolute value of x. Now let's think about its derivative. Well, we already know what the derivative of the natural log of x is, and for positive values of x. So let me write this down. For x is greater than 0, we get the natural log of the absolute value of x is equal to the natural log of x. Let me write this. Is equal to the natural log of x. And we would also know, since these two are equal for x is greater than 0, the derivative of the natural log of the absolute value of x is going to be equal to the derivative of the natural log of x. Which is equal to 1/x for x greater than 0. So let's plot that. I'll do that in green. It's equal to 1/x. So 1/x, we've seen it before. It looks something like this. So let me do my best attempt to draw it. It has both vertical and horizontal asymptotes. So it looks something like this. So this right over here is 1/x x is greater than 0. So this is 1/x when x is greater than 0. So all it's saying here, and you can see pretty clearly, is the slope right over here, the slope of the tangent line is 1. And so you see that when you look at the derivative, the slope right over here, the derivative should be equal to 1 here. When you get close to 0, you have a very, very steep positive slope here. And so you see you have a very high value for its derivative. And then as you move away from 0, it's still steep. But it becomes less and less and less steep all the way until you get to 1. And then it keeps getting less and less and less steep. But it never quite gets to absolutely flat slope. And that's what you see its derivative doing. Now what is the natural log of absolute value of x doing right over here? When we are out here, our slope is very close to 0. It's symmetric. The slope here is essentially the negative of the slope here. I could do it maybe clearer, showing it right here. Whatever the slope is right over here, it's the exact negative of whatever the slope is at a symmetric point on the other side. So if on the other side, the slope is right over here, over here it's going to be the negative of that. So it's going to be right over there. And then the slope it just gets more and more and more negative. Right over here, the slope is a positive 1. Over here it's going to be a negative 1. So right over here our slope is a negative 1. And then as we get closer and closer to 0, it's just going to get more and more and more negative. So the derivative of the natural log of the absolute value of x, for x is less than 0, looks something like this. And you see, and once again, it's not a ultra rigorous proof, but what you see is that the derivative of the natural log of the absolute value of x is equal to 1/x for all x's not equaling 0. So what you're seeing, or hopefully you can visualize, that the derivative-- let me write it this way-- of the natural log of the absolute value of x is indeed equal to 1/x for all x does not equal 0. So this is a much more satisfying antiderivative for 1/x. It has the exact the same domain. So when we think about what the antiderivative is for 1/x-- and I didn't do a kind of a rigorous proof here, I didn't use the definition of the derivative and all of that. But I kind of gave you a visual understanding, hopefully, of it. We would say it's the natural log of the absolute value of x plus c. And now we have an antiderivative that has the same domain as that function that we're taking the antiderivative of.