# Evaluate Integrals by Completing Square

   

Examples and detailed solutions and exercises with answers on how to use the techniques of completing square and substitution to evaluate integrals involving quadratic expressions.
Exercises with their answers are also included.

## Review Formulas of Derivatives and Integrals

NOTE in what follows, $$c$$ is the constant of integration.

We first review some of the derivatives formulas for known inverse functions involving quadratic expressions.

\begin{aligned} & \dfrac{d}{dx} \arcsin x = \dfrac{1}{\sqrt{1-x^2}} \\[15pt] & \dfrac{d}{dx} \arctan x = \dfrac{1}{1+x^2} \\[15pt] & \dfrac{d}{dx} \text{arcsinh} \; x = \dfrac{1}{\sqrt {1+x^2}} \\[15pt] & \dfrac{d}{dx} \text{arccosh} \; x = \dfrac{1}{\sqrt {x^2-1}} \\[15pt] \end{aligned}
We now use the above differentiation formulas to write integrals as follows. \begin{aligned} & \int \dfrac{1}{\sqrt{1-x^2}} \; dx = \arcsin x + c \\[15pt] & \int \dfrac{1}{1+x^2} \; dx = \arctan x + c \\[15pt] & \int \dfrac{1}{\sqrt {1+x^2}} \; dx = \text{arcsinh} \; x + c\\[15pt] & \int \dfrac{1}{\sqrt {x^2-1}} \; dx = \text{arccosh} \; x + c\\[15pt] \end{aligned}

## Examples with Detailed Solutions

### Example 1

Evaluate the integral $\int \dfrac{1}{\sqrt{-x^2 - x}} \; dx$

Solution to Example 1
We first complete the square for the expression $$- x^2 - x$$ as follows
\begin{aligned} & \color{red}{\text{given }} \\[8pt] & - x^2 - x \\[15pt] & \color{red}{\text{factor -1 out }} \\[8pt] & = - ( x^2 + x ) \\[15pt] &\color{red}{\text{complete the square}}\\[8pt] & = - (x + 1/2)^2 + 1/4 \end{aligned}
Substitute the above in the given integral and rewrite as follows $\int \dfrac{1}{\sqrt{-x^2 - x}} \; dx = \int \dfrac{1}{\sqrt{1/4 - (x+1/2)^2}} \; dx$ Use method of substitution to evaluate the integral: \begin{aligned} & \color{red}{\text{Factor out 1/4 from under the square root on the right integral }} \\[8pt] & = \int \dfrac{2}{\sqrt{1 - (2(x+1/2))^2}} dx \\[15pt] & \color{red}{\text{ Let $$z = 2(x + 1/2) = 2x + 1$$ and therefore $$\dfrac{dz}{dx} = 2$$ or $$dx = \dfrac{dz}{2}$$ and the integral becomes}} \\[8pt] & = \int \dfrac{1}{\sqrt{1 - z^2}} \; dz \\[15pt] &\color{red}{\text{evaluate the above integral using the integrals in the review above}}\\[8pt] & = \arcsin(z) + c \\[15pt] &\color{red}{\text{Substitute back $$z = 2(x + 1/2)$$ to obtain the final answer }}\\[8pt] & \int \dfrac{1}{\sqrt{-x^2 - x}} dx = \arcsin(2x + 1) + c \end{aligned}

### Example 2

Evaluate the integral $\int \dfrac{2}{3x^2 + 12x + 24} \; dx$

Solution to Example 2
We first complete the square for the expression $$3x^2 + 12x + 24$$ as follows \begin{aligned} & \color{red}{\text{Given}} \8pt] & = 3x^2 + 12x + 24 \\[15pt] & \color{red}{\text{Factor the $$3$$ out of the terms in $$x^2$$ and $$x$$}} \\[8pt] & = 3( x^2 + 4x) + 24 \\[15pt] & \color{red}{\text{Complete the square for the term $$x^2 + 4x$$ inside the bracket }} \\[8pt] & = 3( (x + 2)^2 - 2^2 ) + 24 \\[15pt] & \color{red}{\text{Expand and simplify}} \\[8pt] & = 3\;(x + 2)^2 + 12 \\[15pt] & \color{red}{\text{Factor the $$12$$ out}} \\[8pt] & = 12 \; \left( \dfrac{1}{4} (x + 2)^2 + 1 \right)\\[15pt] & \color{red}{\text{Rewrite as follows}} \\[8pt] & = 12 \; \left( ( \dfrac{1}{2} (x + 2))^2 + 1 \right) \\[15pt] & = 12 \; \left( (\dfrac{x}{2} + 1)^2 + 1 \right) \\[15pt] \end{aligned} Use method of substitution to evaluate the integral: \begin{aligned} & \color{red}{\text{ Let $$z = \dfrac{x}{2} + 1$$ and therefore $$dx = 2 \; dz$$ and rewrite the integral as }} \\[8pt] & \int \dfrac{2}{3x^2 + 12x + 24} \; dx = \dfrac{1}{12} \; \int \dfrac{4}{z^2 + 1} \; dz \\[15pt] & \color{red}{\text{Evaluate the above integral using the integrals in the review above}} \\[8pt] & = \dfrac{1}{3} \; \arctan(z) + c \\[15pt] & \color{red}{\text{Substitute back $$z = \dfrac{x}{2} + 1$$ and to obtain the final answer }} \\[8pt] & = \dfrac{1}{3} \; \arctan \left(\dfrac{x}{2} + 1 \right) + c \\[15pt] \end{aligned} ### Example 3 Evaluate the integral \[ \int \dfrac{1}{\sqrt{x^2 + 12x + 40}} \; dx

Solution to Example 3
Complete the square for the expression $$x^2 + 12x + 40$$ as follows \begin{aligned} & \color{red}{\text{Given}} \8pt] & = x^2 + 12x + 40 \\[15pt] & \color{red}{\text{Complete the square for the term $$x^2 + 12$$ inside the bracket }} \\[8pt] & = ( x + 6 )^2 + 4 \\[15pt] & \color{red}{\text{ The given integral may written as follows }} \\[8pt] & \int \dfrac{1}{\sqrt{x^2 + 12x + 40}} \; dx = \int \dfrac{1}{\sqrt{( x + 6 )^2 + 4}} \; dx \\[15pt] & \color{red}{\text{ Factor $$4$$ out from under the square root on the right}} \\[8pt] & = \int \dfrac{1}{2\sqrt{ \left( \dfrac{x}{2} + 3 \right)^2 + 1}} \; dx \\[15pt] \end{aligned} Use method of substitution to evaluate the integral: \begin{aligned} & \color{red}{\text{ Let $$z = \dfrac{x}{2} + 3$$, hence $$2 dz = dx$$, simplify and write the integral as }} \\[8pt] & = \int \dfrac{1}{\sqrt{z^2 + 1}} \; dz \\[15pt] & \color{red}{\text{Evaluate the above integral using the integrals in the review above}} \\[8pt] & = \text{arcsinh}(z) + c \\[15pt] & \color{red}{\text{Substitute back $$z = \dfrac{x}{2} + 3$$ and to obtain the final answer }} \\[8pt] & = \text{arcsinh} \left( \dfrac{x}{2} + 3 \right) + c \\[15pt] \end{aligned} ### Example 4 Evaluate the integral \[ \int \dfrac{1}{10+x^2-2x}\; dx

Solution to Example 4
Complete the square for the denominator $$10+x^2-2x$$ as follows \begin{aligned} & \color{red}{\text{Given}} \\[8pt] & = 10+x^2-2x \\[15pt] & \color{red}{\text{Complete the square for the denominator $$10+x^2-2x$$ }} \\[8pt] & = (x-1)^2+9 \\[15pt] & \color{red}{\text{ The given integral may written as follows }} \\[8pt] & \int \dfrac{1}{10+x^2-2x}\; dx = \int \dfrac{1}{ (x-1)^2+9 } \; dx \\[15pt] & \color{red}{\text{ Factor $$9$$ out in the denominator}} \\[8pt] & = \int \dfrac{1}{ 9 \left( \left(\dfrac{x-1}{3}\right)^2 + 1 \right)} \; dx \\[15pt] \end{aligned} Use method of substitution to evaluate the integral: \begin{aligned} & \color{red}{\text{ Let $$z = \dfrac{x - 1}{3}$$, hence $$3 \; dz = dx$$, simplify and write the integral as }} \\[8pt] & = \dfrac{1}{ 9 } \int \dfrac{1}{z^2 + 1} \; 3 \; dz \\[15pt] & \color{red}{\text{Simplify and evaluate the above integral using the integrals in the review above}} \\[8pt] & = \dfrac{1}{ 3} \text{arctan}(z) + c \\[15pt] & \color{red}{\text{Substitute back $$z = \dfrac{x - 1}{3}$$ and to obtain the final answer }} \\[8pt] & = \dfrac{1}{ 3} \text{arctan} \left( \dfrac{x - 1}{3}\right) + c \\[15pt] \end{aligned}

## Exercises

Evaluate the integrals given below

1. $$\displaystyle \int \dfrac{3}{\sqrt{9 - x^2}} \; dx$$

2. $$\displaystyle \int \dfrac{3}{x^2 + 12x + 45} \; dx$$

3. $$\displaystyle \int \dfrac{\sqrt2}{\sqrt{2x^2 + 10x + 13}} \; dx$$

4. $$\displaystyle \int \dfrac{1}{5+x^2+2x}\: \; dx$$

1. $$3 \; \arcsin(x / 3) + c$$

2. $$\arctan(x/3 + 2) + c$$

3. $$\text{arcsinh}(2x + 5) + c$$

4. $$\dfrac{1}{2}\arctan \left(\dfrac{x+1}{2}\right) + c$$