AP Calculus AB and BC

Integral of 1/(x^2+2x+5): Complete the Square

The integral of 1 over x squared plus 2x plus 5 is one half times arctan of x plus 1 all over 2, plus C. The quadratic has no real roots, so completing the square rewrites the denominator as x plus 1 squared plus 4, which is the arctangent form.

1x2+2x+5dx=12arctan(x+12)+C\int \frac{1}{x^{2}+2x+5}\,dx = \frac{1}{2}\arctan\left(\frac{x+1}{2}\right) + C

Complete the square first

Test the denominator before choosing a method. The discriminant of x2+2x+5x^{2}+2x+5 is 224(1)(5)=162^{2} - 4\left(1\right)\left(5\right) = -16. Negative means no real roots, so there are no linear factors and partial fractions has nothing to split.

x2+2x+5=(x+1)2+4x^{2}+2x+5 = \left(x+1\right)^{2} + 4

Now the template duu2+a2=1aarctan(ua)+C\int\frac{du}{u^{2}+a^{2}} = \frac{1}{a}\arctan\left(\frac{u}{a}\right) + C applies with u=x+1u = x+1 and a=2a = 2. Since du=dxdu = dx, the substitution costs nothing extra.

dxx2+2x+5=duu2+4=12arctan(x+12)+C\int\frac{dx}{x^{2}+2x+5} = \int\frac{du}{u^{2}+4} = \frac{1}{2}\arctan\left(\frac{x+1}{2}\right) + C

Reading a quadratic denominator

Quadratic denominators come in three shapes, and the discriminant separates them before any integration happens. Two real roots, as in x21x^{2}-1, means linear factors and logarithms. A repeated root, as in x2+2x+1x^{2}+2x+1, means the denominator is (x+1)2\left(x+1\right)^{2} and the answer is a power, 1x+1-\frac{1}{x+1}. No real roots, as here, means completing the square and expecting an arctangent.

Nothing about x2+2x+5x^{2}+2x+5 resembles 1+x21+x^{2} until the square is completed. That single step is the problem; everything after it is pattern matching against a formula you already know.

The mistakes students make

Every one of these still lands on an arctangent, so the answer keeps the right shape while the shift inside it or the constant in front of it is wrong. Differentiating back catches all three in a line.

  • Completing the square as (x+1)2+5\left(x+1\right)^{2}+5. Expanding (x+1)2\left(x+1\right)^{2} already supplies the +1+1, so the constant left over is 51=45-1 = 4.
  • Answering arctan(x+12)\arctan\left(\frac{x+1}{2}\right) with nothing in front. Its derivative is 2(x+1)2+4\frac{2}{\left(x+1\right)^{2}+4}, which is twice the integrand.
  • Putting 14\frac{1}{4} out front by copying a2a^{2} instead of aa. The template divides by a=2a = 2, so the coefficient is 12\frac{1}{2}.

Every answer on this page is machine checked

An automated test differentiates the antiderivative above and confirms it returns the integrand. A wrong sign or a missing factor fails the build, so it cannot reach you.

Frequently asked questions

What is the integral of 1/(x^2+2x+5)?

It is 12arctan(x+12)+C\frac{1}{2}\arctan\left(\frac{x+1}{2}\right) + C.

How do I know to complete the square?

Check the discriminant of the denominator. If it is negative the quadratic is irreducible, no factoring is possible, and completing the square is what turns it into the arctangent form.

When does a quadratic denominator give a logarithm instead of an arctangent?

When the quadratic has two distinct real roots, so it splits into different linear factors, or when the numerator is a multiple of the derivative of the denominator, as in 2x+2x2+2x+5dx=ln(x2+2x+5)+C\int\frac{2x+2}{x^{2}+2x+5}\,dx = \ln\left(x^{2}+2x+5\right) + C. A repeated root is the third case and it gives a power rather than a logarithm.