# Integration of Logarithmic Functions

The derivative of the logarithm \( \ln x \) is \( \frac{1}{x} \), but what is the antiderivative? This turns out to be a little trickier, and has to be done using a clever integration by parts.

The logarithm is a basic function from which many other functions are built, so learning to integrate it substantially broadens the kinds of integrals we can tackle.

#### Contents

## Integrating \( \ln x \)

\[\int \ln(x)\ dx = x\ln (x) - x + C\]

In the equation above, \(C\) is the constant of integration, and this notation \(C\) will be used throughout the wiki.

For this solution, we will use integration by parts:

\[\int f(x) g'(x)\ dx = f(x) g(x) - \int f'(x) g(x)\ dx.\]

We use \(f(x)=\ln(x)\) and \(g'(x)=1\), which means that \(g(x)=x\). Plugging these into our integration by parts formula, we get

\[ \begin{align} \int 1 \cdot \ln(x)\ dx&=x \ln(x) - \int \big(\ln(x)\big)' x\ dx\\&=x \ln(x) - \int \frac{x}{x}\ dx\\&=x \ln(x) - x + C. \end{align} \]

We can factorize a bit and get the desired formula

\[\int \ln(x)\ dx = x\big(\ln(x) - 1\big) + C.\ _\square\]

This shows that an unlikely application of an integration technique can actually be the right way forward!

Now that we know how to integrate this, let's apply the properties of logarithms to see how to work with similar problems.

Evaluate \( \displaystyle{\int \ln 2x \, dx} \).

According to the properties of logarithms, we know that

\[\ln 2x=\ln x+\ln2,\]

and thus

\[\begin{align} \int\ln2x~dx&=\int\left(\ln x+\ln2\right)~dx\\ &=\int\ln x~dx+\int\ln2~dx\\ &=x\ln x-x+x\ln2+C.\ _\square \end{align}\]

Evaluate \(\displaystyle{\int\log x~dx}.\)

According to the properties of logarithms, we have

\[\log x=\frac{\ln x}{\ln10}.\]

Hence the given integral can be rewritten as

\[\int\log x~dx=\int\frac{\ln x}{\ln10}~dx=\frac{1}{\ln10}x(\ln x-1)+C.\ _\square\]

When integrating the logarithm of a polynomial with at least two terms, the technique of \(u\)-substitution is needed. The following are some examples of integrating logarithms via U-substitution:

Evaluate \(\displaystyle{ \int \ln (2x+3) \, dx} \).

For this problem, we use \(u\)-substitution. Let \(u=2x+3.\) Then we have \(du=2dx,\) or \(dx=\frac{1}{2}du,\) and the given integral can be rewritten as follows:

\[\begin{align} \int\ln(2x+3)~dx&=\frac{1}{2}\int\ln u~du\\ &=\frac{1}{2}u(\ln u-1)+C\\ &=\frac{2x+3}{2}\big(\ln(2x+3)-1\big)+C.\ _\square \end{align}\]

Evaluate \( \displaystyle{\int \ln (x-2)^3 \, dx} \).

According to the properties of logarithms, we have

\[\int \ln (x-2)^3 \, dx=3\int\ln(x-2)~dx.\]

Now let \(u=x-2.\) Then we have \(du=dx,\) and the integral can be rewritten as follows:

\[\begin{align} \int \ln (x-2)^3 \, dx&=3\int\ln(x-2)~dx\\ &=3\int\ln u~du\\ &=3u(\ln u-1)+C\\ &=3(x-2)\big(\ln(x-2)-1\big)+C.\ _\square \end{align}\]

## Integrating Functions of \( \ln x \)

We now look at examples where we're integrating functions of \( \ln x \). These problems often require familiarity with integration by parts, \(u\)-substitution and \(\ln |f|\) form.

Evaluate \( \displaystyle{\int x \ln x \, dx} \).

To solve this, we use the principle of integration by parts. Let \(u=\ln x\) and \(v'=x.\) Then we have

\[\begin{align} \int x\ln x~dx&=\int v'u~dx\\ &=uv-\int vu'~dx\\ &=\frac{1}{2}x^2\ln x-\int\frac{1}{2}x^2\cdot\left(\ln x\right)'~dx\\ &=\frac{1}{2}x^2\ln x-\int\frac{1}{2}x~dx\\ &=\frac{1}{2}x^2\ln x-\frac{1}{4}x^2+C.\ _\square \end{align}\]

More generally,

\[ \int x^m \ln x \, dx = x^{m+1} \left( \frac{ \ln x } { m+1 } - \frac{1}{ (m+1)^2 } \right) + C. \]

The proof of this is similar to the above.

Evaluate \( \displaystyle{\int \frac{ \ln x } { x} \, dx} \).

To solve this, we use \(u\)-substitution. Let \(u=\ln x.\) Then since \(du=\frac{1}{x}dx,\) we know that

\[\int \frac{ \ln x } { x} \, dx=\int \frac{u}{x}~dx=\int u~du=\frac{1}{2}u^2+C=\frac{1}{2}(\ln x)^2+C.\ _\square\]

More generally,

\[ \int \frac{ (\ln x)^n }{x} \, dx = \frac{ (\ln x ) ^ { n + 1 } } { n+1} , \quad n \neq -1. \]

The proof of this is similar to the above.

Show that \( \displaystyle{\int \frac{ 1} { x \ln x } \, dx = \ln \lvert \ln x \rvert+C} \).

Perceive \(\frac{1}{x\ln x}\) as \(\frac{\frac{1}{x}}{\ln x}.\) Then since \((\ln x)'=\frac{1}{x},\) the given integral will give the \(\ln\lvert f\rvert\) form as follows:

\[\int \frac{ 1} { x \ln x } \, dx=\ln\lvert\ln x\rvert+C.\ _\square\]

Alternative Solution:We can also use the substitution \(u=\ln x.\) As \(du=\frac{1}{x}dx,\) we know that\[\int \frac{ 1} { x \ln x } \, dx=\int\frac{1}{\ln x}\cdot\frac{1}{x}~dx=\int\frac{1}{u}~du=\ln\lvert u\rvert+C=\ln\lvert\ln x\rvert+C.\ _\square\]

Evaluate \( \displaystyle{\int ( \ln x ) ^2 \, dx} \).

Let \(u=(\ln x)^2\) and \(v'=1.\) Then since \(v=x\) and \(u'=\frac{2\ln x}{x}\) we have

\[\begin{align} \int ( \ln x ) ^2 \, dx&=\int uv'~dx\\ &=uv-\int u'v~dx\\ &=x(\ln x)^2-\int\frac{2\ln x}{x}\cdot x~dx\\ &=x(\ln x)^2-\int2\ln x~dx. \end{align}\]

Using the formula \(\int\ln x~dx=x\ln x-x+C,\) which we have learned above, we have

\[x(\ln x)^2-\int2\ln x~dx=x(\ln x)^2-2x\ln x+2x+C.\ _\square\]

Some problems can be very complex so that they require using both integration by parts and \(u\)-substitution.

Evaluate \( \displaystyle{\int \sin ( \ln x ) \, dx} \).

We use the substitution \(t=\ln x.\) Then since \(dt=\frac{1}{x}dx,\) or \(dx=xdt,\) we have \[\int \sin ( \ln x ) \, dx=\int x\sin t~dt.\] From the relationship \(t=\ln x\) we know that \(e^t=x.\) Hence \[\int x\sin t~dt=\int e^t\sin t~dt.\] Now let \(u=\sin t\) and \(v'=e^t.\) Then since \(u'=\cos t\) and \(v=e^t,\) we have \[\begin{align} \int e^t\sin t~dt&=\int uv'~dt\\ &=uv-\int u'v~dt\\ &=e^t\sin t-\int e^t\cos t~dt. \qquad(1) \end{align}\] Using integration by parts once again, we have \[\int e^t\cos t~dt=e^t\cos t+\int e^t\sin t~dt,\] substituting which into \((1)\) gives \[\begin{align} \int e^t\sin t~dt&=e^t\sin t-\int e^t\cos t~dt=e^t\sin t-e^t\cos t-\int e^t\sin t~dt\\ \Rightarrow 2\int e^t\sin t~dt&=e^t\sin t-e^t\cos t\\ \int e^t\sin t~dt&=\frac{e^t(\sin t-\cos t)}{2}+C. \end{align}\] Now we finally have \[\int \sin ( \ln x ) \, dx=\frac{e^t(\sin t-\cos t)}{2}+C=\frac{e^{\ln x}\big(\sin(\ln x)-\cos(\ln x)\big)}{2}+C.\ _\square\]

## Proof of \(\int\ln x\, dx=x\ln x-x+C \) using Taylor Series

If we don't want to use integration by parts, we can also solve our original integral using Taylor expansion.

We know that the Taylor series expansion of \(\ln x\) is \[\ln x=(x-1)-\frac{(x-1)^2}{2}+\frac{(x-1)^3}{3}-\frac{(x-1)^4}{4}+\cdots. \qquad(1)\] By integrating both sides, we get \[\int\ln x~dx=\frac{(x-1)^2}{2}-\frac{(x-1)^3}{6}+\frac{(x-1)^4}{12}-\frac{(x-1)^5}{20}+\cdots.\qquad(2)\] We want to compare this with the Taylor series expansion of \(x\ln x-x.\) Multiplying both sides of \((1)\) by \(x-1\) gives \[(x-1)\ln x=(x-1)^2-\frac{(x-1)^3}{2}+\frac{(x-1)^4}{3}-\frac{(x-1)^5}{4}+\cdots.\] Then we add \((1)\) to both sides to obtain \[x\ln x=(x-1)+\frac{(x-1)^2}{2}-\frac{(x-1)^3}{6}+\frac{(x-1)^4}{12}-\frac{(x-1)^5}{20}+\cdots.\] Finally, subtracting \(x\) from both sides gives \[x\ln x-x=-1+\frac{(x-1)^2}{2}-\frac{(x-1)^3}{6}+\frac{(x-1)^4}{12}-\frac{(x-1)^5}{20}+\cdots,\] which is identical with \((2)\) except for the constant term (which is irrelevant, since there is always a constant of integration). Therefore we can conclude that \[\int\ln x~dx=x\ln x-x+C.\ _\square\]

**Cite as:**Integration of Logarithmic Functions.

*Brilliant.org*. Retrieved from https://brilliant.org/wiki/integration-of-logarithmic-functions/