11

There is a general (mis)conception that

$$\int \frac{1}{x} \, \mathrm{d}x = \ln|x| + C \label{1} \tag{1}$$

However, taking the indefinite integral as the set of all functions whose derivative is $\frac{1}{x}$, the technically correct answer should be

$$\int \frac{1}{x} \, \mathrm{d}x = \begin{cases} \ln(x) + C & \text{if $x > 0$} \\ \ln(-x) + D & \text{if $x < 0$} \end{cases} \label{2} \tag{2}$$

See Your calculus prof lied to you (probably) for more details.

Is $\eqref{2}$ correct and is $\eqref{1}$ incorrect? Or are they both acceptable?

I suppose $\eqref{2}$ is more correct but it perhaps doesn’t have any additional value compared to $\eqref{1}$ as the definite integral will give the same result for both (as the integral diverges if we move from the negative to positive $x$-axis).

Is there any other example where failing to define a piecewise function (with separate constants) as an integral can have serious consequences?

  • Okay, how do you define $|x|$? Probably piecewise. – Sean Roberson Jun 06 '22 at 17:23
  • @SeanRoberson But the constants will be necessarily the same for the first definition, not second. –  Jun 06 '22 at 17:24
  • 3
    How would you use (2) to evaluate $\int_{-2}^3 \frac{1}{x} ; dx$? – B. Goddard Jun 06 '22 at 17:28
  • 1
    @B.Goddard $\infty - \infty$ so diverges? –  Jun 06 '22 at 17:29
  • 3
    @B.Goddard you wouldn't, as the function is not Riemann integrable on $[-2,3]$, even in the improper sense – Lorago Jun 06 '22 at 17:31
  • @Lorago Right. You would never use both parts of that formula at the same time. It's no better than (1) and no more correct. – B. Goddard Jun 06 '22 at 17:32
  • (1) is correct if it's understood $C$ denotes a locally constant function of domain $\Bbb R\setminus{0}$, the domain of $1/x$ (if it's $\Bbb C\setminus{0}$ instead, we could get into some of the most important results of complex analysis). See also here for a very high-level take on this. So if $a<b$, $\int_a^bdx/x$ is defined iff all such LCFs are constant on $[a,,b]$. – J.G. Jun 06 '22 at 17:45
  • @J.G. Can you add an answer elaborating on the true meaning of $C$? –  Jun 06 '22 at 17:56
  • I could, but I thought your question was whether other examples of this phenomenon exist. – J.G. Jun 06 '22 at 18:13
  • @J.G. The other examples were only to get a better understanding of what’s going on here and the bigger picture with regards to piecewise integrals. If examples are not needed, no problem. –  Jun 06 '22 at 18:15
  • Some somewhat related questions: https://math.stackexchange.com/questions/206032/what-is-the-integral-of-1-x, https://math.stackexchange.com/questions/2720780/antiderivative-of-1-x-why-can-c-1-and-c-2-differ, https://math.stackexchange.com/questions/2353086/indefinite-integral-of-1-x-two-different-constant-terms-on-each-side-of-the-y – Hans Lundmark Jun 06 '22 at 19:50
  • If someone integrated from $\frac1x$ from $-2$ to $-1$, then, just use the primitive $\int \frac{dx}x=\ln(x)$ to find $\int_{-2}^{-1} \frac1x dx=\ln(-1)-\ln(-2)=\ln\left(\frac{-1}{-2}\right)=-\ln(2)$, so no piecewise function nor absolute value needed. How about integration on a complex interval? – Тyma Gaidash Jun 07 '22 at 02:30

6 Answers6

14

Whenever you see a formula in the form of $$ \int f(x)\;dx = F(x)+C\;\tag{*} $$ there is implicitly some open interval $I$ that is the subset of the "natural domain" of the function $f$. The formula is interpreted as all the solutions to the differential equation $$ F'(x)=f(x),\quad\quad x\in I\;.\tag{**} $$

In this context, the important property of open intervals is that they are connected, and that's why one has only one "arbitrary constant $C$".

In the case when $f(x)=\frac1x$, the natural domain $D=\mathbf{R}\setminus\{0\}$ is not connected. Then ($*$) is true for any given open interval $I\subset D$.

However, if one wishes to express the solution set to the differential equation $$ F'(x)=\frac1x,\quad x\in D=\mathbf{R}\setminus\{0\}\;, $$ one needs two arbitrary constants, basically because there are two connected components of the domain $D$. That is what you write in (2) of your post.


So when one has a piecewise-defined function $f:D\to\mathbf{R}$ where the domain $D$ is not connected and if one wants to use $\int f(x)\; dx$ to express the set of all the solutions to the differential equation $$ F'(x) = f(x)\quad x\in D\;, $$ then one needs more than one "arbitrary constant", depending on the number of connected components of $D$. For instance, let $D=(0,1)\cup (2,3)\cup(4,5)$ and define $f:D\to\mathbf{R}$ with $f(x)=0$ for every $x\in D$. Then the solution set to $$ F'(x)=f(x)\;,\quad x\in D $$ is $$ F(x)=\begin{cases} C_1\;,&x\in(0,1)\\ C_2\;,&x\in(2,3)\\ C_3\;,&x\in(4,5) \end{cases}\;. $$

Another more frequently seen example in calculus exercises is the following. Suppose after performing partial fraction decomposition one has $$ f(x)=\frac{1}{x}+\frac{1}{x-1}\;. $$ Note that the natural domain for $f$ is $D=\mathbf{R}\setminus\{0,1\}$, which has three connected components. One usually write $$ \int \frac{1}{x}+\frac{1}{x-1}\;dx = \ln|x|+\ln|x-1|+C $$ which is again, understood as solutions to ($**$) where $I$ is some connected subset of $D$.

  • Yes, I believe this is related to a corollary of the Mean Value Theorem (as mentioned in the linked video). –  Jun 06 '22 at 17:50
  • @Random: So answer your question in short: (1) and (2) are both correct as long as they are understood within the appropriate context. –  Jun 06 '22 at 17:52
  • So only $1$ constant would be incorrect in the context of $\mathbb{R}\setminus{0}$ as this is not an open interval? –  Jun 06 '22 at 18:25
  • @Random: That is correct. If one wishes to use $\int \frac1x;dx$ to denote the solution set to the differential equation $F'(x)=\frac1x,\quad x\in\mathbf{R}\setminus{0}$, then one needs two constants as you wrote in (2). –  Jun 06 '22 at 18:28
  • So would writing only $\int \frac{1}{x} , \mathrm{d}x = \ln |x| + C$ be wrong? Or are the $2$ constants understood? –  Jun 06 '22 at 18:30
  • @Random: As written in the answer $\int \frac1x;dx=\ln|x|+C$ is understood as one only the function on some open interval that does not contain the origin; for instance $I=(-4,-1)$. If you wish to consider the whole natural domain $\mathbf{R}\setminus{0}$, then it is incorrect to write $\ln|x|+C$. –  Jun 06 '22 at 18:34
  • @Random: in your (2), you can replace $\ln(-x)$ with $\ln|x|$; they are the same thing when $x<0$. Likewise, you can replace $\ln(x)$ with $\ln|x|$ in (2) for trivial reasons. –  Jun 06 '22 at 18:35
5

If your goal is just to calculate definite integrals, then indeed the correct formula (2) has no more use than the sloppy one (1), because you will never integrate across a vertical asymptote, so you will not use both formulae at the same time.

However remember that computing definite integrals is not the only point of integration. The indefinite integral asks "what functions have ... as their derivative". And then formula (1) is just not the full answer. It makes you believe that all antiderivatives of $y=1/x$ look like these:

enter image description here

But in reality, there are many more, and they are only visible in formula (2). Here are two of them:

enter image description here

So if "additional value" means that you understand how many different antiderivatives a function can have, here it is. Note this will be far more striking if you ever want to solve differential equations.

Finally, the same matter happens with any real function whose domain has more than one connected component, e.g. as soon as there are vertical asymptotes. For example, the correct indefinite integral of $f(x)=\frac{1}{(x-7)^3}$ is indeed

$\displaystyle \int \frac{1}{(x-7)^3} dx = \begin{cases} -\frac{1}{2}\dfrac{1}{(x-7)^2}+C \text{ if } x < 7 \\ -\frac{1}{2}\dfrac{1}{(x-7)^2}+D \text{ if } x > 7 \end{cases}$,

and for $\displaystyle \int \frac{dx}{(x-7)(2x+1)(3x-4)(x+12)}$ you will "technically" need five independent constants on the five connected components of its domain.

1

This is the case for any function where the domain is not connected. For example:

$$\begin{align} f:\Bbb R\!\setminus\!\{0\} &\to \Bbb R \\ x&\mapsto 1 \end{align}$$

we also have

$$\int f(x)\,dx = \begin{cases} x+C,& x < 0 \\ x+D,& x > 0 \\ \end{cases}$$

Yet, I would still prefer the notation $$\int f(x)\,dx = x+C$$ for brevity; bearing in mind that this only holds for each connected component of the domain individually.


Reply to comment:

$|x|+C,D$ is not a good notation and confusing. And gets even more cumbersome if there are more (infinitely many) connected components like in $f:\Bbb R\!\setminus\!\Bbb Z\to\Bbb R$.

That $|x|$ is defined piecewise is not an issue here because usually, its domain is all of $\Bbb R$. For example, if we take

$$\begin{align} g:\Bbb R\!\setminus\!\{1\} &\to \Bbb R \\ x&\mapsto |x| \end{align}$$ then the trouble when integrating $g$ is at $x=1$, not at $x=0$. Even if $g$ had a jump at $x=0$ would be no issue.

In the case of $g$, the integral could be written as

$$\int g(x)\,dx = \begin{cases} |x|\cdot\operatorname{sign} x + C,& x < 1 \\ |x|\cdot\operatorname{sign} x + D,& x > 1 \\ \end{cases}$$ Yes, one could simplify that in the case $x>1$ because the signum is always 1 and $x=|x|$. But writing $\int g(x)\,dx = |x|\operatorname{sign} x + C$ is still easier to grasp.

Then there is a question for why to add "+ C" after each and every indefinite integral; it's clear that you get a set of functions that, when derived, give the integrand.

emacs drives me nuts
  • 10,390
  • 2
  • 12
  • 31
1

$$\int \frac{1}{x} \, \mathrm{d}x = \ln|x| + C \tag{1}$$

$$\int \frac{1}{x} \, \mathrm{d}x = \begin{cases} \ln(x) + C & \text{if $x > 0$} \\ \ln(-x) + D & \text{if $x < 0$} \end{cases}\tag{2}$$

I suppose $(2)$ is more correct but it perhaps doesn’t have any additional value compared to $(1)$ as the definite integral will give the same result for both

The main value of presentation $(2)$ over presentation $(1)$ is paedagogical: it explicitly reminds us that $\displaystyle\frac1x$ has a break at $0$ (and to be cautious about attempting to integrate it on, say, $[0,5]$—notwithstanding the fact that $\displaystyle∫_0^5\frac{\mathrm dx}{\sqrt x}$ does converge).

It's a nice bonus that presentation $(2)$ exhibits the requisite independent parameters $C$ and $D$ (as opposed to the sole parameter in the indefinite integral of $|x|;$ see How many arbitrary constants to put in these integrals?), however this may just be of technical interest.

ryang
  • 38,879
  • 14
  • 81
  • 179
0

You are correct that the general form of an antiderivative of $\frac1x$ on $\Bbb R\setminus\{0\}$ will have two constants, one of either side of the origin. (If you want to be strict about it, it is most proper that the two constants differ by $i\pi$, for complex analysis reasons.)

For definite integrals, you can't really cross $0$ in any conventional way. So it doesn't matter whether you have a single constant or two. So for simplicity we only use one.

Indefinite integrals are either thought of as antiderivatives or as definite integrals with unknown and implied boundaries. Depending on which one indefinite integrals mean to you, that will dictate whether you should have one constant or two.

Arthur
  • 199,419
  • Please merge your $2$ answers? –  Jun 06 '22 at 17:51
  • @Random Of course, sorry. – Arthur Jun 06 '22 at 17:55
  • If you are finding the antiderivative on the interval $\mathbb R\setminus{0}$, then how could the constants differ by $i\pi$? – Joe Jun 06 '22 at 17:57
  • @Joe If you try to find an antiderivative on $\Bbb C\setminus{0}$, and you pick one that's as nice as possible, then the constant on the positive real line and on the negative real line will differ by $i\pi$. So if you want two constants, then that's the most proper relationship between them. If you don't care about complex analysis, then you don't have to read the part of this answer that's put aside in brackets. – Arthur Jun 06 '22 at 18:13
0

Use the notion of pseudo-constants, differentiable functions whose derivative is zero on their domain. My replies to comments on the video at https://youtu.be/u4kex7hDC2o give definitions and results and examples, based upon published work with Charatonik (r.i.p.) on absolute differentiation in metric spaces and unpublished work with him on differentiation in topological fields. In this special case, formulas (1) and (2) are unified in a formula that replaces C with a component-wise constant function and while I think that you're probably deluding yourself about your understanding if you use the term "arbitrary", feel free to call it "an arbitrary pseudo-constant".