## The antiderivative of 1/x

## Finding the integral of 1/x

Because we can see that $\frac{1}{x}$ can be written as $x^{-1}$ we’re always tempted to look at the power rule for integration to determine it’s integral, but we can see right away that this doesn’t work because it would lead us to $\frac{1}{0}x^0$ which is of course undefined. Instead we need go back to the definition of antiderivative. Which function has $\frac{1}{x}$ as it’s derivative?

$$\frac{d}{dx} \Big( \ln x \Big) = \frac{1}{x}.$$

This of course gives us that for positive $x$ $$\int \frac{1}{x} \, dx = \ln x + C,$$ but what about negative $x$? We certainly have that $f(x) = \frac{1}{x}$ is defined for negative $x$, and moreover we have that $f(x) = – f(-x)$. In other words $1/x$ is an odd function. Look at the following picture which shows the graph of 1/x:

We can see from this that

$$\begin{eqnarray}-\int_{-t}^{-1} \frac{1}{x} \, dx &=& \int_1^t \frac{1}{x} \, dx\\ &=& \ln t – \ln 1 = \ln t.\end{eqnarray}$$

Moreover if $F(x)$ is an antiderivative of $1/x$ (even for $x<0$), then from the Fundamental Theorem of Calculus we know that $$\begin{eqnarray} F(-t) - F(-1) &= &-\big(F(-1) - F(-t)\big) \\ & = & -\int_{-t}^{-1} \frac{1}{x} \, dx\\ & = & \ln t \end{eqnarray}$$

This certainly suggests that one possible choice of antiderivative of $1/x$ when $x< 0$ is $\ln (-x)$. Now let's check what happens:
$$\frac{d}{dx} \Big( \ln(-x) \Big) = - \frac{1}{-x} = \frac{1}{x}$$.
Therefore $\ln(-x)$ is an antiderivative for $1/x$ for $x<0$. This means that an antiderivative for $1/x$ for $x\ne 0$ is given by $$F(x) = \begin{cases}\ln(-x) & x< 0 \\ \ln x & x>0 \end{cases}$$

which can be rewritten as $\ln |x|$. Written with the constant of integration we say

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

#### Example

What is $\displaystyle \int_{-6}^{-1} \frac{1}{x}\, dx$?

#### Solution

We can use the Fundamental Theorem of Calculus together with the antiderivative we just derived to say that

$$\int_{-6}^{-1} \frac{1}{x} \, dx = \ln|-1| – \ln |-6| = \ln 1 – \ln 6 = -\ln 6.$$

#### Example

Use u-substitution to find the integral of $\displaystyle \int \tan x \, dx$.

#### Solution

We can start by rewriting $\tan x = \frac{\sin x}{\cos x}$, therefore we can use the substitution $u = \cos x$, which gives $du = -\sin x\, dx.$ This gives us

$$\begin{eqnarray}

\int \frac{\sin x}{\cos x} \, dx &=& -\int \frac{1}{u}du \\

& = & – \ln |u| + C \\

& = & – \ln|\cos x| + C

\end{eqnarray}$$

This can also be rewritten using logarithm rules as $\int \tan x \, dx = \ln |\sec x| + C$.

## Watch out for $x=0$!

One thing we need to watch out for is that we don’t try and apply the Fundamental Theorem of Calculus on an interval that contains 0! Let’s start with a quick refresher on what’s usually called the 2nd Fundamental Theorem of Calculus

#### The 2nd Fundamental Theorem of Calculus

Let $f$ be a function on the closed interval $[a,b]$ and $F$ a **continuous** function on $[a,b]$ which is an antiderivative of $f$ in $(a,b)$. Then

$$\int_a^b f(x) dx = F(b)- F(a).$$

The key point here is that $F(x)$ must be continuous (and defined)! For $\frac{1}{x}$ we have $\ln |x|+C$ as our antiderivative, but this isn’t even defined, much less continuous at $x=0$.

#### Example

Dogl claims that

$$\int_{-2}^1 \frac{1}{x}\, dx = \ln 1 – \ln 2.$$

Dogl’s friend Godl says that doesn’t make sense because if that was the case then you would have

$$\begin{eqnarray}

\int_{-2}^1 \frac{1}{x}\, dx &=& \int_{-2}^0 \frac{1}{x}\, dx + \int_0^{1} \frac{1}{x} \, dx\\

&=& \infty – \ln 2 + \ln 1 -\infty\end{eqnarray}$$

but we can’t just cancel $\infty$s, so this integral actually doesn’t give a real number.

Who is right? Dogl, Godl or neither?

#### Solution

Godl is right that we can’t use the fundamental theorem on the interval $[-2,1]$ because $\ln |x|$ isn’t continuous (or defined) at $x=0$, but we also can’t use the fundamental theorem on $[-2,0]$ and $[0,1]$ because $\ln |x|$ isn’t defined at $0$ (and so not continuous on $[0,1]$ or $[-2,0]$. This means that both Dogl and Godl are wrong, but at least noticed the thing we need to watch out for even if their explanation needs work.

To deal with these we actually need to treat is as an improper integrals! Keep reading to learn how ðŸ™‚

## Improper integrals and 1/x

An improper integral is an integral where one (or both) of the endpoints of integration is either a vertical asymptote or $\pm \infty$. The function $f(x) = \frac{1}{x}$ has a vertical asymptote at $x=0$, so if $0$ or $\pm \infty$ is a limit of integration we need to treat the integral as an improper integral. Let’s see what this looks like:

$$

\begin{eqnarray}

\int_0^1 \frac{1}{x}\, dx & = & \lim_{L \to 0^+} \int_L^1 \frac{1}{x} \, dx\\

&=& \lim_{L\to 0^+} \ln|1| – \ln|L|\\

&=& \infty.

\end{eqnarray}$$

By adding in the limit we are able to move the lower limit of integration away from $0$, which means we can apply the Fundamental Theorem of Calculus. Then taking the limit we can see that this integral is $\infty$ (or undefined, depending on your textbook).

#### Example

What is $\displaystyle \int_{-e}^0 \frac{1}{x}\, dx$?

#### Solution

$$

\begin{eqnarray}

\int_{-e}^0 \frac{1}{x}\, dx & = & \lim_{L \to 0^-} \int_{-e}^L \frac{1}{x} \, dx\\

&=& \lim_{L\to 0^-} \ln|L| – \ln|-e|\\

&=& \infty.

\end{eqnarray}$$

Now let’s look at an example where one of the limits of integration is $\infty$.

$$

\begin{eqnarray}

\int_2^\infty \frac{1}{x}\, dx & = & \lim_{L \to \infty} \int_2^L \frac{1}{x} \, dx\\

&=& \lim_{L\to \infty} \ln|L| – \ln|2|\\

&=& \infty.

\end{eqnarray}$$

By adding in the limit we are able to replace the upper limit of integration with a real number $L$, which means we can apply the Fundamental Theorem of Calculus. Then taking the limit we can see that this integral is $\infty$ (or undefined, depending on your textbook).

#### Example

What is $\displaystyle \int_{-\infty}^{-1} \frac{1}{x} \, dx$?

#### Solution

$$

\begin{eqnarray}

\int_{-\infty}^{-1} \frac{1}{x}\, dx & = & \lim_{L \to -\infty} \int_L^{-1} \frac{1}{x} \, dx\\

&=& \lim_{L\to -\infty} \ln|-1| – \ln|L|\\

&=& -\infty.

\end{eqnarray}$$