# Integration of cos(logx)dx?

Apr 20, 2018

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

#### Explanation:

So, we have

$\int \cos \left(\ln x\right) \mathrm{dx}$

We'll make the following substitution:

$u = \ln x$

$\mathrm{du} = \frac{\mathrm{dx}}{x}$

$x \mathrm{du} = \mathrm{dx}$

Let's try to get $x$ in terms of $u$:

${e}^{u} = {e}^{\ln} x$

${e}^{u} = x$

Thus,

${e}^{u} \mathrm{du} = \mathrm{dx}$ and we get

$\int {e}^{u} \cos u \mathrm{du}$. We now use Integration by Parts twice, making the following selections:

$w = {e}^{u}$
$\mathrm{dw} = {e}^{u} \mathrm{du}$
$\mathrm{dv} = \cos u \mathrm{du}$
$v = \sin u$

Applying the formula $u w - \int v \mathrm{dw}$:

$\int {e}^{u} \cos u \mathrm{du} = {e}^{u} \sin u - \int {e}^{u} \sin u \mathrm{du}$

For $\int {e}^{u} \sin u \mathrm{du}$:

$w = {e}^{u}$
$\mathrm{dw} = {e}^{u} \mathrm{du}$
$\mathrm{dv} = \sin u \mathrm{du}$
$v = - \cos u$

Thus,
$\int {e}^{u} \sin u \mathrm{du} = - {e}^{u} \cos u + \int {e}^{u} \cos u \mathrm{du}$

We see our original integral shows back up:

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

$\int {e}^{u} \cos u \mathrm{du} = {e}^{u} \sin u + {e}^{u} \cos u - \int {e}^{u} \cos u$

$2 \int {e}^{u} \cos u \mathrm{du} = {e}^{u} \sin u + {e}^{u} \cos u$

$\int {e}^{u} \cos u \mathrm{du} = \frac{1}{2} \left({e}^{u} \sin u + {e}^{u} \cos u\right) + C$ (Don't forget the constant of integration)

Recalling that $u = \ln x , {e}^{u} = x$:

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