# What is the integral of 1/x?

What is the integral of $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. – M Turgeon Oct 2 '12 at 15:19
• This question is missing the domain of definition, when working in complex domain the restriction for $\ln x$ is not required – Arjang Feb 10 '13 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 '13 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? – an offer can't refuse Oct 6 '15 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 :) – Feeds Apr 23 '18 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$. – Per Manne Apr 23 '18 at 13:04
• You know what, that is actually quite useful. Thank you for telling me :) – Feeds Apr 23 '18 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. – Highman Mar 3 at 3:20
• Note that this might be used to compute logarithms, if you have no calculator. – richard1941 Apr 3 at 3:24

Answers to the question of the integral of 1 over 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 (A/-A) = ln (-1) = i* Pi a complex number --- rather strange. Now if you do the same integral from - to + infinity (i.e. A = infinity) using Contour Integration, you get i*2Pi 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 1 over (x - k) where k is any constant real number) or

• Usually Paradox comes from misunderstanding :-) – Ram Feb 10 '13 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. – Mike Williamson Dec 4 '15 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. – Benjamin Thoburn Feb 25 at 23:31

## protected by Zev ChonolesNov 12 '15 at 2:02

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).