# Demystify integration of $\int \frac{1}{x} \mathrm dx$

I've learned in my analysis class, that

$$\int \frac{1}{x} \mathrm dx = \ln(x).$$

I can live with that, and it's what I use when solving equations like that. But how can I solve this, without knowing that beforehand.

Assuming the standard rule for integration is

$$\int x^a \, \mathrm dx = \frac{1}{a+1} \cdot x^{a+1} + C .$$

If I use that and apply this to $\int \frac{1}{x} \,\mathrm dx$:

\begin{align*} \int \frac{1}{x}\mathrm dx &= \int x^{-1} \,\mathrm dx \\ &= \frac{1}{-1+1} \cdot x^{-1+1} \\ &= \frac{x^0}{0} \end{align*}

Obviously, this doesn't work, as I get a division by $0$. I don't really see, how I can end up with $\ln(x)$. There seems to be something very fundamental that I'm missing.

I study computer sciences, so, we usually omit things like in-depth math theory like that. We just learned that $\int \frac{1}{x} dx = \ln(x)$ and that's what we use.

• You forgot to add C – YYC Sep 19 '13 at 7:27
• @Piman even if I add $C$, I still have a division by $0$. – polemon Sep 19 '13 at 7:28
• yeah I know but still, its indefinite integration. I'm talking about the first equation btw – YYC Sep 19 '13 at 7:30
• $\ln|x| + C$.... – Bitrex Sep 19 '13 at 9:02
• @Bitrex $\log |x| + C(x)$ where $C(x)$ is locally constant on $\mathbb R \setminus \{0\}$. – kahen Sep 19 '13 at 10:33

If you want to try to prove $\int\frac{\mathrm dx}x=\ln x + C$ (for $x \gt 0$), try the substitution

\begin{align} x &= e^u \\ \mathrm dx &= e^u \mathrm du \end{align}

This substitution is justified because the exponential function is bijective from $\mathbb{R}$ to $(0,\infty)$ (hence for every $x$ there exists a $u$) and continuously differentiable (which allows an integration by substitution).

$$\int\frac{\mathrm dx}x=\int\frac{e^u\mathrm du}{e^u}=u+C$$

Now just use the fact that natural log is the inverse of the exponential function. If $x=e^u,u=\ln x$.

• Wow, thatnks! Makes me almost wonder why I didn't see it myself. – polemon Sep 19 '13 at 7:56
• I object that this answer is not rigorous enough. – Vishal Gupta Sep 19 '13 at 9:36
• @vishal: What part bothers you? It looks to me like an ordinary integration by substitution, which in turn is nothing but the chain rule. – Nate Eldredge Sep 19 '13 at 13:38
• I'll accept this one, because it is the one that I understand best. – polemon Sep 22 '13 at 3:09
• This is actually very beautiful. I haven't seen this explained like so. However, @Vishal I too would like to know where the lack of rigour is. – Valentino Oct 21 '14 at 23:10

Let's use your result : $$\int x^a \, dx = \frac{x^{a+1}}{a+1} + C=\frac{x^{a+1}-1}{a+1} +C'$$ and take the limit as $\,a\to -1\,$ (since $\;x^{a+1}=e^{(a+1)\ln(x)}$) : $$\lim_{a\to\,-1}\int x^a \, dx = C'+\lim_{a\to\,-1}\frac{e^{(a+1)\ln(x)}-1}{a+1}=C'+\ln(x)$$ Hoping this will help your intuition,

• adding the step $\cdots\ = C'+\lim_{a\to 0}\frac{e^{\mathrm{ln}(x)\cdot a}-e^0}{a}=C'+\frac{\partial}{\partial a}e^{\mathrm{ln}(x)\cdot a}|_{a=0}=\cdots$ helps understanding why $\mathrm{ln}(x)$ comes down there at the end. – Nikolaj-K Sep 19 '13 at 8:36
• Thanks for this addition @NickKidman. – Raymond Manzoni Sep 19 '13 at 8:45
• I think that this is the best answer. Indeed, Raymond did not use derivative to prove that the integral is equal to $\ln(x)$ (that is, prove that the integral of $f$ is $F$ knowing that $\frac{dF}{dx} = f$ or similar approaches). Rather, he proved that the class of functions $\frac{x^{a+1}}{a+1}$ converges to $\ln(x)$ when $a$ approaches $-1$. Really nice point! – the_candyman Sep 19 '13 at 10:11
• This is the way I like to approach this, since students often have the same thoughts as polemon. (+1) I used a rewrite of the limit $\lim\limits_{n\to\infty}\left(1+\frac xn\right)^n=e^x$ to get a similar result. However, I worry that it is too close to yours. – robjohn Sep 19 '13 at 10:43
• @Squirtle: The convergence of these functions is uniform on compact sets, and so the limit of their integrals is the integral of their limits. – robjohn Sep 19 '13 at 15:03

Logarithms are all about solving exponential equations right? For example, logarithms are useful if you want to solve $2^x=3$. Maybe you are really confused about how in the world finding the area under $y=\frac{1}{x}$ has anything to do with solving such equations. Hopefully this post will illuminate that - but it may be a bit long winded.

Say you wanted to solve $2^x=3$ and you are a 16th century mathematician. So, no calculator. You could just use bisection method, getting closer and closer approximations, but this involves the very laborious process of computing roots, and you wouldn't want to have to do this every time you have an exponential equation to solve. So here is the genius idea. You will pay someone to calculate $1.0001^n$ for you for $n=1$ to $1000000$. You can teach them the mechanical skill of multiplying these numbers in a week because you only have to shift and add (see what I mean by computing the first few!). Then you look in your table to find that $1.0001^{6931} \approx 2$ and $1.0001^{10986} \approx 3$.

This helps you because now $2^n = 3$ can be rewritten as $1.0001^{6931n} = 1.0001^{10986}$, so $n = 10986/6931 \approx 1.585$. Just to double check ourselves, $2^{1.585} \approx 3.00007798$, so it pretty much worked.

This same table allows you to approximate the solutions to a huge number of exponential equations, in exactly the same manner. The upfront investment of labor is worth the time, because now you and your buddies can all solve these equations just by table lookups.

Later on, you want more precision, so you pay a whole group of laborers to calculate the powers of $1.000001$. You notice that in the old table for $1.0001$, the entry for $1.0001^{10000} = 2.71814593$, and the entry for $1.000001^{1000000} = 2.71828047$. Seems like a pretty special number to be coming up in these exponential tables, so you call it $e$ for exponential.

You have done all you can with exponential equations for the time being, so you turn your attention to other matters. First you notice the curious fact that the number of faces plus the number of vertexes minus the number of edges of any polyhedron seems to always be 2. You struggle to find a proof of this, but are tormented to no end. Later you turn to predicting the motion of the planets. Some time later your patron wants you to design some kind of war machine. Finally, many years after your experiments with exponential equations, you turn your attention to the problem of finding areas bounded by hyperbolas. You know that there are classical solutions to the area under a parabola, but as far as you know, no one has tackled the area under $y = \frac{1}{x}$ from $x=1$ to $x=2$, for instance.

You set about attempting to calculate this area. Your first thought is just to carve the region up into a great number of rectangles, all of equal base. You choose cut up the interval $[1,2]$ at the points $1.0001, 1.0002, 1.0003, 1.0004, 1.0005 ,... 1.9999$ and sum the areas of all the rectangles you get. You find that the answer is about $.693122$. Gifted as you are with the supernatural recall of a 16th century mathematician, you remember that all those years ago, $1.0001^{6931} \approx 2$. What a great mystery! What could be at the bottom of this coincidence?

First of all, in your old tables you were repeatedly multiplying 1.001, which is not exactly how you cut up [1,2] in your area calculation. However, there is nothing wrong with cutting up the interval [1,2] at the points $1.001, 1.001^2, 1.001^3, 1.001^4,$ etc. These numbers are all still close to each other, so computing the area of the corresponding rectangles will give a good approximation to the area under your curve, and these rectangles at least have a chance at relating the two problems.

So what are the areas of these rectangles? The area of the first rectangle is $1 \cdot (1.001-1) = .001$. The area of the second rectangle is $\frac{1}{1.001} \cdot (1.001^2-1.001) = .001$. The area of the third rectangle is $\frac{1}{1.001^2} \cdot (1.001^3-1.001^2) = .001$! Hey! These are all the same area! So the total area under the curve is just going to be $A = .001n$, where n is the solution to $1.001^n=2$. This is only an approximation though. We would get a better approximation if we used our table for 1.000001. It would be handy to write our result in a way which was agnostic about which table we were using. Oh ya, that number e always appeared in our table. So, we could say

$1.001^n = 2 \implies (1.001^{1000})^{0.001n} = 2 \implies e^A = 2$

Wow! Carrying out the same reasoning for any other $t$, we find that the area $A_t$ from $x=1$ to $x=t$ under $\frac{1}{x}$ should satisfy $e^{A_t} = t$. In other words this area function is giving an inverse to the exponential function with base e.

Hopefully this little story helps you understand what finding $\displaystyle\int_1^t \frac{1}{x} dx$ has to do with solving exponential equations, and also why the number $e$ comes into the picture naturally. To summarize, you cut up the interval [1,t] at the points $1, 1.001^2, 1.001^3, ..., 1.001^n$, where $n$ is the largest power of $1.001$ which is still less than $t$. To get from one rectangle to the next, the width gets multiplied by 1.001 and the height gets divided by 1.001, so the areas of all of these rectangles are the same. Thus the area under the rectangle $A$ is just $.001n$. But then $(1.001^{1000})^{.001n} \approx t$, and so $e^{.001n} \approx t$, which means $e^{A} \approx t$. This approximation gets better and better if you choose $1.000001$, or $1.00000000001$. So we actually have the equality $e^A =t$. Using the definition of natural logarithm as inverse of exponential function, we have $A = \ln(t)$.

I would recommend playing with this by writing a computer program to solve $a^n=b$ using the method we discussed (limit yourself to only addition, multiplication, and for loops). If you do not know how to program, just making a spreadsheet would be pretty informative: you can have your computer take the place of your laborer. Draw pictures of the area under the curve, partitioned in the way we have discussed, and see how that ties in. There is a lot to digest here.

• Thank you for this! Best reply I've read in SE e-v-e-r (=a month). – automaton 3 Sep 19 '13 at 19:21
• This is really some brilliant exposition, perhaps the best I've read. – Sammy Black Mar 16 '14 at 18:14
• @SammyBlack Thanks. I should note that I got this idea from an extra credit worksheet of Zig Fiedorowicz at Ohio State. Couldn't find a copy anywhere though... – Steven Gubkin Mar 16 '14 at 18:22

The rule doesn't work when $a = -1$. There is a nice way you can get at the derivative of an inverse function if you know the derivative of the function, by way of something called implicit differentiation. Thus if you are willing to grant that $\frac{d}{dx} e^x = e^x$, then I can show that $\frac{d}{dx} \ln x = 1/x$, which is the result that you want. Write $y = \ln x$, then $e^y = x$ so that by the chain rule, $$\frac{d}{dx} e^y = e^y\frac{dy}{dx}$$ thus $$1 = e^y \frac{dy}{dx}$$ thus $$1 = x \frac{dy}{dx}$$ thus $$\frac{dy}{dx} = 1/x$$ which by definition is equivalent to the equation $$\int \frac{1}{x} dx = \ln x +c$$

• Hmm... Kinda hard for me to wrap my mind around this. I kinda see what you're doing, although pretty much the only thing I gather, is that the standard formula simply doesn't work if $a = -1$. – polemon Sep 19 '13 at 7:52
• @polemon This answer is essentially the same as Mike's and Vishal's answers. It's just presented differently. (You should be able to detect this. I personally prefer Mike's answer for its shortness though.) – Tunococ Sep 19 '13 at 11:21

There are several approaches. One is based on the limit $$\lim_{n\to\infty}n\left(x^{1/n}-1\right)=\log(x)\tag{1}$$ By adjusting the constant of integration, we have $$\int x^n\,\mathrm{d}x=\frac1{n+1}\left(x^{n+1}-1\right)+C\tag{2}$$ Taking the limit of $(2)$ as $n\to-1$ and using $(1)$ yields $$\int x^{-1}\,\mathrm{d}x=\log(x)+C\tag{3}$$ $(1)$ is essentially a rewrite of the standard limit $$\lim_{n\to\infty}\left(1+\frac xn\right)^n=e^x\tag{4}$$

• I had this sitting on my computer from before Raymond's answer, but I fell asleep. Now that I read back, I see this is similar to his. – robjohn Sep 19 '13 at 10:34
• Excellent summary of the properties of $\ln$ and $\exp$ : $(+1)$ of course ! Thanks too for your comments and clarifications about my answer. Cheers, – Raymond Manzoni Sep 19 '13 at 22:08
• Are you allowed to switch limit and integral?What is the justification – Vivaan Daga Jun 26 '20 at 10:23
• As I commented to Squirtle on Raymond Manzoni's answer: The convergence of these functions is uniform on compact sets, and so the limit of their integrals is the integral of their limits. – robjohn Jun 26 '20 at 11:21
• What if you go the other way and differentiate the limit can you switch limit and the derivative like: math.stackexchange.com/questions/3735158/… – Vivaan Daga Jun 26 '20 at 12:57

$$\ln(x) = \int_{1}^{x}\frac{1}{t} dt$$

Now we show this.

Here is an approach that starts from the basics.

Define the exponential map by the power series in the usual way. Then $$\exp: \mathbb{R} \to \mathbb{R}_{+}$$ is an increasing bijective map. Thus, it has an increasing inverse function

$$\ln: \mathbb{R}_{+} \to \mathbb{R}$$

We know that $$\exp$$ is a differentiable function such that

$$\exp^{\prime}(x) = \exp(x) \qquad \forall \; x \in \mathbb{R}$$

Now we use the followgin theorem:

Theorem: Let $$U \subset \mathbb{R}$$ and suppose $$f : U \to \mathbb{R}$$ is an injective function, differentiable at some $$a \in U$$. In addition, suppose that $$f^{-1}: f(U) \to U$$ is continuous at $$b = f(a)$$. Then $$f^{-1}$$ is differentiable at $$b$$ if and only if $$f^{\prime}(a) \neq 0$$ and in that case,

$$(f^{-1})^{\prime}(b) = \frac{1}{f^{\prime}(a)}$$

So we get that $$\ln(x)$$ is differentiable for all $$y \in \mathbb{R}_{+}$$ (since $$\exp(x) \neq 0$$) and (assuming $$y = \exp(x)$$)

$$\ln^{\prime}(y) = \frac{1}{\exp(x)} = \frac{1}{y}$$

Now use Fundamental Theorem of Calculus to get the first equation.

• Hmm, isn't it then much simpler after your first integration formula then $\ln(1+x) = \int_1^{1+x} \frac 1t dt = \int_0^{x} \frac 1{1+t} dt$ and then termwise integration gives $\int_0^x (1-t+t^2-t^3+...-...) dt = (\frac x1 -\frac 01) - (\frac {x^2}{2}-\frac 02) + ... = \frac x1 - \frac {x^2}{2} + ... = \log(1+x)$ ? – Gottfried Helms Sep 19 '13 at 23:00
• @GottfriedHelms All these things need some advanced stuff. What I wrote is the most elementary way I know to do prove the first formula. – Vishal Gupta Sep 21 '13 at 15:06

Along with the other fine responses, I would also like to point out you could reason this through limits.

The regular formula for integral of $x^n$ actually still works, only that it adds a huge constant to it as $n$ goes towards $-1$. That's because $\frac{x^{n+1}}{n+1}$ can be well approximated as $\ln x+\frac{1}{1-n}$ as $n$ goes to $-1$.

$$\begin{array}{rcl} \lim_{\alpha \to 1}\int x^{-\alpha}dx &=& \lim_{\alpha \to 1} \frac{x^{1-\alpha}}{1-\alpha}+C \\ &=& \lim_{\alpha \to 1} \frac{x^{1-\alpha}-1}{1-\alpha}+C+\frac{1}{1-\alpha} \\ &=&\lim_{\beta \to 0} \frac{x^{\beta}-1}{\beta}+C+\frac{1}{1-\alpha}\\ &=&\ln x+\left(C+\frac{1}{1-\alpha}\right)\\ \end{array}$$

To show $\int\frac{dx}{x}=\ln{x}+C$ for positive $x$, we can show that the derivative of $\ln{x}$ is $\frac{1}{x}$. This can be done using the standard limit $$\lim_{x\to0}\frac{\ln(1+x)}{x}=1$$ and the definition of the derivative. We have $$\frac{d}{dx}\left(\ln{x}\right)= \lim_{h\to0}\frac{\ln(x+h)-\ln{x}}{h}= \lim_{h\to0}\frac{1}{h}\ln\left(1+\frac{h}{x}\right)=\left[t= \frac{1}{x}\right]= \lim_{t\to0}\frac{1}{x}\cdot\frac{\ln(1+t)}{t}= \frac{1}{x},$$ which is what we wanted to show.

$$\int \frac{1}{x} dx = \ln(x).$$

is not a calculation but a definition. This is how ln(x) is defined. ln(x) is defined before exp(x)

http://en.wikipedia.org/wiki/Natural_logarithm#Definitions

• This is one way of defining $\ln$, but not the only one. – mdp Sep 19 '13 at 12:19
• I think your first sentence needs a citation - I'm not sure I've ever seen $\ln$ defined like this, but I'm not an analyst, so that doesn't mean it isn't common. While you are right that the answer depends on the definition of $\ln$, I think it's unfair to describe the other answers as misleading for starting from a different definition to yours. – mdp Sep 19 '13 at 12:42
• I guess it's not that important (and I don't mean to sound like I'm being argumentative about this) - but it's not the first definition on Wolfram. The first definition is that it's log base e, and logarithms are defined (on Wolfram) as inverses to exponentiation. This does seem a more reasonable interpretation of the original question. I'm not trying to be critical though - your answer certainly adds something useful. – mdp Sep 19 '13 at 13:00
• The definition presented here isn't even correct, its $ln(a) = \int_1^a \frac{1}{x} dx$ – Squirtle Sep 19 '13 at 14:04
• Generally $\ln x$ is only defined before $e^x$ until you learn about ODEs (or perhaps Taylor series). The exponential is a "nicer" function than the logarithm (because it doesn't have any singularities), so it's useful to make it the logically primary function; it's just that the natural definitions all require a little more background to make rigorous than the natural definition of the logarithm. – Micah Sep 19 '13 at 16:53

One must not intermingle, what is definition and what is theorem. Before handling the given question, one should clearly state what we mean by exponential function, and what we mean by logarithmic function. There are a lot of theorems in between the definition and the final result. For a nice and accurate answer one should go through W Rudin's Pr of Math Analysis. A little known book "Beardon's Complex analysis is marvelous in this respect.

In my opinion, the primitive of the function $1/x$ has to be studied without mentioning the exponential function $e^x$. Indeed, the exponential function is the inverse function of the primitive of $1/x$ function. This recalls the story of the chicken and the egg: what we consider as known, $e^x$ or $\ln (x)$ ?