Why did this incorrect partial fraction decomposition produce the correct answer?

I was reviewing a classmate (call him Bob)'s work on an integration of a rational expression (although integration is involved, it's beyond the scope of this question).

The problem was:

$$\int\frac{x^2 + 1}{x^2 + 3x + 2} dx$$

Bob attempted to use decomposition to split this into partial fractions. I had been taught that partial fraction decomposition can only be used on a $N(x)/D(x)$ if and only if the $deg(N(x)) < deg(D(x))$, so I knew that Bob's method was incorrect from the start; however, he still got the correct answer.

His work was as follows:

$$\frac{x^2 + 1}{x^2 + 3x + 2} = \frac{A}{x+2} + \frac{B}{x+1}$$

\begin{align} x^2 + 1 &= A(x + 1) + B(x + 2) \\ &= (A + B)x + (A + 2B) \end{align}

Comparing the coefficients, he wrote:

\begin{align} 1 &= A + 2B \\ x^2 &= (A + B)x \Rightarrow x = A + B \quad\color{red}{(wrong!)} \end{align}

Solving the system, he then wrote \begin{align} 1 &= A + 2B \Rightarrow A = 1-2B\\ x &= A + B \Rightarrow x = (1-2B)+B = 1-B \Rightarrow B=1-x \\ \text{Thus, } A &= 1-2(1-x) = 2x - 1 \end{align}

which meant his "decomposition" produced the partial fractions of

$$\frac{x^2 + 1}{x^2 + 3x + 2} = \frac{2x-1}{x+2} + \frac{1-x}{x+1}$$

Although the method was not typical, it ended with fractions that are equivalent to the original, and thus integrates to the correct answer.

Is this just some lucky coincidence, or is there an exception to the rule of when to use partial fraction decomposition?

• Why is wrong the wrong part? Because you may be dividing by zero? – Guillermo Mosse May 22 '16 at 23:37
• Basically, he made an assumption which was wrong (that $A,B$ can be chosen to be constant) and then in the course of doing the algebra contradicted that assumption. But then he stuck with the new situation and got a correct answer (though for integration a long division step will still be required). It's not so bad, but in general you will have a problem: if $A,B$ aren't constant, then what restrictions do they have to satisfy? Why couldn't you have concluded $(A+B)x=1,A+2B=x^2$ or something? – Ian May 22 '16 at 23:39
• I'm sorry for being confused, but what's wrong with decomposing fractions when the degree of the numerator is equal to or greater than the denominator? – Simply Beautiful Art May 22 '16 at 23:40
• @SimpleArt: See my comment beginning His algebra is correct and the earlier comment by Ian. ‘Bob’ got lucky: he found a correct algebraic manipulation that reduced the original integrand to one that he could handle. What he did was algebraically correct, but it was somewhat ad hoc: he did not employ a technique guaranteed to produce a form that he could handle. The real method of partial fractions is guaranteed to produce such a form, but in order to apply it, you must first divide out to get a polynomial plus a ‘proper’ fraction, one whose numerator has lower degree than its ... – Brian M. Scott May 23 '16 at 0:00
• ... denominator. In other words, for this specific problem there is nothing actually wrong with the approach that ‘Bob’ used, but that approach does not generalize well; the real method of partial fractions does. – Brian M. Scott May 23 '16 at 0:01