Tutorials › Calculus II › Integrating Reciprocals of Irreducible Quadratics

Completing the Square Techniques · Tutorial 253 of 998

Integrating Reciprocals of Irreducible Quadratics

Complete the square in ax² + bx + c, check that b² < 4ac, and integrate with 2/√(4ac − b²) · arctan((2ax + b)/√(4ac − b²)).

Intermediate 10 min read

What You'll Learn

  • Test irreducibility with the discriminant b² − 4ac < 0.
  • Complete the square to reach the vertex form a(x + b/2a)² + (4ac − b²)/4a.
  • Apply the general arctangent formula with 2/√(4ac − b²).
  • Evaluate definite and infinite integrals with exact angles.
  • Verify by differentiation.

Reciprocals of Quadratics Without Real Roots

A quadratic \(ax^2+bx+c\) with \(a>0\) is irreducible over the real numbers when its discriminant is negative: \(b^2-4ac<0\). In that case it cannot be factored into real linear factors, and the reciprocal \(\frac{1}{ax^2+bx+c}\) is integrated with an inverse tangent rather than a logarithm. The tool is completion of the square, which writes the quadratic as a positive multiple of a square plus a positive constant.

Result: If \(b^2<4ac\) and \(a>0\), then \(\displaystyle\int\frac{dx}{ax^2+bx+c}=\frac{2}{\sqrt{4ac-b^2}}\arctan\frac{2ax+b}{\sqrt{4ac-b^2}}+C.\)

Deriving the Formula

Complete the square: \(ax^2+bx+c=a\Bigl(x+\frac{b}{2a}\Bigr)^2+\frac{4ac-b^2}{4a}\). This is vertex form with \(A=a\), \(h=-\frac{b}{2a}\), and \(k=\frac{4ac-b^2}{4a}\), where \(k>0\) because \(b^2<4ac\). The integral of the reciprocal of vertex form is \(\frac{1}{\sqrt{Ak}}\arctan\bigl(\sqrt{A/k}\,(x-h)\bigr)\). Compute the pieces: \(Ak=\frac{4ac-b^2}{4}\), so \(\sqrt{Ak}=\frac{\sqrt{4ac-b^2}}{2}\), and \(\sqrt{A/k}=\frac{2a}{\sqrt{4ac-b^2}}\). Then

$$ \sqrt{\tfrac Ak}\,(x-h)=\frac{2a}{\sqrt{4ac-b^2}}\Bigl(x+\frac{b}{2a}\Bigr)=\frac{2ax+b}{\sqrt{4ac-b^2}}, $$

and the outer factor is \(\frac{1}{\sqrt{Ak}}=\frac{2}{\sqrt{4ac-b^2}}\). Putting these together gives the formula in the result box. The quantity \(4ac-b^2\) is the negative of the discriminant, and it is positive exactly when the quadratic is irreducible.

Checking by Differentiation

The derivative of \(\arctan v\) is \(\frac{v'}{1+v^2}\), with \(v=\frac{2ax+b}{\sqrt{D}}\) and \(D=4ac-b^2\). Then \(v'=\frac{2a}{\sqrt D}\) and \(1+v^2=\frac{D+(2ax+b)^2}{D}=\frac{4a(ax^2+bx+c)}{D}\), since \((2ax+b)^2=4a^2x^2+4abx+b^2\) and \(D+(2ax+b)^2=4a^2x^2+4abx+4ac=4a(ax^2+bx+c)\). The derivative of the antiderivative is \(\frac{2}{\sqrt D}\cdot\frac{2a/\sqrt D}{4a(ax^2+bx+c)/D}=\frac{1}{ax^2+bx+c}\).

Worked Examples

Worked Example: A Monic Quadratic

Find \(\int\frac{dx}{x^2+2x+5}\).

The discriminant is \(4-20=-16<0\), so the quadratic is irreducible. Here \(4ac-b^2=20-4=16\), and \(\sqrt{16}=4\). The formula gives \(\frac24\arctan\frac{2x+2}{4}\):

$$ \int\frac{dx}{x^2+2x+5}=\frac12\arctan\frac{x+1}{2}+C. $$

Completing the square directly gives \((x+1)^2+4\), with \(a=2\) in the arctangent, and the same result.

Worked Example: A Leading Coefficient Greater than One

Find \(\int\frac{dx}{2x^2+4x+5}\).

Here \(4ac-b^2=40-16=24\), so \(\sqrt{24}=2\sqrt6\). The formula gives \(\frac{2}{2\sqrt6}\arctan\frac{4x+4}{2\sqrt6}\):

$$ \int\frac{dx}{2x^2+4x+5}=\frac{1}{\sqrt6}\arctan\frac{2(x+1)}{\sqrt6}+C. $$

Check by vertex form: \(2x^2+4x+5=2(x+1)^2+3\), so \(A=2\), \(k=3\), \(\sqrt{Ak}=\sqrt6\), and \(\sqrt{A/k}=\sqrt{2/3}=\frac{\sqrt6}{3}\). The inner factor in the formula is \(\frac{2}{\sqrt6}=\frac{2\sqrt6}{6}=\frac{\sqrt6}{3}\), so both forms agree.

Worked Example: A Definite Integral

Evaluate \(\int_0^1\frac{dx}{x^2-x+1}\).

Here \(4ac-b^2=4-1=3\), so the antiderivative is \(\frac{2}{\sqrt3}\arctan\frac{2x-1}{\sqrt3}\). At \(x=1\): \(\frac{2}{\sqrt3}\arctan\frac{1}{\sqrt3}=\frac{2}{\sqrt3}\cdot\frac\pi6\). At \(x=0\): \(\frac{2}{\sqrt3}\arctan\bigl(-\frac{1}{\sqrt3}\bigr)=-\frac{2}{\sqrt3}\cdot\frac\pi6\). Therefore

$$ \int_0^1\frac{dx}{x^2-x+1}=\frac{2}{\sqrt3}\cdot\frac{\pi}{3}=\frac{2\pi}{3\sqrt3}\approx1.209. $$

The integrand is \(1\) at the endpoints and \(\frac43\) at the midpoint, so an area near \(1.2\) fits.

Worked Example: A Scaled Quadratic with Offset

Evaluate \(\int_1^3\frac{dx}{3x^2-6x+7}\).

Here \(a=3\), \(b=-6\), \(c=7\), so \(4ac-b^2=84-36=48\) and \(\sqrt{48}=4\sqrt3\). The antiderivative is \(\frac{2}{4\sqrt3}\arctan\frac{6x-6}{4\sqrt3}=\frac{1}{2\sqrt3}\arctan\frac{\sqrt3\,(x-1)}{2}\). At \(x=3\): \(\arctan\sqrt3=\frac\pi3\). At \(x=1\): \(0\). Hence

$$ \int_1^3\frac{dx}{3x^2-6x+7}=\frac{1}{2\sqrt3}\cdot\frac\pi3=\frac{\pi}{6\sqrt3}\approx0.302. $$

The vertex is at \(x=1\), where the quadratic equals \(4\), so the integrand has its peak value \(\frac14\) there.

Worked Example: The Whole Real Line

Evaluate \(\int_{-\infty}^{\infty}\frac{dx}{x^2+2x+5}\).

The antiderivative \(\frac12\arctan\frac{x+1}{2}\) tends to \(\pm\frac\pi4\) as \(x\to\pm\infty\). Therefore

$$ \int_{-\infty}^{\infty}\frac{dx}{x^2+2x+5}=\frac\pi4-\Bigl(-\frac\pi4\Bigr)=\frac\pi2. $$

The general result is \(\frac{2\pi}{\sqrt{4ac-b^2}}\), here \(\frac{2\pi}{4}=\frac\pi2\).

A Reliable Procedure

1
Test the discriminant.
Confirm \(b^2-4ac<0\); otherwise factor and use partial fractions.
2
Compute D.
Evaluate \(D=4ac-b^2\) and \(\sqrt D\).
3
Apply the formula.
Write \(\frac{2}{\sqrt D}\arctan\frac{2ax+b}{\sqrt D}\).
4
Simplify the constants.
Reduce fractions and rationalize if desired.
5
Check.
Differentiate, or complete the square and compare.

Common Mistakes

The first mistake is to apply the arctangent formula to a reducible quadratic such as \(x^2-3x+2\), where \(b^2-4ac>0\). The result would be meaningless. The second is to confuse \(4ac-b^2\) with \(b^2-4ac\) and obtain a negative radicand. The third is to forget the factor \(2\) in the numerator of the outer coefficient or the factor \(2a\) in the argument.

Quick Reference

IntegrandD = 4ac − b²Antiderivative
\(\frac{1}{x^2+2x+5}\)16\(\frac12\arctan\frac{x+1}{2}\)
\(\frac{1}{2x^2+4x+5}\)24\(\frac{1}{\sqrt6}\arctan\frac{2(x+1)}{\sqrt6}\)
\(\frac{1}{x^2-x+1}\)3\(\frac{2}{\sqrt3}\arctan\frac{2x-1}{\sqrt3}\)
\(\frac{1}{3x^2-6x+7}\)48\(\frac{1}{2\sqrt3}\arctan\frac{\sqrt3(x-1)}{2}\)

Interpreting the Result

The integrand is a bell-shaped curve with peak at \(x=-\frac{b}{2a}\) and peak height \(\frac{4a}{4ac-b^2}\). A larger \(D\) means a lower and wider peak. The total area on the real line is \(\frac{2\pi}{\sqrt D}\). For \(x^2+2x+5\), the peak is at \(x=-1\) with height \(\frac14\), and the area is \(\frac\pi2\).

A Numerical Spot Check

Check \(\int_0^1\frac{dx}{x^2-x+1}\approx1.209\) with Simpson's rule on three points. The heights are \(1\), \(\frac{1}{0.25-0.5+1}=\frac43\), and \(1\). Then \(\frac{0.5}{3}(1+4\cdot\frac43+1)\approx1.2222\), within about one percent of the exact value.

Practice Problems with Answers

Try each problem before reading the answer. Every answer below was checked by differentiation or by numerical integration.

  1. Find an antiderivative of \(\frac{1}{x^2+2x+5}\). Hint: \(D=16\). Answer: \(\frac12\arctan\frac{x+1}{2}\)
  2. Find an antiderivative of \(\frac{1}{2x^2+4x+5}\). Hint: \(D=24\). Answer: \(\frac{1}{\sqrt6}\arctan\frac{2(x+1)}{\sqrt6}\)
  3. Evaluate \(\int_0^1\frac{dx}{x^2-x+1}\). Hint: \(D=3\). Answer: \(\frac{2\pi}{3\sqrt3}\)
  4. Evaluate \(\int_1^3\frac{dx}{3x^2-6x+7}\). Hint: \(D=48\). Answer: \(\frac{\pi}{6\sqrt3}\)
Takeaway: When \(b^2<4ac\), complete the square or use \(\frac{2}{\sqrt{4ac-b^2}}\arctan\frac{2ax+b}{\sqrt{4ac-b^2}}\). Always test the discriminant first.

Worked Example: Reduce the Constants First

Find \(\int_0^1\frac{dx}{4x^2-4x+10}\).

Here \(4ac-b^2=160-16=144\), so \(\sqrt D=12\). The antiderivative is \(\frac{2}{12}\arctan\frac{8x-4}{12}=\frac16\arctan\frac{2x-1}{3}\). The outer factor is \(\frac{2}{12}=\frac16\), and the argument reduces to \(\frac{2x-1}{3}\). At \(x=1\): \(\frac16\arctan\frac13\). At \(x=0\): \(-\frac16\arctan\frac13\). Hence

$$ \int_0^1\frac{dx}{4x^2-4x+10}=\frac13\arctan\frac13\approx0.1073. $$

When coefficients share a common factor, dividing numerator and denominator first can simplify the constants. Here \(4x^2-4x+10=2(2x^2-2x+5)\), so the integral is \(\frac12\int\frac{dx}{2x^2-2x+5}\).

What Happens When the Quadratic Is Reducible

If \(b^2-4ac>0\), then \(4ac-b^2<0\) and the square root in the formula is not real. The quadratic has two real roots \(r_1\) and \(r_2\), and the integral is evaluated with partial fractions, giving a logarithm: \(\frac{1}{a(r_1-r_2)}\ln\left|\frac{x-r_1}{x-r_2}\right|\). If \(b^2=4ac\), the quadratic is a perfect square \(a(x+\frac{b}{2a})^2\), and the integral is \(-\frac{1}{a(x+b/2a)}\). The discriminant therefore selects among three outcomes: arctangent, logarithm, or reciprocal. The sign test comes first in every problem of this type.

DiscriminantNature of rootsType of antiderivative
\(b^2-4ac<0\)none (complex)inverse tangent
\(b^2-4ac=0\)one repeated real rootreciprocal power
\(b^2-4ac>0\)two distinct real rootslogarithm

Completing the Square by Hand

The formula is a shortcut for a short procedure, and you should be able to do the procedure without it. Factor out \(a\), halve the coefficient of \(x\), square it, add and subtract it, and write the perfect square. For \(3x^2-6x+7\): factor \(3\) from the first two terms to get \(3(x^2-2x)+7\); add and subtract \(1\) inside the parentheses to get \(3(x-1)^2-3+7=3(x-1)^2+4\). Now \(A=3\), \(k=4\), \(h=1\), \(\sqrt{Ak}=\sqrt{12}=2\sqrt3\), and \(\sqrt{A/k}=\frac{\sqrt3}{2}\), which reproduces the result of the fourth example.

Large-x Behavior

For large \(|x|\), the integrand behaves like \(\frac{1}{ax^2}\), so the improper integral to infinity converges and the tail beyond \(x_0\) is about \(\frac{1}{ax_0}\). The antiderivative reflects this: \(\arctan\) approaches \(\pm\frac\pi2\), and the difference from the limit shrinks like \(\frac{1}{x}\). This is a quick sanity check for any answer of this type.

Worked Example: A Positive Linear Term

Evaluate \(\int_0^1\frac{dx}{x^2+x+1}\).

Here \(4ac-b^2=4-1=3\). The antiderivative is \(\frac{2}{\sqrt3}\arctan\frac{2x+1}{\sqrt3}\). At \(x=1\): \(\frac{2}{\sqrt3}\arctan\sqrt3=\frac{2}{\sqrt3}\cdot\frac\pi3\). At \(x=0\): \(\frac{2}{\sqrt3}\arctan\frac{1}{\sqrt3}=\frac{2}{\sqrt3}\cdot\frac\pi6\). Subtracting,

$$ \int_0^1\frac{dx}{x^2+x+1}=\frac{2}{\sqrt3}\Bigl(\frac\pi3-\frac\pi6\Bigr)=\frac{\pi}{3\sqrt3}\approx0.605. $$

The vertex is at \(x=-\frac12\), outside the interval, so the integrand decreases from \(1\) to \(\frac13\) across \([0,1]\), and an area of about \(0.6\) is reasonable.

Presenting the Answer Cleanly

There are several equivalent ways to write an answer from this formula, and the cleanest depends on the numbers. When \(D\) is a perfect square, as for \(x^2+2x+5\) with \(D=16\), the coefficients are rational. When \(D\) is not a perfect square, a radical remains, as in \(\frac{2}{\sqrt3}\). Rationalizing gives \(\frac{2\sqrt3}{3}\), which is easier to compare numerically. In definite integrals, leave the angle as a multiple of \(\pi\) whenever the argument of the arctangent is \(0\), \(\pm\frac{1}{\sqrt3}\), \(\pm1\), or \(\pm\sqrt3\); otherwise leave an arctangent value.

Where This Fits in Integration Strategy

A rational function whose denominator is an irreducible quadratic and whose numerator is constant is one of the simplest cases that lead to an inverse tangent. If the numerator is linear, the integral splits into a logarithm and an arctangent, as the next tutorial shows. If the numerator has degree two or more, polynomial division comes first. Recognizing these three cases quickly is one of the most useful pattern-recognition skills in the strategy unit.

Where This Fits in the Course

This tutorial belongs to the module “Completing the Square Techniques”. The tutorial just before it is “Deriving the Inverse Tangent Formula for Quadratics,” and the one that follows is “Linear Numerators Over Irreducible Quadratics.” It applies the arctangent derivation from the previous tutorial to quadratics with general coefficients. The next two tutorials extend it to linear numerators and to numerators of higher degree, so the discriminant test and the completion of the square practiced here will be used in every one of those problems.

Check Your Understanding

Use the derivation and examples above to answer these questions.

  1. What does \(b^2-4ac<0\) say about \(ax^2+bx+c\)?
  2. Complete the square for \(x^2-x+1\).
  3. Evaluate \(\int_0^1\frac{dx}{x^2-x+1}\).
  4. What is the total area under \(\frac{1}{x^2+2x+5}\)?
  5. Differentiate the formula and confirm the integrand.

Test yourself: Calculus II final exam practice

Ready to check what you know? Work a full-length practice final, then open the complete worked solutions.

Want all 1,114 practice problems?

This tutorial covers one topic. Calc Pass covers the full Calculus AB & BC curriculum (the core of Calculus I and II): full review, every practice question, and step-by-step solutions to each one.

QR code to download the Calc Pass app

Get the Calc Pass App

Scan to download and practice on the go, with instant scoring.

Calc Pass Volume 1: 1,114 Practice Questions book cover

Vol. 1: 1,114 Questions

The complete practice question bank, organized by AB & BC topic.

View on Amazon
Calc Pass Volume 2: Solutions Manual book cover

Vol. 2: Solutions Manual

Fully worked solutions to every question in Volume 1.

View on Amazon