I have recently attempted the following question:
$$\int 2x(x^2 + 3) dx $$
When I attempted the question I first expanded out the brackets to achieve:
$$\int (2x^3 + 6x)dx$$
And then integrated to get:
$$ \frac{1}2x^4 + 3x^2 + c$$
I'm not sure if you're allowed to expand out the brackets before integrating, because in the mark scheme they gave the following solution:
$$\int 2x(x^2 + 3) dx = \int (\frac{d(x^2 + 3)}{dx})(x^2+3)dx $$
Let $u = x^2+3$
$$\int u\frac{du}{dx} dx= \int (u)du$$
$$= \frac{1}{2}u^2 + c$$
Substitute in $x^2+3$ for $u$
$$= \frac{(x^2+3)^2}{2}+c$$
I understand this method, however it appears to give me a different answer to my method.
As:$$\frac{(x^2+3)^2}{2} = \frac{1}{2}x^4+3x^2+\frac{9}{2}$$ Which is different to my original answer.
This means I must have a misunderstanding or I must have made a mistake somewhere, I hope someone can help me with this.
Thanks for your time.