Integration by substitution vs. polynomial expansion first....different results?? I came across a textbook problem that showed an integral solved with the substitution method:
$$\int_a^b(b-x)^2dx = \left(-\frac{(b-x)^3}{3}\right)\Biggl\vert_a^b$$
I then attempted to solve the same definite integral by expanding out the polynomial first and then integrating.  Step 1 I got this:
$$\int_a^b(b^2 - 2bx +x^2)dx$$
Next, I integrated each part of the polynomial and got this:
$$=(b^2x - bx^2 + \frac{x^3}{3})\Biggl\vert_a^b$$
I must have done something wrong here since these results are not equivalent.  Where am I missing something?  Thanks for your help!

Not sure why you think the results are not equivalent.
If you evaluate the first, you get
\begin{align*}
\left.\left(-\frac{(b-x)^3}{3}\right)\right|_a^b &= -\frac{(b-b)^3}{3} + \frac{(b-a)^3}{3}\\
&= \frac{1}{3}b^3 - b^2a + ba^2 - \frac{1}{3}a^3.
\end{align*}
On the other hand, if you evaluate your second expression, you get
\begin{align*}
 \left.\left(b^2x-bx^2 +\frac{x^3}{3}\right)\right|_a^b &= b^3 - b^3 + \frac{b^3}{3} - b^2a + ba^2 - \frac{a^3}{3}\\
&= \frac{1}{3}b^3 - b^2a + ba^2 -\frac{1}{3}a^3,
\end{align*}
Exactly the same answer. Just because they look different at first glance does not mean they are different.
