Antiderivative of $1/x$, with or without absolute value?

Many textbooks include $$\int \frac{1}{x} dx = \ln |x| + c$$ in their list of antiderivative formulas, with the absolute value. Correspondingly, they do the same with the antiderivative of $$\tan x$$ or similar.

Is it productive to introduce the complication of the absolute value in a practically oriented course, when under time pressure? The alternative is to try to restrict ourselves to positive $$x$$.

My concerns are that one still needs to be careful not to include the singularity at 0 when writing definite integrals and the absolute value hides this. Some texts will omit the absolute value which can be confusing to students. So do most computer algebra systems, which operate with complex numbers by default.

• Note $\int\frac{1}{x}\,dx = \ln|x|+C$ is incorrect when $x$ is a complex variable. And $\int\frac{1}{x}\,dx = \ln x +C$ is correct, but of course—even for $x<0$ real—$C$ could be a complex constant. The question is: What should we teach in a "baby" course, restricted to real numbers? Oct 2, 2023 at 13:45
• @GeraldEdgar Yes, that is precisely the question I am asking.
– Hnrt
Oct 2, 2023 at 14:32

Even $$\int \frac{1}{x} \textrm{ d}x = \ln(|x|) + C$$ is incorrect.

It should be

$$\int \frac{1}{x} \textrm{ d}x = \begin{cases} \ln(x) + C_1 \textrm{ if x > 0}\\ \ln(-x) + C_2 \textrm{ if x < 0}\\ \end{cases}$$

Personally, I think that it would be best to include some problems where this issue arises naturally, and resolve it through thinking about it rather than memorizing another arcane aspect of a formula without understanding it.

• Do you have an example of such a problem, where the issue arises naturally? Oct 2, 2023 at 12:56
• @MichaelBächtold I guess one reason that the books give $\ln(|x|) + C$ instead of my "correct formula" is that in most "natural" situations you will either be working with $x > 0$ or $x < 0$, but not both simultaneously. So the simplified formula works out. Oct 2, 2023 at 13:00
• Re: what books say—in Stewart, there is a disclaimer in the section on indefinite integrals: "We adopt the convention that when a formula for a general indefinite integral is given, it is valid only on an interval." You can see it in this MSE question. I looked through several other popular texts and didn't find any similar disclaimers, however. Some texts were careful when stating initial value problems to restrict them to specific intervals, others weren't. Oct 2, 2023 at 14:37
• Good answer. We could say something like $\int\frac{1}{x}\, x=\ln(x)+c$ where $c$ is "locally constant," i.e., constant on connected open sets. When $x<0$, do not be surprised if $c$ is imaginary. The problem I have with the absolute value is that $|z|$ is not differentiable (complex analytic). Oct 2, 2023 at 20:06
• @Raciquel I want an antiderivative $F$ of a function $f$ to have the same domain as $f$. Oct 4, 2023 at 10:57

Absolute value or no absolute value, there will be students that attempt to integrate over infinite discontinuities anyway. Leaving off the absolute value in $$\int \frac{1}{x}\,\mathrm{d}x = \ln|x| + C$$ may stop them from blindly attempting to evaluate $$\int_{-1}^2 \frac{1}{x}\,\mathrm{d}x$$, but what about $$\int_{-1}^2 \frac{1}{x^2}\,\mathrm{d}x$$?

I agree with Steven's approach of having students encounter a problem and, through resolving it, arrive at a deeper understanding. So I would suggest giving the formula $$\int \frac{1}{x}\,\mathrm{d}x = \ln|x| + C$$ and asking students to attempt to evaluate something like $$\int_{-1}^2 \frac{1}{x}\,\mathrm{d}x$$. Let them get it wrong, and have them realize that their answer is wrong by asking them to perform some sort of check.

It may be beneficial to start with $$\int_{-1}^2 \frac{1}{x^2}\,\mathrm{d}x$$, as this integral is unambiguously divergent. Whereas for $$\int_{-1}^2 \frac{1}{x}\,\mathrm{d}x$$, students might want to make some sort of symmetry argument, cf. Cauchy principal value.

• It feels like discussing why $\int_{-1}^2 \frac{1}{x} dx = \ln 2$ is "wrong" is a very deep rabbit hole, and realistically there isn't enough time for it. There's no obvious way to discover why this is wrong. It agrees with intuition (symmetry argument), so simply stating that according to our definition of an integral this is divergent would not feel satisfying for students. A smart student will feel that something's wrong here, perhaps our definition is not a sufficiently useful formalization of what might be real physical problem? There's a reason the concept of principal values exists.
– Hnrt
Oct 2, 2023 at 16:19
• But if we talk about Cauchy principal values, then we are in way too deep and probably already ran out of time. The quote from the book in your comment on the other answer seems like a good enough way to handle it. It makes it clear that we always need to keep in mind how large that interval might be.
– Hnrt
Oct 2, 2023 at 16:19
• @Hnrt I agree that there’s no time to discuss principal values. But I think it’s fine if students don’t “discover” why the integral diverges. My priority is that students remember that we can’t naively integrate over an infinite discontinuity. And this really only needs to be brought to students’ attention once we start discussing improper integrals, not earlier. No matter what kind of disclaimer we give, I think students won't really understand the importance until they see the formula's breaking point for themselves. Oct 2, 2023 at 21:35
• If your concern is not about students misapplying the formula when evaluating definite integrals but about finding antiderivatives and solving initial value problems, that seems different to me. In that case, I do think students should be aware of the notion of the "maximum interval of existence" for a solution to an IVP. Larry Riddle wrote an article on this for AP Calculus teachers. Oct 2, 2023 at 21:44

One reason to discuss the anti-derivative of $$\frac{1}{x}$$ also for negative $$x$$ is that some (or many, depending on your audience) students will needs it later on when they learn about ordinary differential equations.

For instance, consider the very simple initial value problem $$\begin{cases} \dot x(t) = x(t), \\ x(0) = x_0. \end{cases}$$ As we all know its solution is given by $$x(t) = x_0 e^t$$ for all $$t \in \mathbb{R}$$. But assume that you don't know the solution, yet (for instance, if you're a student taking an ODE course) and try to find it by using separation of variables. This gives $$\int 1 \, \mathrm{d}t = \int \frac{1}{x} \, \mathrm{d}x.$$ Assume now that you only learnt that the anti-derivative of $$\frac{1}{x}$$ is $$\ln x + c$$ for positive $$x$$ - it happens to easily that you forget about the sign restriction and just blindly apply the formula. You thus get $$t = \ln x(t) + c \qquad (*)$$ for a constant $$c \in \mathbb{R}$$ and hence, $$x(t) = e^{-c} e^t$$. The initial condition finally yields $$e^{-c} = x_0$$. But this cannot be true if $$x_0$$ is negative. (Unless one allows for complex $$c$$ - which is a pain here, since you then need to draw the complex logarithm of a negative number, which means that you cannot use the principal branch of the complex logarithm - in any case, this moves quite deep into the territory of complex analysis for such an innocent differential equation over the real field).

By the way, to add further to the confusion, the same problem does at first glance not arise if you do the separation of variables by using definite integrals instead of indefinite integrals. This gives you $$\int_0^t 1 \, \mathrm{d}s = \int_{x_0}^{x(t)} \frac{1}{x} \, \mathrm{d}x,$$ thus (if makes again the mistake to believe that $$\ln x$$ were an anti-derivative of $$\frac{1}{x}$$ for postive and negative $$x$$) $$t = \ln x(t) - \ln x_0 = \ln \frac{x(t)}{x_0}, \qquad (**)$$ and hence $$x(t) = x_0 e^t$$ - which is the correct solution formula. Yet, we made the same error as above, by taking $$\ln x$$ as a (presumed) anti-derivative of $$\frac{1}{x}$$ even for negative $$x$$. But the error cancels out for the following reason: Solutions cannot cross equilibrium points, so $$x(t)$$ always has the same sign as $$x(0)$$. So if $$x(0)$$ is negative, so is $$x(t)$$ and hence the correct computation in $$(**)$$ for negative $$x(0)$$ is actually $$t = \ln (-x(t)) - \ln (-x_0) = \ln \frac{-x(t)}{-x_0} = \ln \frac{x(t)}{x_0},$$ which just happens to give the same result as our incorrect (for $$x(0) < 0$$) computation above.

To sum up: If one learns the anti-derivative of $$\frac{1}{x}$$ only for positive $$x$$ and happens to forget about this restriction later on (which is a very easily made mistake), one gets a mess when working with initial value problems. The same method (separation of variables) can then lead either to correct or incorrect result, depending on how precisely one applies the method.

By the way, in case that you find the example discussed above too artificial (because the initial value problem is so simple) - a similar issue appears, for instance, for the logistic equation.

Note that the derivative of $$\log x$$ has a Dirac delta term: https://mathoverflow.net/questions/127601/does-the-derivative-of-log-have-a-dirac-delta-term

This involves the principal value.