50

$$\int\frac{1}{x}dx=\ln| x |+C$$

Why the absolute value? Why is the following not valid:

$$\int\frac{1}{x}dx=\ln x+C$$

user153012
  • 12,240
StudentsTea
  • 2,218
  • 1
    $\int_{-2}^{-1}\frac{1}{x}dx$ has a value, however $\ln(-1)$ and $\ln(-2)$ will be more complicated to evaluate... – Surb Aug 25 '14 at 08:28
  • 16
    Because ln is not defined for negative values of $x$, whereas the function in the integral is. – Amitai Yuval Aug 25 '14 at 08:28
  • Btw, why is it that the base of the log is e. Couldn't it be anything? – Nick Aug 25 '14 at 08:47
  • @Nick - I believe it has something to do with the customary proof of $\frac{d}{dx}b^{x}$ for $b > 0$ using the first principles of differentiation.

    It came up in a previous question I posted a couple days ago: http://math.stackexchange.com/a/905510/170148

    – StudentsTea Aug 25 '14 at 09:08
  • 1
    @Nick. It's because the Euler number (or Napier's constant) is defined as the unique number such that the area between the hyperbola $y=1/x$, the x-axis, and the vertical lines $x=1$ and $x=e$, is $1$. That is: $\int\limits_1^e x^{-1} \operatorname{d} x = 1$. – Graham Kemp Aug 25 '14 at 09:32
  • @Amitai The function in the integral is also defined for complex values, for which the second formula is valid (with any branch of $\ln$) whereas the first one is not, its RHS is not even analytic. This is just a convention, utility of which depends on one's applications, and the latter is "valid" more broadly. – Conifold Aug 23 '16 at 21:51
  • @Conifold, what do you mean by more broadly? If I play with reals, the latter solution is wrong, isn't it? – Enlico Jan 30 '18 at 17:41

5 Answers5

53

For $x$ positive: $ \frac{d}{dx}\ln{x}=\frac{1}{x} $

For $x$ negative: $ \frac{d}{dx}\ln{(-x)}=\frac{-1}{-x}=\frac{1}{x} $

So when you're integrating $\frac{1}{x}$, if $x$ is positive you'll get $\ln{x}+C$, and if $x$ is negative you'll get $\ln{(-x)}+C$. To summarize $\ln{|x|} + C$.

And if you want to know $\int\frac{1}{x}dx$ is not exactly equal to $\ln|x|+C$. The constants could be different for positive or negative $x$.

$$ \int\frac{1}{x}dx = \begin{cases} \ln{x} + C_1 \qquad \text{for $x$ positive} \\ \ln{(-x)} + C_2 \qquad \text{for $x$ negative} \end{cases} $$

  • Thank you!

    I've always thought that, if $\frac{a}{b} = \frac{-a}{-b}$, it seemed a bit superfluous to express that concept as $|\ \frac{a}{b}\ |$. Why don't we simply express it as $\frac{a}{b}$?

    – StudentsTea Aug 25 '14 at 09:11
  • 8
    @LMiz, $\frac{a}{b}$ is the same as $\frac{-a}{-b}$ and we don't express it as $|\frac{a}{b}|$; we simply express it as $\frac{a}{b}$. In $\ln{|x|}$, the absolute value sign is there, because $\ln{x}$ is not defined for negative $x$. You're confusion is probably because, $\ln{x}$ and $\ln{(-x)}$ are different functions with similar looking but different derivatives. – kptlronyttcna Aug 25 '14 at 09:16
  • $\frac{d}{dx}\ln{(-x)}=\frac{-1}{-x}$ by application of the chain rule. – Papa Smurf Mar 10 '22 at 18:44
18

$\int_{-2}^{-1}\frac{1}{x}dx$ has a value, however $\ln(-1)$ and $\ln(-2)$ will be more complicated to evaluate since $\ln(x)$ is only defined on $\mathbb{R}$ for positive numbers... Actually since $\frac{1}{x} = -\frac{1}{-x}$ for every $x$, we have $$\ln(|-1|)-\ln(|-2|)=\int_{-2}^{-1}\frac{1}{x}dx=\int_2^1\frac{1}{x}dx = \ln(1)-\ln(2) = \ln\left(\frac{1}{2}\right)<0.$$

Did
  • 279,727
Surb
  • 55,662
  • Also, plugging the limits in directly works as well, even if it's not the most technically correct method: $\ln(-1) - \ln(-2) = \ln(\frac{-1}{-2}) = \ln(\frac{1}{2})$ – Mateen Ulhaq Apr 13 '15 at 09:42
  • 5
    I would mention it still works out the same if you use the complex answer. $\ln(-1) = \ln(1) - i\pi$, so if $a,b > 0$ then $\ln(-b) - \ln(-a) = (\ln(b) - i\pi) - (\ln(a) -i\pi) = \ln(b) - \ln(a)$. So this is really just a technique for avoiding complex numbers. – Joseph Garvin Aug 03 '18 at 14:13
8

Your range of integration can't include zero, or the integral will be undefined by most of the standard ways of defining integrals. So we have to think of a range of integration which is strictly positive, or strictly negative.

What you wrote is perfectly valid for strictly positive x, so let's think about strictly negative x. We have

$\int_{-a}^{-b}\frac{1}{x}d x$

where $a>0$ and $b>0$, so the range of integration is strictly negative. Do a change of variables, $y=-x$. Then

$\int_{a}^{b}\frac{1}{y}d y$.

(There is a negative from the $y$ in the denominator, and $d x=-d y$, so the two negatives cancel.) We have converted the integral of $1/x$ over a strictly negative range to an integral of $1/y$ over a strictly positive range. The answer is $\ln b-\ln a$. Since the $y$ is just a variable of integration, we can replace it with $x$ if we like, and

$\int_{-a}^{-b}\frac{1}{x}d x=\int_{a}^{b}\frac{1}{x}d x$.

That's the definite integral; the analogous result for the indefinite integral is

$\int^{-x}\frac{1}{x}d x=\int^{x}\frac{1}{x}d x$ (to within a constant of integration).

2

I will offer a very simple intuitive approach.

If we take: $$ln(x)=\int_{1}^x \frac1u du$$

We find that $u=0$ is a point of discontinuity for the function $1/u$. So, you might notice that, for example, that for $ln(x)$, as $x$ approaches $0$, the function $ln(x)$ increases "beyond all bounds" in the negative direction, or that $ln(1)=0$: $$ln(1)=\int_{1}^1 \frac1u du=0$$


Supplement - If we take $F(x)$ as any primitive function and keeping in mind of the fundamental theorem of calculus where any primitive function differ only by a constant (in this case, the indefinite integral(s) of the natural logarithm, differing by a constant, makes intuitive sense) such that: $$F(x)=ln(x)+c=\int_{1}^x \frac1u du +c$$ $$\frac{d}{dx}F(x)=\frac{d}{dx}(ln(x)+c)=1/x$$

To be specific, the definition of the primitive function here is merely just $\frac{d}{dx}F(x)=f(x)$.


This answer is just to offer some basic intuitive sprinkle on the agreeable assertion "Your range of integration can't include zero..."@Роберт

Further Supplement - For further basic intuition, notice that $1/u$ as defined for the domain $(0,1]$ lacks a uniform modulus of continuity. However, the existence of a uniform modulus of continuity is implicit in the existence of any integral (as suggested by e.g. Bolzano–Weierstrass theorem etc., and in where I would say as according to the traditional definition of an integral as suggested by e.g. $\lim \limits_{\Delta x \to 0}\sum_{i}={f(x_i)}{\Delta x}$ defined for the interval $[a,b]$ such that $a+0\Delta x=a$ and $a+n\Delta x=b$ etc.).

1

The function $f(x)=\frac{1}{x}$ is not integrable on any interval that contains $x=0$. Therefore, any integral of this function is on an interval that is either entirely positive or entirely negative.

Let $[a,b]$ be such an interval.

Case 1: $0<a<b$

$$\int_a^b \frac{1}{x}dx=\log(b)-\log(a)$$

This is by definition, since the natural logarithm is defined as

$$\log(x)=\int_1^x \frac{1}{x}dx, \text{ for }x>0$$

hence

$$\int_a^b \frac{1}{x}dx=\int_1^b \frac{1}{x}dx - \int_1^a \frac{1}{x}dx=\log(b)-\log(a)$$

Now, there are of course infinitely many other functions whose derivatives are $\frac{1}{x}$. By the first fundamental theorem of calculus, since, $\frac{1}{x}$ is continuous on $(0,\infty)$, any function $F(x)=\int_{x_0}^x \frac{1}{x}dx$ with $0<x_0<x$ is such that $F'(x)=\frac{1}{x}$.

Such a function can be rewritten as $$F(x)=\int_1^x \frac{1}{x}dx-\int_1^{x_0} \frac{1}{x}dx$$

$$=\log(x)-\log(x_0)$$

Hence, for any of such functions we still have

$$\int_a^b\frac{1}{x}dx=(\log(b)-\log(x_0))-(\log(a)-\log(x_0))$$

$$=\log(b)-\log(a)$$

$$=\log(|b|)-\log(|a|)$$

Now we have the tricky case.

Case 2: $a<b<0$

We want $\int_a^b\frac{1}{x}dx$.

Let $f(x)=\frac{1}{x}$, and here is its graph

enter image description here

The quick argument here is that, by symmetry

$$\int_a^b \frac{1}{x}=-\int_{-b}^{-a}\frac{1}{x}\tag{1}$$

and hence, since the right side involves a positive interval, we know how to compute it

$$=-(\log{(-a)}-\log{(-b)})=\log(|b|)-\log(|a|)$$

Thus in both cases, we have

$$\int_a^b \frac{1}{x}=\log(|b|)-\log(|a|)$$

Addendum

What does "by symmetry" mean more precisely in that first step (1)?

As far as I can tell, it boils down to an argument based on the definition of the integrals involved. Such an argument is not necessary to understand the symmetry, since it is quite obvious, but to understand what is going on under the hood I think the proof of the symmetry would involve going through calculations such as the following.

Let $P=\{a=t_0,t_1,...,t_n=b\}$ be a partition of $[a,b]$ and $Q=\{-b=-t_n, -t_{n-1},...,-t_0=-a \}$ be a partition of $[-b,-a]$. Then

$$L(f,P)=\sum\limits_{i=1}^n \frac{1}{t_i}(t_i-t_{i-1})=\sum\limits_{i=1}^n \frac{1}{-t_i}(-t_{i-1}-(-t_i))$$ $$=\sum\limits_{i=1}^n \frac{1}{-t_i}(t_i-t_{i-1})=-U(f,Q)\tag{2}$$

$$U(f,P)=\sum\limits_{i=1}^n \frac{1}{t_{i-1}}(t_i-t_{i-1})=\sum\limits_{i=1}^n \frac{1}{-t_{i-1}}(-t_{i-1}-(-t_i))$$ $$=\sum\limits_{i=1}^n \frac{1}{-t_{i-1}}(t_i-t_{i-1})=-L(f,Q)\tag{3}$$

where $L(f,P)$ is the lower sum of $f$ for partition $P$, and $U(f,P)$ is the upper sum of $f$ for partition $P$.

By definition $\int_a^b f=\sup{L(f,P)}=\inf{U(f,P)}$ and $\int_{-b}^{-a} f=\sup{L(f,Q)}=\inf{U(f,Q)}$

But from (2) and (3) we also have that $\sup{L(f,P)}=\sup{[-U(f,Q)]}=-\inf{U(f,Q)}$ and $\inf{U(f,P)}=\inf{[-L(f,Q)]}=-\sup{L(f,Q)}$

Thus

$$\int_a^b f=-\int_{-b}^{-a}f$$

xoux
  • 4,913