Calculus

Integration of Functions

Integration of Functions Logo

Integration by Completing the Square

Solved Problems

Example 7.

Find the integral \[\int {\frac{{dx}}{{\sqrt {1 - 2x - {x^2}} }}}.\]

Solution.

Completing the square in the denominator, we get

\[1 - 2x - {x^2} = 1 - \left( {{x^2} + 2x} \right) = 2 - \left( {{x^2} + 2x + 1} \right) = 2 - {\left( {x + 1} \right)^2} = {\left( {\sqrt 2 } \right)^2} - {\left( {x + 1} \right)^2}.\]

Make the substitution

\[u = x + 1,\;\;du = dx.\]

Hence

\[\int {\frac{{dx}}{{\sqrt {1 - 2x - {x^2}} }}} = \int {\frac{{dx}}{{\sqrt {{{\left( {\sqrt 2 } \right)}^2} - {{\left( {x + 1} \right)}^2}} }}} = \int {\frac{{du}}{{\sqrt {{{\left( {\sqrt 2 } \right)}^2} - {u^2}} }}} = \arcsin \frac{u}{{\sqrt 2 }} + C = \arcsin \frac{{x + 1}}{{\sqrt 2 }} + C.\]

Example 8.

Evaluate the integral \[\int {\frac{{x + 1}}{{{x^2} + x + 1}} dx}.\]

Solution.

The quadratic function in the denominator does not have real roots, so we can't factor it. Therefore, we complete the square:

\[{x^2} + x + 1 = {x^2} + x + \frac{1}{4} + \frac{3}{4} = {\left( {x + \frac{1}{2}} \right)^2} + {\left( {\frac{{\sqrt 3 }}{2}} \right)^2}.\]

Express the numerator in terms of \({x + \frac{1}{2}}:\)

\[x + 1 = \left( {x + \frac{1}{2}} \right) + \frac{1}{2}.\]

Using the table integrals, we get

\[\int {\frac{{x + 1}}{{{x^2} + x + 1}}dx} = \int {\frac{{\left( {x + \frac{1}{2}} \right) + \frac{1}{2}}}{{{x^2} + x + 1}}dx} = \int {\frac{{x + \frac{1}{2}}}{{{x^2} + x + 1}}dx} + \frac{1}{2}\int {\frac{{dx}}{{{x^2} + x + 1}}} = \frac{1}{2}\int {\frac{{\left( {2x + 1} \right)dx}}{{{x^2} + x + 1}}} + \frac{1}{2}\int {\frac{{dx}}{{{{\left( {x + \frac{1}{2}} \right)}^2} + {{\left( {\frac{{\sqrt 3 }}{2}} \right)}^2}}}} = \frac{1}{2}\int {\frac{{d\left( {{x^2} + x + 1} \right)}}{{{x^2} + x + 1}}} + \frac{1}{2}\int {\frac{{d\left( {x + \frac{1}{2}} \right)}}{{{{\left( {x + \frac{1}{2}} \right)}^2} + {{\left( {\frac{{\sqrt 3 }}{2}} \right)}^2}}}} = \frac{1}{2}\ln \left| {{x^2} + x + 1} \right| + \frac{1}{2} \cdot \frac{1}{{\frac{{\sqrt 3 }}{2}}}\arctan \frac{{x + \frac{1}{2}}}{{\frac{{\sqrt 3 }}{2}}} + C = \frac{1}{2}\ln \left( {{x^2} + x + 1} \right) + \frac{1}{{\sqrt 3 }}\arctan \frac{{2x + 1}}{{\sqrt 3 }} + C.\]

Example 9.

Evaluate the integral \[\int {\frac{xdx}{{{x^2} + 2x + 10}}}.\]

Solution.

We complete the square in the denominator:

\[{x^2} + 2x + 10 = {x^2} + 2x + 1 + 9 = {\left( {x + 1} \right)^2} + {3^2}.\]

Write the numerator in terms of \({x + 1}:\)

\[x = x + 1 - 1.\]

Hence, we can split the initial integral into two simpler ones:

\[I = \int {\frac{xdx}{{{x^2} + 2x + 10}}} = \int {\frac{{x + 1 - 1}}{{{x^2} + 2x + 10}}dx} = \int {\frac{{\left( {x + 1} \right)dx}}{{{x^2} + 2x + 10}}} - \int {\frac{{dx}}{{{x^2} + 2x + 10}}} = \frac{1}{2}\int {\frac{{\left( {2x + 2} \right)dx}}{{{x^2} + 2x + 10}}} - \int {\frac{{dx}}{{{{\left( {x + 1} \right)}^2} + {3^2}}}} = {I_1} - {I_2}.\]

We calculate both integrals separately.

In the first integral, let \(u = {x^2} + 2x + 10.\) Then \(du = \left( {2x + 2} \right)dx,\) so that

\[{I_1} = \frac{1}{2}\int {\frac{{\left( {2x + 2} \right)dx}}{{{x^2} + 2x + 10}}} = \frac{1}{2}\int {\frac{{du}}{u}} = \frac{1}{2}\ln \left| u \right| = \frac{1}{2}\ln \left| {{x^2} + 2x + 10} \right| = \frac{1}{2}\ln \left( {{x^2} + 2x + 10} \right).\]

Using integration formulas from a table of integrals, we can easily evaluate the second integral:

\[{I_2} = \int {\frac{{dx}}{{{{\left( {x + 1} \right)}^2} + {3^2}}}} = \frac{1}{3}\arctan \frac{{x + 1}}{3}.\]

Then

\[I = {I_1} - {I_2} = \frac{1}{2}\ln \left( {{x^2} + 2x + 10} \right) - \frac{1}{3}\arctan \frac{{x + 1}}{3} + C.\]

Example 10.

Compute the integral \[\int {\frac{{xdx}}{{\sqrt {5 + x - {x^2}} }}}.\]

Solution.

Given that

\[\left( {5 + x - {x^2}} \right)^\prime = 1 - 2x,\]

we split the numerator and write the initial integral as the sum of two integrals:

\[I = \int {\frac{{xdx}}{{\sqrt {5 + x - {x^2}} }}} = - \frac{1}{2}\int {\frac{{\left( { - 2x} \right)}}{{\sqrt {5 + x - {x^2}} }}dx} = - \frac{1}{2}\int {\frac{{\left( { - 2x + 1 - 1} \right)}}{{\sqrt {5 + x - {x^2}} }}dx} = - \frac{1}{2}\int {\frac{{\left( {1 - 2x} \right)}}{{\sqrt {5 + x - {x^2}} }}dx} + \frac{1}{2}\int {\frac{{dx}}{{\sqrt {5 + x - {x^2}} }}} = {I_1} + {I_2}.\]

To find the first integral \({I_1},\) we use the substitution

\[u = 5 + x - {x^2},\;\;du = \left( {1 - 2x} \right)dx.\]

Then

\[{I_1} = - \frac{1}{2}\int {\frac{{\left( {1 - 2x} \right)}}{{\sqrt {5 + x - {x^2}} }}dx} = - \frac{1}{2}\int {\frac{{du}}{{\sqrt u }}} = - \sqrt u = - \sqrt {5 + x - {x^2}} .\]

To evaluate the second integral \({I_2},\) we complete the square in the denominator:

\[5 + x - {x^2} = 5 - \left( {{x^2} - x} \right) = 5 + \frac{1}{4} - \left( {{x^2} - x + \frac{1}{4}} \right) = \frac{{21}}{4} - {\left( {x - \frac{1}{2}} \right)^2} = {\left( {\frac{{\sqrt {21} }}{2}} \right)^2} - {\left( {x - \frac{1}{2}} \right)^2}.\]

Now we can express the integral in terms of the inverse sine function:

\[{I_2} = \frac{1}{2}\int {\frac{{dx}}{{\sqrt {5 + x - {x^2}} }}} = \frac{1}{2}\int {\frac{{dx}}{{\sqrt {{{\left( {\frac{{\sqrt {21} }}{2}} \right)}^2} - {{\left( {x - \frac{1}{2}} \right)}^2}} }}} = \frac{1}{2}\arcsin \frac{{x - \frac{1}{2}}}{{\frac{{\sqrt {21} }}{2}}} = \frac{1}{2}\arcsin \frac{{2x - 1}}{{\sqrt {21} }}.\]

The final answer is given by

\[I = - \sqrt {5 + x - {x^2}} + \frac{1}{2}\arcsin \frac{{2x - 1}}{{\sqrt {21} }} + C.\]

Example 11.

Compute the integral \[\int {\frac{{x + 1}}{{\sqrt {{x^2} + 4x + 8} }} dx}.\]

Solution.

We split the numerator and write the initial integral as the sum of two integrals. Notice that

\[\left( {{x^2} + 4x + 8} \right)^\prime = 2x + 4.\]

Then

\[\int {\frac{{x + 1}}{{\sqrt {{x^2} + 4x + 8} }}dx} = \frac{1}{2}\int {\frac{{2x + 2}}{{\sqrt {{x^2} + 4x + 8} }}dx} = \frac{1}{2}\int {\frac{{2x + 4 - 2}}{{\sqrt {{x^2} + 4x + 8} }}dx} = \frac{1}{2}\int {\frac{{2x + 4}}{{\sqrt {{x^2} + 4x + 8} }}dx} - \int {\frac{{dx}}{{\sqrt {{x^2} + 4x + 8} }}} = {I_1} - {I_2}.\]

The first integral \({I_1}\) is solved using the substitution

\[u = {x^2} + 4x + 8,\;\;du = \left( {2x + 4} \right)dx.\]

Hence

\[{I_1} = \frac{1}{2}\int {\frac{{2x + 4}}{{\sqrt {{x^2} + 4x + 8} }}dx} = \frac{1}{2}\int {\frac{{du}}{{\sqrt u }}} = \sqrt u = \sqrt {{x^2} + 4x + 8} .\]

To find the second integral \({I_2},\) we complete the square in the denominator:

\[{x^2} + 4x + 8 = \left( {{x^2} + 4x + 4} \right) + 4 = {\left( {x + 2} \right)^2} + {2^2}.\]

Making the change \(t = x + 2,\) \(dt = dx,\) we obtain

\[{I_2} = \int {\frac{{dx}}{{\sqrt {{x^2} + 4x + 8} }}} = \int {\frac{{dx}}{{\sqrt {{{\left( {x + 2} \right)}^2} + {2^2}} }}} = \int {\frac{{dt}}{{\sqrt {{t^2} + {2^2}} }}} = \ln \left| {t + \sqrt {{t^2} + {2^2}} } \right| = \ln \left| {x + 2 + \sqrt {{x^2} + 4x + 8} } \right|.\]

So, the initial integral is given by

\[I = \sqrt {{x^2} + 4x + 8} - \ln \left| {x + 2 + \sqrt {{x^2} + 4x + 8} } \right| + C.\]
Page 1 Page 2