Completing the Square for Integration
You need to integrate $\dfrac{1}{x^2 + 6x + 13}$. There is no obvious substitution — but if you look closely, the denominator is hiding a perfect form. Completing the square rewrites quadratic expressions like $ax^2 + bx + c$ into $(x+p)^2 + q^2$, instantly revealing the $\sin^{-1}$ or $\tan^{-1}$ form. Master this technique and a whole class of integrals that previously seemed impossible becomes routine.
Consider $\displaystyle\int \frac{1}{x^2+6x+13}\,dx$. Before looking at the technique — what do you notice about the denominator? Can you see any pattern or form it might match? Write your thoughts below.
Every "complete the square for integration" problem uses two decisions: rewrite the quadratic so it matches a standard form, then identify the correct inverse trig integral.
The two standard forms to target after completing the square are:
$\displaystyle\int \frac{1}{\sqrt{a^2-(x+p)^2}}\,dx = \sin^{-1}\!\left(\frac{x+p}{a}\right)+C$
$\displaystyle\int \frac{1}{a^2+(x+p)^2}\,dx = \frac{1}{a}\tan^{-1}\!\left(\frac{x+p}{a}\right)+C$
Key facts
- Completing the square: $ax^2+bx+c = a\!\left[(x+\tfrac{b}{2a})^2 + \tfrac{c}{a}-\tfrac{b^2}{4a^2}\right]$
- $\displaystyle\int \frac{dx}{a^2+(x+p)^2} = \frac{1}{a}\tan^{-1}\!\left(\frac{x+p}{a}\right)+C$
- $\displaystyle\int \frac{dx}{\sqrt{a^2-(x+p)^2}} = \sin^{-1}\!\left(\frac{x+p}{a}\right)+C$
Concepts
- Why completing the square reveals the hidden inverse trig form
- How the shift $x \to x+p$ represents a horizontal translation of the standard form
- When to use $\sin^{-1}$ versus $\tan^{-1}$ based on the structure after completing the square
Skills
- Complete the square for any monic or non-monic quadratic
- Integrate expressions with linear terms in the denominator or under a square root
- Handle the case where the numerator is a linear function (split and integrate each part)
Given a quadratic $x^2 + bx + c$, add and subtract $\left(\dfrac{b}{2}\right)^2$ to create a perfect square:
This rewrites the quadratic as $(x+p)^2 + q^2$ (or $(x+p)^2 - q^2$ for the $\sin^{-1}$ case). Setting $p = \dfrac{b}{2}$ and $q^2 = c - \dfrac{b^2}{4}$:
Example — the hook integral: $x^2 + 6x + 13$. Here $b = 6$, $c = 13$.
$p = \dfrac{6}{2} = 3$, $q^2 = 13 - 9 = 4$, so $x^2+6x+13 = (x+3)^2 + 4$.
Then: $\displaystyle\int \frac{dx}{x^2+6x+13} = \int \frac{dx}{(x+3)^2+4} = \frac{1}{2}\tan^{-1}\!\left(\frac{x+3}{2}\right)+C$.
Given a quadratic $x^2 + bx + c$, add and subtract $\left(\dfrac{b}{2}\right)^2$ to create a perfect square:
Pause — copy the completing-the-square formula: $x^2+bx+c=\left(x+\frac{b}{2}\right)^2+\left(c-\frac{b^2}{4}\right)$ with a worked numerical example into your book.
Quick check: Completing the square on $x^2 + 4x + 7$ gives which of the following?
We just saw the completing-the-square method: $x^2+bx+c=\left(x+\frac{b}{2}\right)^2+\left(c-\frac{b^2}{4}\right)=(x+p)^2+a^2$ where $p=b/2$ and $a^2=c-b^2/4$. That raises a question: once you have $(x+p)^2+a^2$ in the denominator, which specific formula integrates it, and is a substitution needed? This card answers it → substitute $u=x+p$, $du=dx$; then $\int\frac{du}{u^2+a^2}=\frac{1}{a}\tan^{-1}(u/a)+C$.
Once you have $(x+p)^2 + a^2$ in the denominator, apply:
Remember: $a$ is the positive square root of the constant term, not the full constant term itself. For $(x+p)^2 + 9$, we have $a^2 = 9$ so $a = 3$.
Non-monic example: Integrate $\dfrac{1}{2x^2+8x+18}$.
Factor out 2: $\dfrac{1}{2(x^2+4x+9)}$. Complete the square: $x^2+4x+9 = (x+2)^2+5$.
$\displaystyle\int \frac{dx}{2x^2+8x+18} = \frac{1}{2}\int \frac{dx}{(x+2)^2+5} = \frac{1}{2\sqrt{5}}\tan^{-1}\!\left(\frac{x+2}{\sqrt{5}}\right)+C$.
Once you have $(x+p)^2 + a^2$ in the denominator, apply:
Pause — copy the integration step after completing the square: substitute $u=x+p$ to get $\int\frac{du}{u^2+a^2}=\frac{1}{a}\tan^{-1}(u/a)+C$ into your book.
Did you get this? True or false: $\displaystyle\int \frac{dx}{(x+3)^2+16} = \frac{1}{4}\tan^{-1}\!\left(\frac{x+3}{4}\right)+C$.
Worked examples · 3 in a row, reveal as you go
Find $\displaystyle\int \frac{1}{x^2-4x+13}\,dx$.
Find $\displaystyle\int \frac{1}{\sqrt{8+2x-x^2}}\,dx$.
Find $\displaystyle\int \frac{2x+1}{x^2+2x+5}\,dx$.
Fill the gap: Completing the square on $x^2 - 6x + 14$ gives $(x-3)^2 +$ .
Misconceptions to fix · the 3 traps that cost marks
Did you get this? True or false: $\displaystyle\int \frac{dx}{\sqrt{9-(x-1)^2}} = \sin^{-1}\!\left(\dfrac{x-1}{3}\right)+C$.
Activities · practice with the ideas
Complete the square for $x^2 + 10x + 29$. Write it in the form $(x+p)^2 + q^2$.
Find $\displaystyle\int \frac{1}{x^2+10x+29}\,dx$.
Find $\displaystyle\int \frac{1}{\sqrt{4-(x+1)^2}}\,dx$. (The square is already completed.)
Rewrite $10-4x-x^2$ in the form $a^2-(x+p)^2$ by completing the square.
Find $\displaystyle\int \frac{3}{2x^2+4x+10}\,dx$. (Hint: factor out 2 from the denominator first.)
Odd one out: Three of these completed-square forms are correct. Which one is NOT?
Earlier you tried to identify the first step for $\displaystyle\int \frac{1}{x^2+6x+13}\,dx$.
The answer: complete the square to get $(x+3)^2+4$, then apply $\frac{1}{2}\tan^{-1}\!\frac{x+3}{2}+C$. The key insight is that the integral has no obvious substitution until you expose the hidden $(u^2+a^2)$ structure. Once you see it, the inverse trig formula applies directly.
Pick your answer, then rate your confidence — that tells the system what to drill next. Each retry pulls a fresh mix from the bank.
Q1. Complete the square for $x^2 + 8x + 20$, then evaluate $\displaystyle\int \frac{dx}{x^2+8x+20}$. (2 marks)
Q2. Find $\displaystyle\int \frac{dx}{\sqrt{6+4x-x^2}}$. Show all working. (3 marks)
Q3. Evaluate $\displaystyle\int_0^1 \frac{3x}{x^2+2x+2}\,dx$. (Hint: split the numerator.) (3 marks)
Comprehensive answers (click to reveal)
Activity answers:
1. $x^2+10x+29 = (x+5)^2+4$.
2. $\frac{1}{2}\tan^{-1}\!\frac{x+5}{2}+C$.
3. $\sin^{-1}\!\frac{x+1}{2}+C$ ($a=2$, $u=x+1$).
4. $10-4x-x^2 = -(x^2+4x-10) = -((x+2)^2-14) = 14-(x+2)^2$.
5. $\frac{3}{2}\cdot\frac{1}{2}\tan^{-1}\!\frac{x+1}{2}+C = \frac{3}{4}\tan^{-1}\!\frac{x+1}{2}+C$.
Q1 (2 marks): $x^2+8x+20 = (x+4)^2+4$ [1]. $\int \frac{dx}{(x+4)^2+4} = \frac{1}{2}\tan^{-1}\!\frac{x+4}{2}+C$ [1].
Q2 (3 marks): $6+4x-x^2 = -(x^2-4x-6) = -((x-2)^2-10) = 10-(x-2)^2$ [1]. Matches $\int \frac{du}{\sqrt{a^2-u^2}}$ with $a=\sqrt{10}$, $u=x-2$ [1]. Answer: $\sin^{-1}\!\!\left(\frac{x-2}{\sqrt{10}}\right)+C$ [1].
Q3 (3 marks): $3x = \frac{3}{2}(2x+2)-3$ [1]. $\int_0^1\frac{3x}{x^2+2x+2}dx = \frac{3}{2}\Big[\ln(x^2+2x+2)\Big]_0^1 - 3\int_0^1\frac{dx}{(x+1)^2+1}$ [1]. $= \frac{3}{2}(\ln 5 - \ln 2) - 3\Big[\tan^{-1}(x+1)\Big]_0^1 = \frac{3}{2}\ln\frac{5}{2} - 3\!\left(\frac{\pi}{4}-\frac{\pi}{4}\right)$. Wait — $\tan^{-1}(2)-\tan^{-1}(1) = \tan^{-1}2-\frac{\pi}{4}$. Final: $\frac{3}{2}\ln\frac{5}{2} - 3\!\left(\tan^{-1}2-\frac{\pi}{4}\right)$ [1].
Five timed questions. Beat the boss to bank a tier — gold (90% + speed), silver (75%), or bronze (50%). Replays welcome.
⚔ Enter the arenaClimb platforms by answering completing-the-square integration questions. Lighter alternative to the boss.
Mark lesson as complete
Tick when you've finished the practice and review.