# What is the correct integral of $\frac{1}{x}$? [duplicate]

I understand that the graphs of $\log(x)$ and $\ln(x)$ both have derivatives (changes in slope) that follow the pattern of:

$$\frac{d}{dx}\log_{b}x= \frac{1}{(x\ln(b))}$$

However, depending on the source, I have seen different definitions for the integral of $\frac{1}{x}$:

$$\int\frac{1}{x}dx=\ln| x |+C$$

$$\int\frac{1}{x}dx=\log| x |+C$$

$$\int\frac{1}{x}dx=\ln x+C$$

$$\int\frac{1}{x}dx=\log x +C$$

I believe that only the top two definitions are close to being valid, and I also think that $\ln| x |+C$ is the only correct answer, based on the formula for the derivative given above, and the fact that $ln(e) = 1$. Is that incorrect?

Can the answer to this be shown graphically as well as algebraically?

• When it is defined using the term "log", the base is implied to be $e$ – ASKASK Feb 23 '15 at 5:55
• So definition 1 and 2 are exactly equivalent and 3 and 4 are also exactly equivalent – ASKASK Feb 23 '15 at 5:56
• Usually we define $\ln$ by $$\ln x=\int_1^x\frac{1}{t}dt$$ – Surb Feb 23 '15 at 6:02

The rub is that $\frac{1}{x}$ has a discontinuity at $x = 0$, a singularity. The most correct indefinite integral is actually none of the above. It is, instead

$$\int \frac{1}{x}\ dx = \begin{cases} \ln(x) + C_1, \mbox{ if } x > 0\\ \ln(-x) + C_2, \mbox{ if } x < 0\end{cases}$$

for two constants $C_1$ and $C_2$. You can check this differentiates to $\frac{1}{x}$. This actually doesn't just apply to $\frac{1}{x}$ alone, but to any function with a discontinuity where it is undefined. The other options miss part of the space of antiderivatives.

Many a time these days, you see $\int \frac{1}{x} dx= log(x)+C$. The confusion arises because some people and websites use log x to mean the 'Natural log' (Eg: Wolfram Alpha; but it clearly makes a display note below a solution/computation that it means natural log when it says log(x)). Normally speaking, the below would be the acceptable answer/solution (Your guess was right about the absolute value; it helps in extension of arguements into the negative numbers). $$\int \frac{1}{x} dx= ln|x|+C$$

• Here "some people" includes all mathematicians, with the possible exception of the few who write calculus textbooks. – Martin Argerami Aug 25 '17 at 12:57
• @MartinArgerami: It's because the people who write algebra books write log x when they mean log₁₀ x and the people who write computer science textbooks write log x when they mean log₂ x. But ln is unique for logₑ x. – Joshua Mar 9 '19 at 15:32

As Surb noted in a comment, $\ln$, the natural logarithmic function, is often defined by $$\ln x = \int_1^x\frac{1}{t}\,dt,\qquad x>0.$$ Now, the existence of this function really depends on the fact that the integral of a continuous function always exists. As for graphically, I'll assume you mean geometrically--if $x>1$, then $\ln x$ may be interpreted geometrically as the area under the hyperbola $y=1/t$ from $t=1$ to $t=x$. For $x=1$, we will have that $$\ln 1 = \int_1^1\frac{1}{t}\,dt = 0.$$ For $0<x<1$, we will have that $$\ln x = \int_1^x\frac{1}{t}\,dt=-\int_x^1\frac{1}{t}\,dt < 0.$$ Note also that, using the FTC, we have that $$\frac{d}{dx}\int_1^x\frac{1}{t}\,dt=\frac{1}{x}.$$ Hence, we have that $$\frac{d}{dx}(\ln x)=\frac{1}{x}.$$

• But, note also that $\frac{d}{dx}(\ln |x|) = \frac{1}{x}$ extends it to negative numbers. I have seen courses where the teachers actually expect the absolute value. – Carl Feb 23 '15 at 7:00
• @Carl: And that's because one often needs the absolute value to get the right results. See here, for example: math.stackexchange.com/a/41900/1242 – Hans Lundmark Feb 23 '15 at 7:36