[Math] Is putting absolute values around the argument of a log obtained through integration incorrect

calculusimproper-integralsintegrationlogarithms

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?

Thanks

Best Answer

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}. $$

Related Question