# How do you integrate int cos(lnx) by integration by parts method?

May 30, 2017

This isn't necessarily done by only integration by parts, but it's one step in the process; this actually looks like one where you simply choose your methods and see what works.

$\int \cos \left(\ln x\right) \mathrm{dx} = \frac{1}{2} x \left(\sin \left(\ln x\right) + \cos \left(\ln x\right)\right) + C$

First, let us try:

$u = \ln x$
$\mathrm{du} = \frac{1}{x} \mathrm{dx}$

Then, we have:

$\int \cos \left(u\right) x \mathrm{du} = \int {e}^{u} \cos u \mathrm{du}$

This looks more reasonable, and actually would be done using integration by parts, since we have a function where $\frac{\mathrm{df}}{\mathrm{dx}} = f \left(x\right)$ (e^u), and a function with cyclic derivatives ($\cos u$).

Let:

$s = {e}^{u}$
$\mathrm{dt} = \cos u \mathrm{du}$
$t = \sin u$
$\mathrm{ds} = {e}^{u} \mathrm{du}$

This gives:

$\int s \mathrm{dt} = s t - \int t \mathrm{ds}$

$= {e}^{u} \sin u + \int {e}^{u} \left(- \sin u\right) \mathrm{du}$

Since $\sin$ derivatives are cyclic, repeat the process. Let:

$s = {e}^{u}$
$\mathrm{dt} = - \sin u \mathrm{du}$
$t = \cos u$
$\mathrm{ds} = {e}^{u} \mathrm{du}$

Therefore:

$\int {e}^{u} \cos u \mathrm{du} = \int s \mathrm{dt}$

$= {e}^{u} \sin u + \left[{e}^{u} \cos u - \int {e}^{u} \cos u \mathrm{du}\right]$

If you notice, the original integral has shown up again, so:

$2 \int {e}^{u} \cos u \mathrm{du} = {e}^{u} \sin u + {e}^{u} \cos u = {e}^{u} \left(\sin u + \cos u\right)$

$\implies \int {e}^{u} \cos u \mathrm{du} = \frac{1}{2} {e}^{u} \left(\sin u + \cos u\right)$

And now, we undo the substitution, using $u = \ln x$, to get:

$\int \cos \left(\ln x\right) \mathrm{dx} = \textcolor{b l u e}{\frac{1}{2} x \left(\sin \left(\ln x\right) + \cos \left(\ln x\right)\right) + C}$