SOLVETUTORMATH SOLVER

Instrument MI-01-288 · Mathematics

Integration by Completing the Square and Substitution

A quadratic denominator with no real roots hides an arctangent inside it, and completing the square is the one move that drags that arctangent out into the open.

Instrument MI-01-288
Sheet 1 OF 1
Rev A
Verified
Type 05 — Algebra SER. 2026-01288

Antiderivative coefficient (1 ⁄ k)

0.50000000

p = −b ⁄ 2

-1.00000000 Shift (p, from (x+p)²+k²)
2.00000000 k (from (x+p)²+k²)
The working Every figure verified twice
  1. shiftedX = −2 ⁄ 2 = -1.00000000
  2. k = √(5 − 2^2 ⁄ 4) = 2.00000000
  3. coefficient = 1 ⁄ √(5 − 2^2 ⁄ 4) = 0.50000000
Worksheet log
  1. No entries yet — change an input to log a scenario.

How this instrument works

Faced with ∫dx⁄(x²+bx+c), the denominator won't factor into real linear pieces whenever c−b²⁄4 is positive, which is precisely the case this page handles. Completing the square rewrites x²+bx+c as (x−p)²+k², where p=−b⁄2 and k=√(c−b²⁄4), and that rewritten form slots directly into the well-known pattern ∫du⁄(u²+k²) = (1⁄k)·atan(u⁄k)+C. Substituting u=x−p turns the original integral into (1⁄k)·atan((x−p)⁄k)+C, and this page returns p, k, and that leading coefficient 1⁄k so you can assemble the antiderivative yourself.

The shift p exists because a plain x² term is missing its own linear partner; adding and subtracting the right constant restores the balance without changing the expression's value, leaving a perfect square plus whatever constant remains. That leftover constant is k², and its square root is the number the arctangent's argument gets divided by. Every step is reversible, so expanding (x−p)²+k² back out always reproduces the original x²+bx+c exactly, a fast way to check your own hand work against this page's numbers.

A page already on this site, Completing the Square Practice, performs a visually similar operation on a general quadratic ax²+bx+c, but strictly for algebra: it hands back a vertex form a(x−h)²+q used to locate a parabola's turning point. This page shares that same first move, finishing a square, yet the destination differs entirely. Here, completing the square is a stepping stone toward a calculus result, an antiderivative built from the arctangent function, rather than a vertex to plot on a graph.

When c−b²⁄4 works out to zero or a negative number, the quadratic underneath actually carries one or two real roots, and the arctangent route breaks down since there's no positive k² left to divide by. Partial fractions handle that situation instead, splitting the integrand into simpler pieces built from those real roots directly rather than from a completed square. A denominator that factors instead, say into two distinct linear terms, sends the integral toward logarithms built from those roots rather than toward any arctangent at all, which is exactly why checking c−b²⁄4's sign first matters before reaching for this page.

p=b2p = -\frac{b}{2}k=cb24k = \sqrt{c-\frac{b^2}{4}}dxx2+bx+c=1karctan ⁣(xpk)+C\int \frac{dx}{x^2+bx+c} = \frac{1}{k}\arctan\!\left(\frac{x-p}{k}\right)+C
b, c — coefficients of the quadratic denominator x²+bx+c · p — the value −b⁄2, satisfying (x−p)²+k² = x²+bx+c · k — the square root of c−b²⁄4 · C — the constant of integration.
  • Enter b and c, the coefficients of the quadratic denominator x²+bx+c that you're integrating against.
  • Read Shift (p): the value produced by completing the square, equal to −b⁄2.
  • Read k: the constant such that (x−p)²+k² reproduces your original quadratic exactly.
  • Read Antiderivative coefficient (1⁄k): the number multiplying atan((x−p)⁄k) in the finished integral.
  • Assemble the full result yourself as (1⁄k)·atan((x−p)⁄k)+C, using the p and k already computed.

Worked example — integrating 1⁄(x²+2x+5)

With b=2 and c=5, the shift is p=−2⁄2=−1, and k=√(5−2²⁄4)=√(5−1)=√4=2. Check the identity directly: (x−p)²+k²=(x−(−1))²+4=(x+1)²+4=x²+2x+1+4=x²+2x+5, matching the original denominator exactly. The leading coefficient is 1⁄k=1⁄2=0.5, so the full antiderivative is 0.5·atan((x+1)⁄2)+C, since x−p simplifies to x+1 once p's negative value is substituted in.

A second case shows the coefficient repeating even as the shift changes entirely: with b=0 and c=4, there's no linear term to balance, so p=−0⁄2=0, and k=√(4−0)=2, again giving coefficient 0.5. Since p is zero, x−p is just x, so the quadratic x²+4 integrates to 0.5·atan(x⁄2)+C — the same leading number as the first case, reached from a plainer starting denominator with nothing to shift at all.

Questions

What does completing the square accomplish inside this integral?

It rewrites the quadratic denominator as (x−p)²+k², a perfect square plus a positive constant, matching the standard integral ∫du⁄(u²+k²)=(1⁄k)atan(u⁄k)+C once you substitute u=x−p. Without that rewrite, the arctangent pattern stays hidden inside the original x²+bx+c form.

Why does this only work when c minus b squared over 4 is positive?

That quantity becomes k², and a square root needs a non-negative number underneath it to return a real result. When c−b²⁄4 is zero or negative, the original quadratic actually has one or two real roots, so it factors into linear pieces instead, and partial fractions become the right tool rather than the arctangent route.

How is this different from the Completing the Square Practice calculator on this site?

That page completes the square on a general quadratic ax²+bx+c purely for algebra, returning a vertex form a(x−h)²+q used to find a parabola's turning point. This page performs the same first algebraic move, but its purpose is calculus throughout: converting a rational integral into the arctangent antiderivative, so the two pages answer genuinely different questions despite sharing one technique.

Why does the leading coefficient always equal one over k?

Because the standard integral ∫du⁄(u²+k²) evaluates directly to (1⁄k)atan(u⁄k)+C, and k is exactly the number produced by completing the square on your specific denominator. Once k is known, the coefficient in front of the arctangent is fixed with no further choice involved.

What happens to the shift p when b equals zero?

It comes out to zero, since p=−b⁄2, meaning the quadratic was already sitting in perfect-square-plus-constant form with no adjustment required. The x²+4 example shows exactly this case, where the antiderivative simplifies to 0.5·atan(x⁄2)+C with x itself standing in for x−p.

References