How to find the integral of a quotient of rational functions? How do I compute the following integral: $$\int \dfrac{x^4+1}{x^3+x^2}\,dx$$
My attempt:
We can write $$\dfrac{x^4+1}{x^3+x^2} = \dfrac{A}{x^2} + \dfrac{B}{x} + \dfrac{C}{x+1}$$
It is easy to find that
$A=1$,
$B=2$, and
$C=-1$.
Therefore 
$$\frac{x^4+1}{x^3+x^2} = \frac{1}{x^2} + \frac{2}{x} - \frac{1}{x+1}$$
Therefore: 
$$\int \frac{x^4+1}{x^3+x^2}\,dx = \int \frac{dx}{x^2} + \int \dfrac{2\,dx}{x} - \int \frac{dx}{x+1} = -\frac{1}{x} +2\log \vert x\vert - \log \vert x+1 \vert + C$$
The problem is I was supposed to find:  $$\int \frac{x^4+1}{x^3+x^2}\,dx = \frac{x^2}{2} - x - \frac{1}{2} - \log \vert x \vert + 2 \log \vert x+1 \vert + C$$
Where is my mistake?
 A: Your $A,B,C$ are wrong. You can't write the expression in that form because the numerator won't have the correct degree.
If you combine the  terms, you get
$$\frac{A(x+1)+Bx(x+1) +Cx^2}{x^3+x^2}$$
Note that the numerator is of degree at most $2$.
Instead, just perform polynomial division to get a quotient and a remainder term. You can then do what you did, working with the fractional remainder.
A: Observe that
$$\frac{x^4+1}{x^3+x^2}=\frac{x^4+x^3-x^3-x^2+x^2+1}{x^3+x^2}=\frac{(x-1)(x^3+x^2)+x^2+1}{x^3+x^2}=x-1+\frac{x^2+1}{x^2(x+1)}$$
A: Your long division is wrong, because:
$$\frac{x^4+1}{x^3+x^2}=\frac{x^4+1}{x^2(x+1)}=\frac{1}{x^2}+x+\frac{2}{x+1}-\frac{1}{x}-1$$
A: You need to combine polynomial division and partial fractions.
$$
\begin{align}
\frac{x^4+1}{x^3+x^2}
&=x-1+\frac{x^2+1}{x^2(x+1)}\tag{1}\\
&=x-1+\frac2{x+1}-\frac1x+\frac1{x^2}\tag{2}
\end{align}
$$
Explanation:
$(1)$: polynomial division
$(2)$: partial fractions
A: To break a rational polymomial expression into parts, the degree of the numerator must be less than the degree of the denominator.
This is not the case with $\dfrac{x^4+1}{x^3+x^2}$.  Using long division, we find

\begin{array}{rcccccccc}
          &   &  x  &  -  &  1   &\\
          &   & --- & --- & ---  & --- & ---  & --- & ---\\
x^3 + x^2 & | & x^4 &  +  & 0x^3 & +   & 0x^2 &  +  & 1 \\
          &   & --- & --- & --- \\
          &   & x^4 &  +  & x^3\\
          &   & --- & --- & ---  & --- & ---  \\
          &   &     &     & -x^3 &  +  & 0x^2 \\
          &   &     &     & -x^3 &  -  &  x^2 \\
          &   &     &     & ---  & --- & ---  \\
          &   &     &     &      &     &  x^2 &  +  & 1.  \\
\end{array}

So $\dfrac{x^4+1}{x^3+x^2} = x - 1 + \dfrac{x^2 + 1}{x^3 + x^2}$.
And you need to solve
$\dfrac{x^2+1}{x^3+x^2} = \dfrac{A}{x^2} + \dfrac{B}{x} + \dfrac{C}{x+1}$
$x^2 + 1 = A(x+1) + Bx(x+1) + Cx^2$
Let $x = -1$ and you get
$C = 2$
Let $C = 2$ and you get
$x^2 + 1 = A(x+1) + Bx(x+1) + 2x^2$
$-x^2 + 1 = A(x+1) + Bx(x+1)$
$1-x = A + Bx$
$A = 1$ and $B = -1$.
So $\dfrac{x^4+1}{x^3+x^2} = x - 1 + \dfrac{1}{x^2} - \dfrac{1}{x} + \dfrac{2}{x+1}$.
etc
A: Your A, B and C are wrong. Assuming your A,B and C are right, the integraiotn is right
