Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

$$\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$$

share|cite|improve this question
$\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 8:28
Because ln is not defined for negative values of $x$, whereas the function in the integral is. – Amitai Yuval Aug 25 '14 at 8:28
Btw, why is it that the base of the log is e. Couldn't it be anything? – Nick Aug 25 '14 at 8: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: – StudentsTea Aug 25 '14 at 9:08
@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 9:32
up vote 5 down vote accepted

$\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.$$

share|cite|improve this answer
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 9:42

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} $$

share|cite|improve this answer
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 9:11
@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 9:16

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).

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.