Skip to the Main Content

Note:These pages make extensive use of the latest XHTML and CSS Standards. They ought to look great in any standards-compliant modern browser. Unfortunately, they will probably look horrible in older browsers, like Netscape 4.x and IE 4.x. Moreover, many posts use MathML, which is, currently only supported in Mozilla. My best suggestion (and you will thank me when surfing an ever-increasing number of sites on the web which have been crafted to use the new standards) is to upgrade to the latest version of your browser. If that's not possible, consider moving to the Standards-compliant and open-source Mozilla browser.

December 3, 2025

log|x| + C revisited

Posted by Mike Shulman

A while ago on this blog, Tom posted a question about teaching calculus: what do you tell students the value of 1xdx\displaystyle\int \frac{1}{x}\,dx is? The standard answer is ln|x|+C\ln{|x|}+C, with CC an “arbitrary constant”. But that’s wrong if \displaystyle\int means (as we also usually tell students it does) the “most general antiderivative”, since

F(x)={ln|x|+C ifx<0 ln|x|+C + ifx>0 F(x) = \begin{cases} \ln{|x|} + C^- &\text{if}\;x\lt 0\\ \ln{|x|} + C^+ &\text{if}\;x\gt 0 \end{cases}

is a more general antiderivative, for two arbitrary constants C C^- and C +C^+. (I’m writing ln\ln for the natural logarithm function that Tom wrote as log\log, for reasons that will become clear later.)

In the ensuing discussion it was mentioned that other standard indefinite integrals like 1x 2dx=1x+C\displaystyle\int \frac{1}{x^2}\,dx = -\frac{1}{x} + C are just as wrong. This happens whenever the domain of the integrand is disconnected: the “arbitrary constant” CC is really only locally constant. Moreover, Mark Meckes pointed out that believing in such formulas can lead to mistaken calculations such as

1 11x 2dx=1x] 1 1=2 \int_{-1}^1 \frac{1}{x^2}\,dx = \left.-\frac{1}{x}\right]_{-1}^1 = -2

which is “clearly nonsense” since the integrand is everywhere positive.

In this post I want to argue that there’s actually a very natural perspective from which 1x 2dx=1x+C\displaystyle\int \frac{1}{x^2}\,dx = -\frac{1}{x} + C is correct, while 1xdx=ln|x|+C\displaystyle\int \frac{1}{x}\,dx = \ln{|x|}+C is wrong for a different reason.

The perspective in question is complex analysis. Most of the functions encountered in elementary calculus are actually complex-analytic — the only real counterexamples are explicit “piecewise” functions and things like |x|{|x|}, which are mainly introduced as counterexamples to illustrate the meaning of continuity and differentiability. Therefore, it’s not unreasonable to interpret the indefinite integral f(x)dx\displaystyle\int f(x)\,dx as asking for the most general complex-analytic antiderivative of ff. And the complex domain of 1z\frac{1}{z} and 1z 2\frac{1}{z^2} is {0}\mathbb{C}\setminus \{0\}, which is connected!

Thus, for instance, since ddz[1z]=1z 2\frac{d}{d z}\left[-\frac{1}{z}\right] = \frac1{z^2}, it really is true that the most general (complex-analytic) antiderivative of 1z 2\frac{1}{z^2} is 1z+C-\frac{1}{z}+C for a single arbitrary constant CC, so we can write 1z 2dz=1z+C\displaystyle\int \frac{1}{z^2}\,dz = -\frac{1}{z} + C. Note that any such antiderivative has the same domain {0}\mathbb{C}\setminus \{0\} as the original function.

In addition, the dodgy calculation

1 11z 2dz=1z] 1 1=2 \int_{-1}^1 \frac{1}{z^2}\,dz = \left.-\frac{1}{z}\right]_{-1}^1 = -2

is actually correct if we interpret 1 1\int_{-1}^1 to mean the integral along some (in fact, any) curve in \mathbb{C} from 1-1 to 11 that doesn’t pass through the singularity z=0z=0. Of course, this doesn’t offend against signs because any such path must pass through non-real numbers, whose squares can contribute negative real numbers to the integral.

The case of 1zdz\displaystyle\int \frac{1}{z}\,dz is a bit trickier, because the complex logarithm is multi-valued. However, if we’re willing to work with multi-valued functions (which precisely means functions whose domain is a Riemann surface covering some domain in \mathbb{C}), we have such a multi-valued function that I’ll denote log\log (in contrast to the usual real-number function ln\ln) defined on a connected domain, and there we have ddz[log(z)]=1z\frac{d}{d z}\left[ \log(z) \right] = \frac{1}{z}. Thus, the most general (complex-analytic) antiderivative of 1z\frac{1}{z} is log(z)+C\log(z)+C where CC is a single arbitrary constant, so we can write 1zdz=log(z)+C\displaystyle\int \frac{1}{z}\,dz = \log(z) + C.

What happened to ln|x|\ln{|x|}? Well, as it happens, if xx is a negative real number and LogLog denotes the principal branch of the complex logarithm, then Log(x)=ln|x|+iπLog(x) = \ln{|x|} + i\pi, hence ln|x|=Log(x)iπ\ln{|x|} = Log(x) - i\pi. Therefore, the antiderivative ln|x|\ln{|x|} for negative real xx is of the form Log(x)+C\Log(x)+C, where Log\Log is a branch of the complex logarithm and CC is a constant (namely, iπ-i\pi).

Of course it is also true that for positive real xx, the antiderivative ln|x|=ln(x)\ln{|x|} = \ln(x) is of the form Log(x)+C\Log(x)+C for some constant CC, but in this case the constant is 00. And changing the branch of the logarithm changes the constant by 2iπ2i\pi, so it can never make the constants 00 and iπ-i\pi coincide. Thus, unlike 1x+C-\frac{1}{x} +C, the real-number function ln|x|+C\ln{|x|} + C in the “usual answer” is not the restriction to {0}\mathbb{R}\setminus \{0\} of any complex-analytic antiderivative of 1x\frac{1}{x} on a connected domain. This is what I mean by saying that 1xdx=ln|x|+C\displaystyle\int \frac{1}{x}\,dx = \ln{|x|}+C is now wrong for a different reason. And we can see that the analogous dodgy calculation

1 11xdx=ln|x|] 1 1=0 \int_{-1}^1 \frac{1}{x}\,dx = \ln{|x|}\Big]_{-1}^1 = 0

is also still wrong. If γ\gamma is a path from 1-1 to 11 in {0}\mathbb{C}\setminus \{0\}, the value of γ1xdx\int_{\gamma} \frac{1}{x}\,dx depends on γ\gamma, but it never equals 00: it’s always an odd integer multiple of iπi\pi, depending on how many times γ\gamma winds around the origin.

I’m surprised that no one in the previous discussion, including me, brought this up. Of course we probably don’t want to teach our elementary calculus students complex analysis (although I’m experimenting with introducing some complex numbers in second-semester calculus). But this perspective makes me less unhappy about writing 1x 2dx=1x+C\displaystyle\int \frac{1}{x^2}\,dx = -\frac{1}{x} + C and 1xdx=log(x)+C\displaystyle\int \frac{1}{x}\,dx = \log(x) + C (no absolute value!).

Posted at December 3, 2025 2:23 AM UTC

TrackBack URL for this Entry:   https://golem.ph.utexas.edu/cgi-bin/MT-3.0/dxy-tb.fcgi/3624

0 Comments & 0 Trackbacks

Post a New Comment