<s>[INST] Integral through $u$-substitution v. multiplying out I have the integral:  
$ \int (x^2)(x^3-1)^2 \, dx $  Through $u$-substitution, I can write this is equal to $ \frac {1}{3} \int (3x^2)(x^3-1)^2 dx $  which equals $ \frac{1}{3}\cdot\frac{(x^3-1)^3}{3}$. 
However, if rather than using $u$-substitution, I multiply within $ \int (x^2)(x^3-1)^2 \, dx $ from the beginning, I don't get the same answer. For example: $ \int (x^2)(x^3-1)^2 \, dx $ = $ \int (x^2)(x^6 -2x^3 + 1) \, dx = \int (x^8 -2x^5 + x^2) \, dx$. The anti derivative of this becomes $ \frac{x^9}{9} - \frac{2x^6}{6} + \frac{x^3}{3} $.   
However, these anti-derivatives are not equal. Through u-substitution, when $x=1$, the anti derivative evaluates to zero. In the second route, when I plug in $1$, I get $1/9$.
Where did I go wrong? From what I see, the $u$-substitution version is correct. 
 [/INST] Using the binomial expansion:
\begin{align}
(x^3 - 1)^3 =&\ \binom{3}{0}(x^3)^3 + \binom{3}{1}(x^3)^2(-1) + \binom{3}{2}(x^3)^1(-1)^2 + \binom{3}{3}(-1)^3\\
=&\ x^9 - 3x^6 + 3x^3 - 1
\end{align}
Therefore:
$$
\frac{1}{3}\frac{(x^3 - 1)^3}{3} = \frac{x^9}{9} - \frac{x^6}{3} + \frac{x^3}{3} - \frac{1}{9}
$$
Which is the same as what you got but the constant at the end is different (differs by an additive constant factor).
</s>