How Integration by Completing the Square Works
Many rational integrals of the form ∫ dx/(ax² + bx + c) do not match a basic table entry until the quadratic denominator is rewritten as a perfect square plus a remainder. Completing the square turns the messy quadratic into a shifted variable u = x + h, and a simple substitution then reduces the integral to one of three standard forms: an arctangent, a natural logarithm, or a simple rational function, depending on whether the quadratic has real roots.
Formula and method
Start with ax² + bx + c, a ≠ 0. Factor out a and complete the square inside the brackets: ax² + bx + c = a[(x + b/2a)² − b²/4a²] + c = a(x + h)² + k, where h = b/2a and k = c − b²/4a. Substituting u = x + h and m = k/a = c/a − b²/4a² gives ∫dx/(ax²+bx+c) = (1/a)∫du/(u² + m). Note that m = −D/4a², where D = b² − 4ac is the discriminant, so the sign of m always mirrors the sign of −D. If m > 0 (D < 0, no real roots), the antiderivative is (1/a√m)·arctan(u/√m). If m < 0 (D > 0, two real roots), it is a logarithm: (1/2a√(−m))·ln|(u−√(−m))/(u+√(−m))|. If m = 0 (D = 0, a repeated root), the integrand simplifies to 1/(a(x+h)²) and the antiderivative is −1/(a(x+h)).
Common sources of error
- Sign errors while completing the square: b²/4a² is subtracted, not added, when factoring a out of ax² + bx — double-check the sign of k.
- Dropping the absolute value in the log case: ln|(u−n)/(u+n)| needs the absolute value bars because u can be on either side of the root.
- Integrating across a singularity: if the denominator has a real root between the limits of integration (D ≥ 0), the definite integral diverges — check the roots against the interval before trusting a numeric answer.
- Forgetting the outer factor of a: the 1/a from factoring the quadratic must multiply the entire antiderivative, not just the arctan or ln term.
Checking your result
Differentiate the antiderivative F(x) and confirm it returns the original integrand 1/(ax²+bx+c) — this is the most reliable check. For a definite integral, a quick sanity check is to confirm the sign matches the integrand's sign over the interval (a positive integrand on the whole interval should give a positive result when q > p), and that the magnitude looks reasonable given the interval width.
Applications
- Integrals of this type appear when finding the response of RLC circuits and damped oscillators, where the transfer function's denominator is a quadratic in the transform variable.
- Probability and statistics use the same technique to normalize Gaussian-like and Cauchy-like density functions.
- Control theory and signal processing use partial-fraction and completing-the-square methods to invert Laplace transforms with irreducible quadratic denominators.
- Physics problems involving inverse-square-type potentials or trajectories under quadratic drag often reduce to this same arctan/log integral family.