Long division in integration by partial fractions I am trying to figure out what my book did, I can't make sense of the example.
"Since the degree of the numberator is greater than the degree of the denominator, we first perform the long division. This enables us to write
$$\int \frac{x^3 + x}{x -1} dx = \int \left(x^2 + x + 2 + \frac{2}{x-1}\right)dx = \frac{x^3}{3} + \frac{x^2}{2} + 2x + 2\ln|x-1| + C$$
I am mostly concerned with the transformation of the problem by long division I think.
I attempt to do this on my own.
$(x+1)$ and $(x^3 + x)$ inside the long division bracket
I am left with $x^2 - 1$ on top and a leftover -1
This is not in their answer, I do not know how they did that.
 A: You did not do the long division correctly.
                    x^2 + x + 2
                _________________________
        x - 1  |    x^3       + x
                  - x^3 + x^2
                  -----------
                        + x^2 + x
                        - x^2 + x
                          --------
                               2x 
                              -2x + 2
                              -------
                                  + 2

So the quotient is $x^2 + x + 2$, and the remainder is $2$. 
You can verify this by doing the product and adding the remainder: 
$$(x-1)(x^2+x+2) = x^3 + x^2 + 2x - x^2 - x -2 = x^3 + x - 2$$
so
$$(x-1)(x^2+x+2) + 2 = x^3 + x  -2  + 2 = x^3 + x.$$
Whereas you claim a quotient of $x^2-1$ and a remainder of $-1$, which would give
$$(x-1)(x^2-1) -1 = x^3 -x - x^2 + 1 -1 = x^3 - x^2 - x \neq x^3 + x.$$
(Even if you tried with $x+1$ instead fo $x-1$, your answer is still incorrect, since
$$(x+1)(x^2-1)-1 = x^3 - x + x^2 -1 -1 = x^3 + x^2 - x -2 \neq x^3+x.$$
If you divide by $x+1$ correctly, you'll get a quotient of $x^2-x+2$ and a remainder of $-2$,
$$(x+1)(x^2-x+2)-2 = x^3 -x^2 +2x +x^2 -x + 2 -2 = x^3 +x$$
which is the correct total.)
A: You want to express $x^3+x$ as $(x-1)(\text{something})+r$. 
I want to show you a way of solving this problem with a homemade technique. We see that the "something" must be a polynomial of degree $2$, or either we'll be getting $x^4$ which we don't want. 
$$x^3+x=(x-1)(ax^2+bx+c)+r$$
If we multiply out we get
$$x^3+x=ax^3+bx^2+cx-ax^2-bx-c+r$$
Now, we equate the coefficients in each side:
$$1x^3=ax^3$$
$$0x^2=bx^2-ax^2$$
$$1x=cx-bx$$
$$0=r-c$$
What the above means is that two polynomials are equal iff their coefficients are equal.
From the above we get $a=1$, so
$$0x^2=bx^2-x^2$$
$$1x=cx-bx$$
$$0=r-c$$
Thus $b=1$. 
$$1x=cx-1x$$
Then $c=2$, and finally 
$$0=r-3$$
So$r=2$. So we get what we wanted
$$x^3+x=(x-1)(x^2+x+2)+2$$
Dividing by $x-1$ gives what your book has
$$\frac{x^3+x}{x-1}=x^2+x+2+\frac{2}{x-1}$$
A: Your first term is indeed $x^2$. Then $$x^3+x-x^2(x-1)=x^3+x-(x^3-x^2)=x^2+x,$$ and so your next term is $x$. Then $$x^2+x-x(x-1)=x^2+x-(x^2-x)=2x,$$ so your next term is $2$. Finally, $2x-2(x-1)=2$, so your remainder is $2$. I suspect you simply made an arithmetic error. It always helps to check your answer, and indeed, $$(x^2-1)(x-1)+-1=x^3-x^2-x+1-1=x^3-x^2-x\not\equiv x^3+x.$$
