# How to Integrate Sin(Ln(x)) and Cos(Ln(x))

Logarithmic trig functions like sin(ln(x)) and cos(ln(x)) arise as solutions to differential equations of the form

(x^2)y'' + (ax)y' + by = 0

which are often called Euler differential equations. The graphs of the functions f(x) = sin(ln(x)) and g(x) = cos(ln(x)) for x greater than 0 look like the graphs of sin(x) and cos(x) except that they get more and more horizontally stretched as the value of x increases. At x = 0 these functions are undefined. See graphs below for comparison of the functions.

Although functions that contain a mix of trigonometric and logarithmic elements are generally non-integrable (the functions ln(x)sin(x) and ln(cos(x)) for instance), It is possible to find the antiderivatives of sin(ln(x)) and cos(ln(x)) in terms of elementary functions. This tutorial will show two methods of integrating the functions. For sin(ln(x)) we will use u-substitution, and for cos(ln(x)) we will use integration by parts.

## Graphs of Sin(x) and Sin(Ln(x))

## Graphs of Cos(x) and Cos(Ln(x))

## Antiderivative of Sin(Ln(x)) with Substitution

We start by making the change of variables x = e^u and dx = e^u du. This transforms our original integral in x into an integral in u.

∫ sin(ln(x)) dx

= ∫ sin(ln(e^u))*e^u du

= ∫ sin(u)*e^u du

The integral of a sin(u)*e^u is well-known and can be found in any table of integrals. It was also worked out in a previous tutorial. Using that previous work, we can obtain the antiderivative

∫ sin(u)*e^u du

= (1/2)[sin(u) - cos(u)]*e^u + C

where C is an arbitrary constant. To get the antiderivative of sin(ln(x)) from this expression, we solve x = e^u for u, which gives us ln(x) = u, and then we substitute this into the expression.

(1/2)[sin(u) - cos(u)]*e^u + C

= (1/2)[sin(ln(x)) - cos(ln(x))]*e^ln(x) + C

= (1/2)[sin(ln(x)) - cos(ln(x))*x + C

= **(x/2)[sin(ln(x)) - cos(ln(x))] + C**

## Antiderivative of Cos(Ln(x)) by Parts

First recall the integration by parts formula,

∫ p * dq = p*q - ∫ q * dp

where p and q are functions of x and dp and dq are the derivatives. To integrate cos(ln(x)) by parts, we need to rewrite in in an equivalent form, x*[cos(ln(x))/x]. Now in the integral

∫ x*[cos(ln(x))/x] dx

we let p = x and dq = cos(ln(x))/x dx. This gives us dp = dx and q = sin(ln(x)). Plugging these pieces into the right-hand side of the integration by parts formula we get

∫ x*[cos(ln(x))/x] dx

= x*sin(ln(x)) - ∫ sin(ln(x)) dx

We already know the integral of sin(ln(x)) from the previous section, so we get

x*sin(ln(x)) - ∫ sin(ln(x)) dx

= x*sin(ln(x)) - (x/2)[sin(ln(x)) - cos(ln(x))] + C

= **(x/2)[sin(ln(x)) + cos(ln(x))] + C**

** **

## Example 1

Find the area under the curve y = cos(ln(x)) from between x = e^(-π/2) ≈ 0.20788 and x = e^(π/2) ≈ 4.81048. To calculate the exact area, we need to plug these endpoints into the antiderivative of cos(ln(x)) and subtract. Doing this gives us

0.5*e^(π/2)[sin(π/2) + cos(π/2)] - 0.5*e^(-π/2)[sin(-π/2) + cos(-π/2)]

= 0.5e^(π/2)[1 + 0] - 0.5e^(-π/2)[-1 + 0]

= 0.5[e^(π/2) + e^(-π/2)]

≈ 2.50917

## Example 2

Solve the differential equation (x^2)y'' - 2x*y' + 3y = 0. First we make the change of variables y(x) = w(ln(x)). This transformation also gives us y' = w'/x and y'' = w''/x^2 - w'/x^2 using the chain rule of derivatives. Substituting these elements into the original differential equation creates the new equation

w'' - w' - 2w' + 3w = 0

w'' - 3w' + 3w = 0

This is a linear second-order differential equation that can be solved by finding the roots of the characteristic quadratic polynomial z^2 - 3z + 3 = 0, which gives us the complex-valued solutions z = 1.5 + i*sqrt(3)/2 and z = 1.5 - i*sqrt(3)/2. This means that the solution to the w equation is

w = e^(1.5x)[A*sin(x*sqrt(3)/2) + B*cos(x*sqrt(3)/2)]

where A and B are some constants that depend on the initial conditions of the differential equation. Since y = w(ln(x)), we must now replace all instances of "x" in the expression above with "ln(x)". The y equation that solves the original differential equation is.

y = (x^1.5)[A*sin(ln(x)*sqrt(3)/2) + B*cos(ln(x)*sqrt(3)/2)]

## Interesting Properties of Improper Integrals of Sin(Ln(x)) and Cos(Ln(x))

The functions sin(ln(x)) and cos(ln(x)) are undefined at x = 0 because sin(-infinity) and cos(-infinity) are undefined. Nevertheless, it is possible to evaluate improper definite integrals with 0 as one of the limits of integration. Here are a few interesting properties of definite integrals of cos(ln(x)) and sin(ln(x)

- If N is an odd integer (positive or negative) then the integral of cos(ln(x)) from x = 0 to x = e^(Nπ/2) is equal to 0.5*e^(Nπ/2) if N = ...-11, -7, -3, 1, 5, 9, ... And if N = -13, -9, -5, -1, 3, 7, 11, ... the integral is equal to -0.5*e^(Nπ/2).
- If N is an integer (positive or negative) then the integral of sin(ln(x)) from x = 0 to x = e^(Nπ) is equal to 0.5*e^(Nπ) if N is odd, and equal to -0.5e^(Nπ) if N is even.

## Comments

how do you integrate sin(ln(2x))?