TOPIC 6.10 · STUDY

Integrating Functions Using Long Division and Completing the Square

Some quotients need an algebraic rewrite before a basic antiderivative rule applies. Division turns (x^2+1)/x into x+1/x, with antiderivative x^2/2+ln|x|+C. Completing the square turns 1/(x^2+2x+2) into 1/((x+1)^2+1), with antiderivative arctan(x+1)+C.

FUN-6.D

Long division and completing the square

A basic rule applies to $x^n$, to $\frac{1}{x}$, to $e^x$, to sine and cosine, and to $\frac{1}{u^2+1}$ after a substitution has produced that shape. A quotient of polynomials often is none of those until you rewrite it. If the numerator's degree is at least the denominator's degree, divide first. If the denominator is a quadratic with no real roots and the numerator is a constant, complete the square. Then integrate the rewritten form and differentiate to check.

Divide $\frac{x^2+1}{x}$. The divisor $x$ goes into $x^2$ exactly $x$ times, and $x\cdot x=x^2$, so the remainder is $1$. Thus $\frac{x^2+1}{x}=x+\frac{1}{x}$ for $x\neq 0$. Multiply back to confirm: $x\left(x+\frac{1}{x}\right)=x^2+1$. The integral is $\int\left(x+\frac{1}{x}\right)\,dx=\frac{x^2}{2}+\ln|x|+C$. Differentiate: $x+\frac{1}{x}$, which is the rewritten integrand. At $x=2$ both equal $2+\frac{1}{2}=\frac{5}{2}$, and the original quotient is $\frac{4+1}{2}=\frac{5}{2}$. At $x=-2$ both equal $-2+\frac{1}{-2}=-\frac{5}{2}$. The logarithm is valid separately on $(0,\infty)$ and on $(-\infty,0)$. Do not treat one antiderivative expression as continuous through $x=0$.

Now rewrite $\frac{1}{x^2+2x+2}$ by completing the square. Half of the linear coefficient $2$ is $1$, and $1^2=1$. So $x^2+2x+2=(x^2+2x+1)+1=(x+1)^2+1$. The integrand is $\frac{1}{(x+1)^2+1}$, a horizontally shifted copy of $\frac{1}{u^2+1}$. The antiderivative of $\frac{1}{u^2+1}$ is $\arctan u$. With $u=x+1$ and $u'=1$, $\int \frac{1}{x^2+2x+2}\,dx=\arctan(x+1)+C$.

Differentiate the arctangent to check. $\frac{d}{dx}\arctan(x+1)=\frac{1}{1+(x+1)^2}\cdot 1$. The denominator expands as $1+(x^2+2x+1)=x^2+2x+2$, so the derivative is exactly the integrand. At $x=-1$ both equal $\frac{1}{1+0}=1$. At $x=0$ both equal $\frac{1}{2}$. At $x=1$ both equal $\frac{1}{1+4}=\frac{1}{5}$. The denominator $x^2+2x+2=(x+1)^2+1$ is always at least $1$, so the integrand is defined for every real $x$ and peaks at $1$ when $x=-1$.

A logarithm of the quadratic is the wrong antiderivative. The derivative of $\ln(x^2+2x+2)$ is $\frac{2x+2}{x^2+2x+2}$, which would match the integrand only if the numerator were $1$ for every $x$. At $x=-1$ that logarithmic derivative equals $0$, while the integrand equals $1$. The extra linear factor $2x+2$ is the derivative of the inside; it is not present in $\frac{1}{x^2+2x+2}$. The figure shows that integrand. It is the bell of $\frac{1}{u^2+1}$ shifted left by $1$, with its peak at $x=-1$ instead of at $x=0$.

The integrand 1/(x^2+2x+2), a shifted 1/(u^2+1), peaking at (-1,1).

The curve is $\frac{1}{x^2+2x+2}=\frac{1}{(x+1)^2+1}$, the graph of $\frac{1}{u^2+1}$ shifted left by $1$. The peak is $1$ at $x=-1$. Its antiderivative is $\arctan(x+1)+C$, whose derivative matches this curve.

Key points

  • If the numerator has degree at least the denominator, divide before integrating.
  • $\frac{x^2+1}{x}=x+\frac{1}{x}$, and the integral is $\frac{x^2}{2}+\ln|x|+C$. At $x=2$ the derivative check equals $\frac{5}{2}$.
  • Complete the square when a constant sits over a quadratic with no real roots: $x^2+2x+2=(x+1)^2+1$.
  • $\int \frac{1}{x^2+2x+2}\,dx=\arctan(x+1)+C$. At $x=-1$ the derivative check equals $1$.
  • The derivative of $\ln(x^2+2x+2)$ is $\frac{2x+2}{x^2+2x+2}$, which is a different function.

Common mistake: integrating $\frac{1}{x^2+2x+2}$ as $\ln|x^2+2x+2|$. At $x=-1$ that logarithm has slope $0$, but the integrand equals $1$. The completed-square form is an arctangent. On the division problem, $\frac{x^2+1}{x}$ equals $x+\frac{1}{x}$, not $x$ and not $x^2+\frac{1}{x}$.

Practice this topic