#### xaktly | Calculus

Some tricky integrals

### Some tricky integrals

This page is a collection of some more complicated integrals. I know that there are plenty of websites these days where you can find solved problems, including integrals. That was never as true as during the COVID-19 pandemic of 2020-21, when I'm writing this. This abundance of solved problems has produced a sometimes-overwhelming temptation for math students to look up solutions to problems rather than to struggle through them. It's in that struggle, however, that learning occurs.

I'm not trying to reproduce those sites here, nor am I simply trying to supply you with an answer to a problem that might be similar, or even identical, to one you've been assigned.

I strongly suggest that you try these integrals yourself first, then use the solution for hints and to expand your own repertoire of techniques. In the solutions, I've tried to add a bit of detailed explanation to help you understand how to tackle difficult integrals.

always bear in mind that integration and differentiation aren't completely inverse operations. While you should, if you're here, be able to find the derivative of any function, not every function can be integrated analytically — that is, on paper. Some just have to be done numerically using Riemann sums or some other numerical technique. It's not a two-way street.

### Example 1   $\int \frac{1}{x^2 - x + 1} dx$

Solution: Notice that the denominator of the integrand has no real roots. The discriminant,

$$b^2 - 4ac = 1 - 4(1)(1) \lt 0,$$

so we can't factor it to solve by decomposition of the rational function. We'll have to try something else.

Instead, we can complete the square on the denominator. First set it equal to zero, then complete the square, then re-gather all of the terms of the function back on the left side. It looks like this:

\begin{align} x^2 - x + 1 &= 0 \\[5pt] x^2 - x &= -1 \\[5pt] x^2 - x + \left(\frac{1}{2}\right)^2 &= \frac{-3}{4} \\[5pt] \left( x - \frac{1}{2} \right)^2 + \frac{3}{4} &= f(x) \end{align}

You can prove to yourself that this function is identical to our original integrand. Now our integral is

$$\int \frac{1}{\left( x - \frac{1}{2} \right)^2 + \frac{3}{4}} \, dx$$

Now we'll do a substitution:   Let $u = x - \frac{1}{2},$   then   $du = dx.$ The resulting integral is

$$\int \frac{1}{u^2 + \frac{3}{4}} \, du$$

Now we'd like to aim toward an integral that gives us an inverse tangent function. Recall that

$$\frac{d}{dx} tan^{-1}(x) = \frac{1}{x^2 + 1}$$

Now we need to get our integrand denominator to look something like   $x^2 + 1,$   so we'll multiply through by   $\frac{3}{4}:$

$$\frac{3}{4} \int \frac{1}{\frac{4}{3} u^2 + 1} \, du$$

Now we'll do just one more substitution, strategically letting $v = \frac{2}{\sqrt{3}} u,$ (note that   $\frac{2}{\sqrt{3}}$   which is the square root of   $\frac{4}{3},$   which means that   $v^2 = \frac{4}{3}u^2$   and   $dv = \frac{2}{\sqrt{3}} du,$   giving us

\begin{align} \frac{3}{4} &\frac{\sqrt{3}}{2} \int \frac{1}{v^2 + 1} dv \\[5pt] &= \frac{3 \sqrt{3}}{8} tan^{-1}(v) + C \\[5pt] &= \frac{3 \sqrt{3}}{8} tan^{-1} \left( \frac{2}{\sqrt{3}} u \right) + C \\[5pt] &= \frac{3 \sqrt{3}}{8} tan^{-1} \left( \frac{2}{\sqrt{3}} \left( x - \frac{1}{2} \right)\right) + C \end{align}

In the last couple of steps we just re-substituted, first u for v, then x for u.

### Example 2   $\int \frac{1}{\sqrt{x}(x + 1)} dx$

Solution: This is an example of an integral that can be done by simple u-substitution, but it's easy to miss if you're not careful. Solve it by letting   $u = \sqrt{x},$   then   $du = \frac{1}{\sqrt{x}},$   and   $x + 1 = u^2 + 1.$   So we have

$$2 \int \frac{du}{u^2 + 1} = 2 \, tan^{-1}(u)$$

Resubstituting for u gives

$$= 2 \, tan^{-1}(\sqrt{x}) + C$$

Integrals like this underscore that it's handy to have a table of derivatives nearby so that you remember these:

##### Derivatives of inverse trig. functions

\begin{align} \frac{d}{dx} sin^{-1}(x) &= \frac{1}{\sqrt{1 - x^2}} \\[5pt] \frac{d}{dx} cos^{-1}(x) &= \frac{-1}{\sqrt{1 - x^2}} \\[5pt] \frac{d}{dx} tan^{-1}(x) &= \frac{1}{1 + x^2} \end{align}

### Example 3   $\int x \, tan^2(x) \, dx$

Solution: Like a lot of integrals involving trig. functions, this one is more easily-solved by replacing the   $tan^2(x)$   term using the Pythagorean identity,   $tan^2(x) = sec^2(x) - 1:$

\begin{align} \int x \, tan^2(x) \, dx &= \int x (sec^2(x) - 1) \, dx \\[5pt] &= \int x \, sec^2(x) \, dx - \int x \, dx \end{align}

Now the second integral is easy, and we can save it for later. For the first, do it by parts in this way:

\color{#E90F89}{ \begin{align} \text{Let } u &= x, \phantom{0000} dv = sec^2(x) \, dx \\[5pt] \text{then} du &= dx \phantom{0000} v = tan(x) \end{align}}

Now our integral is

$$=x \, tan(x) - \int tan(x) \, dx - \frac{x^2}{2},$$

where we've done the easy integral at the end. Now the one integral that's left is easy to look up, but it's also easy to do, and another example of when rearrangement using trig identities is helpful:

$$\int tan(x) \, dx = \int \frac{sin(x)}{cos(x)} dx$$

$$\text{Let } u = cos(x), \: \text{ then } du = -sin(x) \, dx$$

\begin{align} \rightarrow -\int \frac{du}{u} &= ln(u) \\[5pt] &\rightarrow -ln|cos(x)| \end{align}

Now our full solution is

$$=x \, tan(x) + ln|cos(x)| - \frac{x^2}{2} + C$$

It's really worth remembering at least the first of the Pythagorean identities from your studies of trigonometry. They really come in handy:

##### The Pythagorean identities

\begin{align} sin^2(x) + cos^2(x) &= 1 \\[5pt] csc^2(x) - cot^2(x) &= 1 \\[5pt] sec^2(x) - tan^2(x) &= 1 \end{align}

If you just remember the first, you can always easily recreate the other two by dividing through by   $sin^2(x)$   or   $cos^2(x),$   respectively.

### Example 4   $\int \frac{dx}{x^2 (x^2 + 25)} \, dx$

Solution: The first thing you might think of trying with this integral is u-substitution, but it just won't work here. The power of both x-containing terms in the integrand is 2, so taking the derivative of one doesn't make it match the other to within a constant. This might be a good candidate for rational decomposition of the fraction, so we can try it. Our decomposition will need to look like this:

$$\frac{1}{x^2(x^2 + 25)} = \frac{A}{x} + \frac{B}{x^2} + \frac{Cx + D}{x^2 + 25}$$

Not all of the A, B, C, D parameters will turn out to be non-zero here, but we need to cover our bases from the beginning. Now multiplying both sides by the denominator on the left side gives the "basic equation"

$$A x(x^2 + 25) + B(x^2 + 25) + (Cx + D)x = 1$$

Now the basic equation is good for any value of x, so we can substitute in any way we want that makes sense to find our coefficients, A, B, C and D. Letting x = 0 makes it easy to find B:

$$25B = 1 \: \: \color{#E90F89}{\longrightarrow} \: \: B = \frac{1}{25}$$

Substituting x = 1 and x = -1 will give us these two equations, which we can reduce by adding them and simplifying:

\require{cancel} \begin{align} \cancel{-26A} + 26B + C - \cancel{D} &= 0 \\[5pt] \underline{\cancel{26A} + 26B + C + \cancel{D}} &= \underline{1 \color{#E90F89}{\leftarrow \text {ADD}}} \\[5pt] 52B + 2C &= 2 \\[5pt] 26B + C &= 1 \\[5pt] C &= 1 - \frac{26}{25} \\[5pt] C &= \frac{-1}{25} \end{align}

In the last two steps we inserted   $\frac{1}{25}$   for B. Now we'll use x = 1 again and x = -2 to make some decisions about the remaining constants, B and C:

\begin{align} \color{#E90F89}{\text{let x = -2:}} -58A + 29B + 4C - 2D &= 1 \\[5pt] \underline{\color{#E90F89}{\text{let x = 1:}} -26A + 26B + C - D} &= 1 \\[5pt] -58A + 29B + 4C - 2D &= 1 \\[5pt] \color{#E90F89}{\times \, 4 \rightarrow}\underline{104A - 104B - 4C + 4D} &= -4 \\[5pt] 46A - 75B + 2D &= -3 \\[5pt] \color{#E90F89}{B = \frac{1}{25} \, \rightarrow} 46A + \cancel{-3} + 2D &= \cancel{-3} \end{align}

From the last line, it's clear that $D = 23A,$ but that also works if $A = D = 0,$ and that's our simplest decomposition of our integrand:

$$A = 0, \: \: B = \frac{1}{25}, \: \: C = \frac{-1}{25}, \: \: D = 0$$

So our original integrand can be expressed as

$$\frac{1}{x^2(x^2 + 25)} = \frac{1}{25x^2} - \frac{x}{25(x^2 + 25)}$$

You can add those terms and convince yourself that this is a valid decomposition. Now our integral is

$$\frac{1}{25}\int \frac{1}{x^2} \, dx - \frac{1}{25} \int \frac{dx}{x^2 + 25}$$

The first of those is easy, and we'll save it for last. The second resembles an inverse tangent integral with integrand $1/(x^2 + 25).$ Let's see if we can hammer it into shape. Let's divide the terms of the denominator by 25, which is the same as multiplying the integrand by 25, so we'll have to compensate by placing another  $\frac{1}{25}$   outside the integral:

$$\frac{1}{25} \int \frac{dx}{x^2 + 25} = \frac{1}{25^2} \int \frac{dx}{\frac{x^2}{25} + 1}$$

Now a u-substitution will do the trick:

\color{#E90F89}{ \begin{align} \text{let } u = \frac{x}{5} \: &\text{ then } \: u^2 = \frac{x^2}{25} \\[5pt] &\text{and } \: du = \frac{1}{5} \, dx \end{align}}

So

$$\frac{1}{25} \int \frac{dx}{x^2 + 25} \color{#E90F89}{\: \rightarrow \:} \frac{5}{25^2} \int \frac{du}{u^2 + 1}$$

Now this is the inverse tangent integral:

$$\frac{1}{125} \int \frac{du}{u^2 + 1} = \frac{1}{125} tan^{-1}(u) + C$$

so our overall result is

\begin{align} \frac{1}{25} &\int \frac{dx}{x^2 + 25} \\[5pt] &= \frac{-1}{25x} - \frac{1}{125} \, tan^{-1} \left( \frac{x}{5} \right) + C \end{align}

### Example 5   $\int \frac{x^2}{\sqrt{x^2 + 25}} \, dx$

Begin solving this integral by recognizing that the denominator, $\sqrt{25 + x^2}$   matches one of our patterns for trigonometric substitution. If we let $x = 5 \, tan(t),$   then

\begin{align} x &= 5 \, tan(t) \\[5pt] x^2 &= 25 \, tan^2(t) \\[5pt] dx &= 5 \, sec^2(t) \, dt \end{align}

It's worth remembering these trig. substitution patterns, or at least keeping them nearby when you need to do integrals.

##### Trig. substitution patterns

\begin{align} \sqrt{a^2-x^2} \: \color{#E90F89}{\longrightarrow} \: x = a\,sin(t) \\[5pt] \sqrt{a^2+x^2} \: \color{#E90F89}{\longrightarrow} \: x = a\,tan(t) \\[5pt] \sqrt{x^2-a^2} \: \color{#E90F89}{\longrightarrow} \: x = a\,sec(t) \end{align}

So we can convert our integral to

$$\int \frac{25 \, tan^2(t) \cdot \cancel{5} \, sec^{\cancel{2}}(t) \, dt}{\cancel{5 \, sec(t)}}$$

Simplification gives us

$$= 25 \int tan^2(t) \, sec(t) \, dt$$

Now use the Pythagorean identity,

$$tan^2(t) = sec^2(t) - 1$$

to convert to two integrals we can do as a sum:

$$= 25\int sec^3(t) \, dt - 25 \int sec^2(t) \, dt,$$

The latter integral is just   $25 \, tan(t) + C.$   We can do the first by parts:

\color{#E90F89}{ \begin{align} \text{let } u = sec(t), &\phantom{0000} dv = sec^2(t) \, dt \\[5pt] \text{then } \: du = sec(t) tan(t) \, dt, &\phantom{000} v = tan(t) \, dt \end{align} }

\begin{align} \int sec^3(t) \, dt &= sec(t) tan(t) - \int tan^2(t) sec(t) \, dt \\[5pt] &= sec(t) tan(t) - \int sec(t) (sec^2(t) - 1) \, dt \\[5pt] &= sec(t) tan(t) - \int sec^3(t) \, dt + \int sec(t) \, dt \end{align}

So we have

$$2 \int sec^3(t) \, dt = sec(t) tan(t) + \int sec(t) \, dt,$$

$$\int sec^3(t) \, dt = \frac{1}{2} sec(t) tan(t) + \frac{1}{2} \int sec(t) \, dt,$$

Now the integral of $sec(x)$ is tricky, and it's one we can look up. It is

$$\int sec(t) \, dt = ln|sec(t) + tan(t)| + C$$

Now our overall integral is

\begin{align} &= 25 \left[ \frac{1}{2} sec(t)tan(t) + \frac{1}{2}ln|sec(t) + tan(t)| \right] - 25 \, tan(t) + C \\[5pt] &= \frac{25}{2} sec(t) tan(t) + \frac{25}{2} ln|sec(t) + tan(t)| - 25 \, tan(t) + C \end{align}

### Example 6   $\int x^5 \sqrt{2 - x^3} \, dx$

Solution: When we look for opportunities to use u-substitution, we're usually looking for differences in the power of the variable of one. If this integrand were   $x^2 \sqrt{2 - x^3}.$ One strategy for doing it is to break the integrand apart and use inegration by parts, combined with u-substitution. Rewrite it as

$$\int x^3 \cdot x^2 \sqrt{2 - x^3} \, dx$$

\color{#E90F89}{ \begin{align} \text{Let } \: u = x^3 \: &\text{ and } \: dv = x^2 \sqrt{2 - x^3} dx \\[5pt] \text{then } \: du = 3x^2 \, dx \: &\text{ and } \: v = -\frac{2}{9}(2 - x^3)^{3/2} \end{align} }

The integral dv on the right is done by u-substitution,

$$\color{#E90F89}{ \text{Let } \: u = 2 - x^3, \: \: \text{ then } \: \: du = -3x^2 \, dx }$$

Then the integral is reduced to

$$-\frac{1}{3} \int u^{1/2} \, du \: \color{#E90F89}{\rightarrow} \: \frac{-1}{3}\frac{2}{3} u^{3/2}, \dots$$

Now going back to our integration by parts, we have

$$= -\frac{2x^3}{9}(2 - x^3)^{3/2} + \frac{2}{3} \int x^2 \, (2 - x^3)^{3/2}$$

Now the integral that remains is the one we've already done above (see dv), so we an just plug in the solution:

\begin{align} &= -\frac{2x^3}{9}(2 - x^3)^{3/2} + \frac{2}{3} \left[ -\frac{2}{9}(2 - x^3)^{3/2} \right] + C \\[5pt] &= -\frac{2}{9}(2 - x^3)^{2/3}\left( x^3 + \frac{2}{3} \right) + C \end{align}

### Example 7   $\int \frac{dx}{\sqrt{25x^2 + 2}} \, dx$

Solution: In this example we'll use a combination of u-substitution and trigonometric substitution. Very often, a u-sub is possible, but other measures are needed to complete the integration.

\color{#E90F89}{ \begin{align} \text{let } \: u &= 5x \\[5pt] \text{then } \: u^2 &= 25x^2 \\[5pt] \text{and } \: du &= 5 \, dx \end{align} }

This transforms our integral to

$$\rightarrow \: \frac{1}{5} \int \frac{dx}{\sqrt{u^2 + 2}}$$

Now let

\color{#E90F89}{ \begin{align} \text{let } \: u &= \sqrt{2} \, tan(t), \: \text{then } du = \sqrt{2} \, sec^2(t) \, dt \\[5pt] \text{and } \: \sqrt{u^2 + 2} &= (2 \, tan^2(t) + 2)^{1/2} \\[5pt] &= [2(tan^2(t) + 1)]^{1/2} \\[5pt] &= (2 \, sec^2(t))^{1/2} \\[5pt] &= \sqrt{2} \, sec(t) \end{align} }

Putting the integral together gives

$$\frac{1}{5} \int \frac{\cancel{\sqrt{2}}\, sec^{\cancel{2}}\, dt}{\cancel{\sqrt{2}} \, \cancel{sec(t)}} = \frac{1}{5} \int sec(t) \, dt$$

To find the antiderivative of   $sec(t),$ we could just look it up, but it's instructive to do it once, so we'll do it here. We use a trick that you'd have to think about a great deal to come up with originally, but given a few days to ponder it, I imagine that you eventually would try something like this:

\begin{align} \frac{1}{5} \int sec(t) &\, dt \color{#E90F89}{\left( \frac{sec(t) + tan(t)}{{sec(t) + tan(t)}} \right)} \\[5pt] &= \frac{1}{5} \int \frac{sec^2(t) + sec(t) tan(t)}{sec(t) + tan(t)} \, dt \end{align}

Now let's do a second substitution here, this time using the letter a:

\color{#E90F89}{ \begin{align} \text{let } \: a &= sec(t) + tan(t), \\[5pt] \text{then } \: da &= [sec(t) tan(t) + sec^2(t)] \, dt \end{align} }

This substitution dramatically simplifies this integral, and we can solve it:

$$\frac{1}{5} \int \frac{da}{a} = \frac{1}{5} \, ln|a|$$

Resubstituting for a gives

$$= \frac{1}{5} \, ln \big| sec(t) + tan(t) \big| + C$$

Now to transform from the t variable back to u, we can use this triangle that comes from the setup of our original trig. substitution:

Figure here

$$= \frac{1}{5} ln \bigg| \frac{\sqrt{u^2 + 2}}{\sqrt{2}} + \frac{u}{\sqrt{2}} \bigg| + C$$

Finally, re-substituting 5x for u gives

$$\int \frac{dx}{\sqrt{25x^2 + 2}} = \frac{1}{5} ln \bigg| \frac{\sqrt{25x^2 + 2}}{\sqrt{2}} + \frac{5x}{\sqrt{2}} \bigg| + C$$

### Example 8   $\int \frac{tan^3 (ln(x))}{x} \, dx$

Solution: This example needs a couple of rounds of u-substitution in order to make it a target for trigonometric substitution. Here we go. Begin by recognizing that the combination of   $ln(x)$   and   $x$   makes any integral a target for u-substitution. While there are no guaranteees that it will work, it's worth a try. Here's the substitution:

\color{#E90F89}{ \begin{align} \text{let } \: u &= ln(x) \\[5pt] \text{and } \: du &= \frac{1}{x} \, dx \end{align} }

which gives us a trigonometric integral with an odd power:

$$\int tan^3 (u) \, du$$

Now use the Pythagorean identity   $tan^2(x) = sec^2(x) - 1,$   to rewrite this integral as

\begin{align} \int & tan^3(u) \, du = \int (sec^2(u) - 1) tan(u) \, du \\[5pt] &= \int sec^2(u) tan(u) \, du - \int tan(u) \, du \end{align}

We'll save the second integral for last. The first can be done by u-substitution (but we've already used "u", so we'll use "a"this time:

\color{#E90F89}{ \begin{align} \text{let } \: a &= tan(u) \\[5pt] \text{then } \: da &= sec^2(u) \, du \end{align} }

Our new integral is just $\int a \, da,$ which is $\frac{a^2}{2},$ so the result is

$$\int sec^2(u) tan(u) \, du = \frac{1}{2} tan^2(u) + C.$$

The other integral, $\int tan(u) \, du,$ is one we can look up, but given that we're trying to do these tricky integrals fully, let's tackle that one, too. Notice that

$$\int tan(u) \, du = \int \frac{sin(u)}{cos(u)} \, du$$

Now make the substitution

\color{#E90F89}{ \begin{align} \text{let } \: b &= cos(u) \\[5pt] \text{then } \: db &= -sin(u) \, du \end{align} }

So we have a new and simple integral:

$$\int -\frac{db}{b} = -ln|b| + C,$$

Resubstituting   $cos(u)$   for b gives

$$-ln|cos(u)| + C$$

Now going back to our full integral, plugging in   $u = ln(x),$   and paying attention to signs gives us

$$= \frac{1}{2} tan^2(ln|x|) - ln|cos(ln|x|)| + C$$

### Example 9   $\int \sqrt{2x - x^2} \, dx$

Solution: This integral involves three steps: completing the square on the expression under the radical, substitution to simplify it, then a trigonometric (sine) substitution. We'll start by completing the square on   $2x - x^2.$

If we set   $2x - x^2 = 0,$   and work toward solving the quadratic by completing the square, the process looks like this:

\begin{align} 2x - x^2 &= 0 \\[5pt] x^2 - 2x &= 0 \\[5pt] x^2 - 2x + 1 &= 1 \\[5pt] (x - 1)^2 &= 1 \\[5pt] (x - 1)^2 - 1 &\: \color{#E90F89}{\leftarrow \; \text{adjust signs}} \\[5pt] f(x) &= -(x - 1)^2 + 1 \end{align}

Now our integral is

$$\int \sqrt{1 - (x - 1)^2} \, dx$$

A quick u-substitution simplifies that some more:

$$\color{#E90F89}{ \text{Let } \: u = x - 1, \phantom{000} \text{ then } \: du = dx }$$

Now the integral is

$$\int \sqrt{1 - u^2} \, du,$$

which is a form for which trig. substitution (sine) works (see the table under example 5):

\color{#E90F89}{ \begin{align} \text{Let } u &= sin(t), \: \: \text{ then} \\[5pt] du &= cos(t) \, dt, \\[5pt] u^2 &= sin^2(t), \: \: \text{ and} \\[5pt] 1 - u^2 &= 1 - sin^2(t) = cos^2(t) \end{align}}

Reassembly of our integral with the sine substitution gives

$$\int cos^2(t) \, dt$$

Using the power-reduction formula for   $cos^2(x)$   gives us

$$\int \frac{1 + cos(2t)}{2} \, dt = \frac{1}{2} t + \frac{1}{4} sin(2t) + C$$

Now to resubustitute and move from t back to u, we note that   $t = sin^{-1}(u)$   and we construct this triangle using the fact that   $sin(t) = u:$

to get our solution in terms of u:

$$= \frac{1}{2} sin^{-1}(u) + \frac{1}{2} u \sqrt{1 - u^2} + C$$

Finally, re-substitution of $x - 1$ for u gives

\begin{align} &= \frac{1}{2} sin^{-1}(x - 1) + \frac{x - 1}{2} \sqrt{1 - x^2 + 2x - 1} + C \\[5pt] &= \frac{1}{2} sin^{-1}(x - 1) + \frac{1}{2} (x - 1) \sqrt{2x - x^2} + C \end{align}

That triangle trick is used often when doing integrals with trig. substitution, moving back to original variables. It's worth learning and practicing.

xaktly.com by Dr. Jeff Cruzan is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. © 2012, Jeff Cruzan. All text and images on this website not specifically attributed to another source were created by me and I reserve all rights as to their use. Any opinions expressed on this website are entirely mine, and do not necessarily reflect the views of any of my employers. Please feel free to send any questions or comments to jeff.cruzan@verizon.net.