I've always been taught that when integrating a function of the form $f'(x)/f(x)$ to put an absolute value around the argument of the resulting logarithm. For example:

$$\int\frac1{x}\mathrm dx = \log{|x|} + c$$

The reason provided was that 'logarithms aren't defined for negative numbers', it seems a bit like cheating to me to just throw absolute values around the argument. Furthermore, I thought of a case where this would actually produce the wrong result;

$$\int_{-1}^1\frac1{x}\mathrm dx = \log|1| - \log|-1| = 0$$

However, the correct way should be this:

$$\int_{-1}^1\frac1{x}\mathrm dx = \log(1) - \log(-1) = 0 - i\pi = -i\pi$$

Edit: I may be wrong, but the integral above, ignoring the singularity (sorry couldn't think of a better example to illustrate my point with -1 and changing it now would make people's answers and comments seem off-topic), should be correct due to Euler's identity:

$e^{i\pi} = -1 \implies \log(-1) = i\pi$

Could someone please provide a better explanation?


  • 1
    $\begingroup$ For $\int_{-1}^1\frac1{x}\mathrm dx$, you do remember that your integrand's singular in the center of the integration interval? That being said, there's a way to interpret the integral so that the result 0 makes sense, due to Cauchy... $\endgroup$ – J. M. is a poor mathematician Jul 17 '11 at 9:58
  • 3
    $\begingroup$ One way to think about it: the reciprocal function is odd, so $\frac1{-x}=-\frac1{x}$. Ignoring the singularity, the "area" on the left of the vertical axis is precisely the negative of the area on the right of the axis, so if you add them together... $\endgroup$ – J. M. is a poor mathematician Jul 17 '11 at 10:03
  • $\begingroup$ You should go back to the geometric concept of the integral. If you consider the left section of the reciprocal function, wouldn't you consider it off-base that the area bounded by the function and the axis gives a complex result? $\endgroup$ – J. M. is a poor mathematician Jul 17 '11 at 12:27

The function $1/x$ is continuous on $(0,+\infty)$; therefore, it has a primitive, which happens to be $\log x+C$. On the other hand, $1/x$ is also continuous on $(-\infty,0)$, and its primitive is $\log(-x)+C=\log|x|+C$. Putting it all together, $\log|x|+C$ is the primitive of $1/x$ on $\mathbb{R}\setminus\{0\}$.

The definite integral $\int_{-1}^1\frac{dx}{x}$ does not exist neither in the Riemann sense nor in the Lebesgue sense. The Cauchy principal value of the integral is defined as $$ \lim_{\epsilon\to0}\int_{-1}^{-\epsilon}+\int_{\epsilon}^1\frac{dx}{x}. $$


The integral doesn't technically even converge, so no dice. However, for integrals over singular values, you can use the Cauchy principal value:

$$ \int_{-1}^{-\epsilon} \frac{1}{x} dx + \int_{\epsilon}^1 \frac{1}{x} dx $$

as $\epsilon\to 0$. Note that these integrals annihilate each other, meaning they cancel each other out, hence we get a Cauchy p.v. of $0$. Moreover, your integral can't possibly come out to $-i\pi$, because the function $1/x$ is always real for real $x$. When can you sum up real numbers and get an imaginary one?

You can see visually that if the graph of $ \log |x|$ has derivative equal to $1/x$ for positive $x$, it must have the negative of $1/x$ for the derivative at $-x$, hence it makes sense when dealing with real numbers to use $\log |x|$ as the antiderivative of $1/x$.

$\hskip 2.3 in$ enter image description here

In complex analysis, when you integrate not over straight intervals on the real line but arbitrary paths or closed contours in the complex plane, singularities change the behavior of the integrals because the function may have different branches (i.e. it becomes multi-valued, much like $\log z = \log |z| + \arg z + 2 n \pi i, n\in\mathbb{N}$ has an infinte number of values). At that point in time it becomes necessary to address your concerns, but this is a bit deeper and more involved than the real-valued case.

  • $\begingroup$ For the general case wouldn't this rely on the assumption that all functions that integrate into logarithms are odd? $\endgroup$ – ajnatural Jul 17 '11 at 23:17
  • $\begingroup$ The only function on the reals that integrates to the even function $\log |x|$ is indeed the odd function $1/x$. I'm not sure I understand what "general case" you're speaking of. $\endgroup$ – anon Jul 17 '11 at 23:24
  • $\begingroup$ I only provided $1/x$ as a simple example. The original question was for anything that would integrate into a logarithm. $\endgroup$ – ajnatural Jul 17 '11 at 23:32
  • $\begingroup$ @ajnatural: Are you sure you know what an integral is? The only nonpathological function that integrates to $\log |x|$ on the reals (neglecting $0$) is $1/x$... $\endgroup$ – anon Jul 19 '11 at 12:54
  • $\begingroup$ I wasn't referring specifically to $\log{|x|}$, for example, $\int{\dfrac{2x-1}{x^2 - x + 5}} = \log{|x^2 - x + 5|} + c$. $\endgroup$ – ajnatural Jul 19 '11 at 13:23

Added in response to the edit.

ignoring the singularity

You cannot ignore the singularity. You are trying to add two infinities, $+\infty+(-\infty)$, expecting to get a finite value. For $-1<c<0$ the integral in $[-1,c[$ is negative and for $0<c<1$ the integral in $]c,1]$ is positive. But in $[-1,0[$ or $]0,1]$ neither is finite.

The graph of the integrand function is

enter image description here

The integral $$\int \frac{1}{x}dx=\log \left\vert x\right\vert +C$$ if and only if $x\neq 0$. My explanation: if $x>0$, then $\frac{d}{dx}\log x=\frac{1}{x}$. If $x<0$, then $$\frac{d}{dx}% \log \left( -x\right) =\frac{1}{x}.$$ So, if $x\neq 0$, then $$\frac{d}{dx}% \log \left\vert x\right\vert =\frac{1}{x}.$$

Splitting your integral as

$$\int_{-1}^{1}\frac{1}{x}dx=\int_{-1}^{0}\frac{1}{x}dx+\int_{0}^{1}\frac{1}{x% }dx,$$

we have two improper integrals of the 2nd kind with a singularity at $x=0$. Since both of them are divergent so is $\int_{-1}^{1}\frac{1}{x}dx$. A direct computation shows that

$$\int_{0}^{1}\frac{1}{x}dx=\lim_{a\rightarrow 0^{+}}\int_{a}^{1}\frac{1}{x}% dx=\lim_{a\rightarrow 0^{+}}\left( -\ln a\right) =\infty ,$$


$$\int_{-1}^{0}\frac{1}{x}dx=\lim_{b\rightarrow 0^{-}}\int_{-1}^{b}\frac{1}{x}% dx=\lim_{b\rightarrow 0^{-}}\left( \ln b-i\pi \right) =-\infty .$$


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.