Integration, which one is right? (I'm confused)

I'm now little bit confused. I have textbook that says:

$\displaystyle \int \! x \left( {x}^{2}+1 \right) ^{2}{dx}\$

$\displaystyle =\frac{1}{6}\left(x ^{2}+1\right)^{3}\$

Ok, I'll do it my way and Integrate function by expand polynom first:

$\displaystyle \int \! x \left( {x}^{2}+1 \right) ^{2}{dx}\$

$\displaystyle =\mathop{\rm }\int \left(x ^{5}+2\mathop{\rm }x ^{3}+x \right)\mathop{\rm } dx$

$\displaystyle =\mathop{\rm }\frac{x ^{6}}{6}+\frac{x ^{4}}{2}+\frac{x ^{2}}{2}$

I get different integral function. let x=3 then first integral function gives result: 500/3=166,6666666... but seconds gives 333/2 = 166,5.

So, which one is right? (Doh)