Before you say that $\int \frac{1}{x} dx$ is equal to $\ln|x| +C$ due to positve and negative, I would like to show you why it is not convincing to me.

Problem 1 and its possible solution.

Evaluate $$ \begin{equation} \sum_{n=1}^\infty \frac{\sin(n)}{n} \end{equation} $$ From infinite geometric series \begin{equation} \sum_{n=1}^\infty x^{n-1}=\frac{1}{1-x} ;|x|<1 \end{equation} Integrating this with respect to $x$ we would get (Constant vanishes due to $x=0$) \begin{equation} \sum_{n=1}^\infty \frac{x^n}{n}=-\ln|1-x| \end{equation} So $\sum_{n=1}^\infty \frac{\sin(n)}{n}$ is just an imaginary part of
\begin{equation} \sum_{n=1}^\infty \frac{z^n}{n}=-\ln|1-z| \end{equation} Where $z=e^i$
But the right hand side has no imaginary part at all, but the summation is clearly exists, this seems to suggest that the integral is equal to $\ln(x) +C$

There is another curious way to evaluate integral on negative reals if we only consider only principal values.

Problem 2 and its possible solution. Evaluate \begin{equation} \int_{-4}^{-2} \frac{1}{x} dx \end{equation} If we give that $\int \frac{1}{x} dx=\ln(x) +C $ then the integral is \begin{equation} \int_{-4}^{-2} \frac{1}{x} dx=\ln(-2)-\ln(-4) \end{equation} Using principal values we will get \begin{equation} \ln(-2)-\ln(-4)=\ln(2)+i\pi-\ln(4)-i\pi=-\ln(2) \end{equation} Which is exactly equal to when we use $\int \frac{1}{x} dx=\ln|x|+C$
These 2 problems are the reasons why the result $\ln |x| +C$ not convincing but there might be flaws in the proposed solutions. If there is a flaws please explain them too.

  • 3
    $\begingroup$ I think it's only true for real $x$. For complex $z$, $\log$ (and integrals!) get somewhat more complicated. If you wish, you can probably define $\log z = \int_1^z z^{-1}\,dz$ for all $z$ where the integration path determines the order of the logarithm. $\endgroup$
    – Argon
    Jun 1, 2016 at 13:32
  • 5
    $\begingroup$ When you're admitting complex arguments, $\ln \lvert z\rvert + C$ is flat-out wrong. When you're restricting to real arguments, $\ln \lvert x\rvert + C$ works, since the domains where $\lvert x\rvert = x$ and where $\lvert x\rvert = -x$ are separated, and for $x < 0$ you have $\ln \lvert x\rvert = \ln (-x) = \ln x + (2k+1)\pi i$, so you just get a different integration constant from switching from $\ln x$ to $\ln (-x)$ [for any switch from $\ln x$ to $\ln (ax)$ where $a$ is a nonzero constant]. $\endgroup$ Jun 1, 2016 at 13:36
  • 1
    $\begingroup$ What is your definition of $\int\frac{1}{x}\ dx$? $\endgroup$
    – user9464
    Jun 1, 2016 at 13:51
  • $\begingroup$ @Jack My preferred definition for $\int \frac{1}{x} dx$ would be $\ln(x)+C$ since this definition seems to be more useful (like evaluate the summation in the given problem), but I was very unsure since many sources say that it is $\ln |x|+C$. $\endgroup$
    – Kavinkul
    Jun 1, 2016 at 14:19
  • 1
    $\begingroup$ Are you seriously suggesting that hundreds of years of the best mathematicians of all time haven't extremely thoroughly vetted something like a basic calculus anti-derivative? And more than that, your suggestions don't even satisfy hypotheses of the theorems you're trying to use. $\endgroup$ Jun 1, 2016 at 15:57

3 Answers 3


Without a clear definition of "$\log(x)$" and "$\int\frac{1}{x}\ dx$", it is meaningless to ask $\int\frac{1}{x}\ dx$ should be $\log(x)+C$ or $\log(|x|)+C$.

On the one hand, the notation $$ \int f(x)\ dx\tag{0} $$ (some times called the anti-derivative of $f$) really means (by definition) a function $F$ such that $$ F'(x)=f(x)\tag{1} $$ where $x$ takes values so that $(1)$ is true.

On the other hand, one way to define the natural logarithm is by Riemann integrals: $$ \log(x)=\int_1^x\frac{1}{t}\ dt,\quad x>0.\tag{2} $$ Whenever $a<b$, we use the convention that $$ \int_b^af(x)\ dx=-\int_a^b f(x)\ dx. $$

By the fundamental theorem of calculus and chain rule, $$ \frac{d}{dx}\log(-x)=\frac{1}{-x}\cdot (-1)=\frac{1}{x} $$ for $x<0$ and $$ \frac{d}{dx}\log(x)=\frac{1}{x},\quad x>0. $$ In either case we have $$ \frac{d}{dx}\log(|x|)=\frac{1}{x},\quad x\neq 0.\tag{3} $$ Since two function have the same derivative if and only they are the same up to a constant (by the mean value theorem), we have $$ \int\frac{1}{x}\ dx=\log(|x|)+C,\quad x\neq 0\tag{4} $$ Note that until now, no complex numbers are evolved at all. The two problems in OP are irrelevant to $(4)$ because in complex analysis, the complex logarithm has totally different meaning from the real one (related though) and we are now in the setting of real numbers.

  • 3
    $\begingroup$ There is a big problem that most textbooks gloss over, and answers in MSE as well: "Since two function have the same derivative if and only they are the same up to a constant (by the mean value theorem) (...)" This is true in intervals. If people really want to find the antiderivative of the function $1/x$ in its whole "domain" $\mathbb{R}\backslash \{0\}$, they should write $\log(|x|)+C_1$ if $x>0$ and $\log(|x|)+C_2$ if $x<0$. $\endgroup$
    – Aloizio Macedo
    Jun 1, 2016 at 16:01
  • $\begingroup$ @AloizioMacedo hello, do you have a reference for this? Frankly, I don't think I understand this particularly well $\endgroup$ Oct 8, 2017 at 19:56
  • 1
    $\begingroup$ @qbert What AloizioMacedo means is that people often think $f'=0$ everywhere is equivalent to $f$ being constant, when in reality, it just means that every connected part of the domain is constant. E.g., the sign function has derivative 0 on $\mathbb R\setminus\{0\}$, but is not constant. The same applies antiderivatives: if $F$ and $G$ are two antiderivatives of $f$, then clearly $(F-G)'=f-f=0$, but that doesn't imply $F=G+c, c\in\mathbb R.$ Instead, it means for every connected subset $M$ (intervals in $\mathbb R$), there is a constant $c_M\in\mathbb R$ such that the equality holds on M. $\endgroup$
    – Formyer
    Oct 8, 2017 at 20:13
  • $\begingroup$ That is a super important clarification I never learned. thank you $\endgroup$ Oct 8, 2017 at 20:21

The formula with an absolute value is clearly for real arguments. Because the complex function $\dfrac1x$ is analytical except at the origin, while $\log|x|$ is nowhere.

Hence the Problem 1 is irrelevant.

And for Problem 2, the formula without the absolute value would be of no use in the negatives if complex are disallowed.

This said, the formula $\log x$ would be better for the undefinite integral evaluated as

$$\log\frac ba$$ instead of $$\log\left|\frac ba\right|$$ (and not as a difference of logarithms) as this forbids to straddle the origin.

  • $\begingroup$ I really like this fractional formula, unique to the logarithm, so people won't be tempted to see it as a general antiderivative, solves the problem of what to do if $a,b<0$ and doesn't allow you to use $a<0<b$! $\endgroup$
    – Formyer
    Oct 8, 2017 at 20:08

So, two separate points: First, let me discuss your first example:

In the first series, you are forgetting that the sum you try to evaluate (for $z=e^{i\pi}\Rightarrow|z|=1$) lies on the border of the circle of convergence of the power series $p(z)=\sum_{n=1}^\infty\frac{z^n}n$ of $f(z)=-\ln(1-z).$ Therefore, we cannot say $$\sum_{n=1}^\infty\frac{e^{in\pi}}n\overset{!}=-\ln|1-e^{i\pi}|,$$ since convergence is not guaranteed for values on the border of the unit circle $\mathbb S^1.$

Secondly, you are correct: The formula $\int_a^b\frac1x\text dx=\ln|b|-\ln|a|$ is true for $0<a<b\vee a<b<0$, not generally. Once you define the logarithm of complex values, you should interpret the formula $\int_a^b\frac1x\text dx=\ln|x|$ as a "special case formula" for real numbers (such as $a^2+b^2=c^2$, which is only true for right-angled triangles, but has the more general cosine-formula for all triangles in the Euclidean plane) that allows you to compute any proper Riemann integral of the inverse function as long as the interval you are trying to integrate does not contain a neighbourhood of zero.

The advantage with this definition using $\ln\circ\mathop{\mathrm{abs}}$ is that you do not have to introduce any complex functions or the $\arg$ function, much less get bogged down in the principal value problem just to define the integral of an odd function on the negative part of its domain. After all, for $a<b<0,$ the equality holds. For $0<a<b$ trivially as well. However, unlike many other equalities that hold on most of $\mathbb R,$ this one is not extendable to any set $M\subset\mathbb C\setminus\mathbb R.$

Another example for such a formula would be $\forall a,b>0\colon\sqrt{ab}=\sqrt a\sqrt b.$


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .