Solve the following integrals:

\(\displaystyle{\int_{2}^{3} \dfrac{1}{x} \, dx}\)

- \(\displaystyle{\int_{-3}^{-2} \dfrac{1}{x} \, dx}\)

A good starting point is to draw a diagram.

As \(\tfrac{1}{x}\) is an odd function, the two shaded areas that represent the integrals should be the same. However, one of the areas is below the \(x\)-axis which suggests that \[\displaystyle{\int_{-3}^{-2} \dfrac{1}{x} \, dx} = - \displaystyle{\int_{2}^{3} \dfrac{1}{x} \, dx}.\]

If we solve the first integral we get \[\begin{align*} \displaystyle{\int_{2}^{3} \dfrac{1}{x} \, dx} &= \big[\ln x \big]_{2}^{3} \\ &= \ln (3) - \ln (2) \\ &= \ln \frac{3}{2}. \end{align*}\]What are the problems with this calculation to find the second integral?

\[\begin{align*} \displaystyle{\int_{-3}^{-2} \dfrac{1}{x} \, dx} &= \big[\ln x \big]_{-3}^{-2} \\ &= \ln (-2) - \ln (-3) \\ &= \ln \frac{2}{3} \end{align*}\]Does this match with our geometrical reasoning at the beginning? We thought that \[\displaystyle{\int_{-3}^{-2} \dfrac{1}{x} \, dx} = - \displaystyle{\int_{2}^{3} \dfrac{1}{x} \, dx},\]

and using the laws of logarithms we can show that \(\ln \frac{2}{3} = -\ln \frac{3}{2}\), which is as expected.

Taking the absolute value of \(x\) means that we aren’t trying to take the logarithm of a negative number. Why is it possible to do this? We explore below why the integral can be written in this form.

Sketch the following functions along with their gradient functions on the same set of axes.

- \(f(x) = \ln (x)\)
- \(g(x) = \ln (-x)\)

What are the domains of \(f(x)\) and \(g(x)\)?

The domain of \(f(x) = \ln x\) is \(x > 0\) and the domain of \(g(x) = \ln(-x)\) is \(x < 0\).

Using your sketch to help you, write down the derivatives of \(f(x)\) and \(g(x)\).

The gradient function of \(f(x)\) is \(f'(x) = \tfrac{1}{x}, x >0\).

As \(\ln(-x)\) is a reflection of \(\ln x\) in the \(y\)-axis, the gradient of \(\ln(-x)\) will be the negative of the gradient of \(\ln x\) at symmetrical points. By also looking at the sketch of the gradient function of \(g(x)\), it seems reasonable to conclude that \(g'(x) = \tfrac{1}{x}\), when \(x <0\).

What do you notice about the derivatives \(f'(x)\) and \(g'(x)\)?

Interestingly, the two functions \(f\) and \(g\), differentiate to different sections of the same function, \(\tfrac{1}{x}\). It seems that the function \(\tfrac{1}{x}\) has two different antiderivatives, depending on the domain. This means we can write the integral of \(\tfrac{1}{x}\) as a piecewise function.

\[\int \dfrac{1}{x} \, dx = \begin{cases} \ln x + c & \text{if } x > 0 \\ \ln(-x) + d & \text{if } x < 0 \end{cases}\]

But \(\ln |x|\) can also be written as a piecewise function

\[\ln |x| = \begin{cases} \ln x & \text{if } x > 0 \\ \ln(-x) & \text{if } x < 0 \end{cases}\]

and so the integral is sometimes written as

\[\int \dfrac{1}{x} \, dx = \ln |x| + c.\]

The absolute value sign isn’t there to let us take logarithms of negative numbers, but because we are actually combining two different antiderivative functions. While writing \(\ln |x|\) is a way to encompass both functions, we need to be careful that we remember that it is two separate functions, one for \(x > 0\) and one for \(x < 0\).