# What is the integral of 1/x?

What is the integral of $$\frac{1}{x}$$? Do you get $$\ln(x)$$ or $$\ln|x|$$?

In general, does integrating $$f'(x)/f(x)$$ give $$\ln(f(x))$$ or $$\ln|f(x)|$$?

Also, what is the derivative of $$|f(x)|$$? Is it $$f'(x)$$ or $$|f'(x)|$$?

• @Potato Fair enough. Oct 2, 2012 at 15:19
• This question is missing the domain of definition, when working in complex domain the restriction for $\ln x$ is not required Feb 10, 2013 at 2:05
• In summary, the answer is not $\log x$, $\log |x|$, or "$\log |x| + C$". The answer is that $F'(x)=1/x$ on $\mathbb{R}$ implies that there are constants $C_1,C_2\in\mathbb{R}$ such that $F(x)=\log(x)+C_1$ for all $x>0$ and $F(x)=\log(-x)+C_2$ for all $x<0$. There is no such thing as "the integral of $1/x$".
– wj32
Feb 10, 2013 at 2:09
• @Arjang Do you mean if $z$ is complex, then $\int 1/z \mathrm{d}z = \ln z +C$, so that there is no modulus symbol required? Oct 6, 2015 at 10:12

You have $$\int {1\over x}{\rm d}x=\ln|x|+C$$ (Note that the "constant" $C$ might take different values for positive or negative $x$. It is really a locally constant function.)

In the same way, $$\int {f'(x)\over f(x)}{\rm d}x=\ln|f(x)|+C$$ The last derivative is given by $${{\rm d}\over {\rm d}x}|f(x)|={\rm sgn}(f(x))f'(x)=\cases{f'(x) & if f(x)>0 \cr -f'(x) & if f(x)<0}$$

• What is $\text{sgn}(\cdot)$? Please explain to me. $(+1)$ though :) Apr 23, 2018 at 12:15
• $\operatorname{sgn}(a)$ is the sign of $a$. If $a>0$ then $\operatorname{sgn}(a)=1$, and if $a<0$ then $\operatorname{sgn}(a)=-1$. Apr 23, 2018 at 13:04
• You know what, that is actually quite useful. Thank you for telling me :) Apr 23, 2018 at 23:18
• The absolute value sign is not necessary. I mean, when we take an integral and want it to be meaningful, we usually take definite integral, not indefinite integral. For $1/x$, the definite integral cannot be taken over an interval that contains 0, the two boundaries should be both positive or negative. So $\int_a^b \frac{1}{x}dx=\log(b/a)$, no mistake will be made. Mar 3, 2019 at 3:20
• Note that this might be used to compute logarithms, if you have no calculator. Apr 3, 2019 at 3:24

Answers to the question of the integral of $$\frac{1}{x}$$ are all based on an implicit assumption that the upper and lower limits of the integral are both positive real numbers. If we allow more generality, we find an interesting paradox. For instance, suppose the limits on the integral are from $$-A$$ to $$+A$$ where $$A$$ is a real, positive number. The posted answer in term of $$\ln$$ would give

$$\ln(A) - \ln(-A) = \ln\left(\frac{A}{-A}\right) = \ln(-1) = i* \pi$$ a complex number --- rather strange.

Now if you do the same integral from $$-$$ to $$+$$ infinity (i.e. $$A = \infty$$) using Contour Integration, you get $$i*2\pi$$ or twice the above value.

If you use simple reasoning, and also numerical integration, this integral for any value of $$A$$ ( as long as the limits are $$-A$$ to $$+A$$ is clearly $$0$$. So one must be careful in evaluating real integrals with a singularity of this kind. Same applies to any integral of $$\frac{1}{x - k}$$ where $$k$$ is any constant real number) or

• Usually Paradox comes from misunderstanding :-)
– Ram
Feb 10, 2013 at 2:25
• Well, calling Ln(-1) = i*Pi is already expanding the standard definition of Ln. In the context described (where A & -A are both real, and the log used is standard), Ln(-1) is undefined. But I'd say the intelligent thing is to break it into two undefined improper integrals with one of the limits at 0 (where it is unbounded). At that point, they can be seen as fully symmetric. Recognizing this symmetry, you can "safely" say the answer is 0. Dec 4, 2015 at 5:45
• And as Per Manne said you'd have to treat this as improper because C isn't always constant for all real x. Feb 25, 2019 at 23:31
• "Answers to the question of the integral of 1x are all based on an implicit assumption that the upper and lower limits of the integral are both positive real numbers" --- not completely correct: if they are both negative it also works. This is an improper integral and does not converge in the remaining cases. Apr 13, 2020 at 13:20