Q:

How to solve $\int (2x^2 + 1) e^{x^2} \, dx$ using elementary integration and integration by parts?

$$\int (2x^2+1)e^{x^2} \, dx$$

It's part of my homework, and I have tried a few things but it seems to lead to more difficult integrals. I'd appreciate a hint more than an answer but all help is valued.

A:

Start by expanding the integrand.
$$\begin{align}
I&=\int \left(2x^2e^{x^2}+e^{x^2}\right)\,dx\\
&=\int 2x^2e^{x^2}\,dx+\int {e^{x^2}}\,dx\tag{a}\\
&=x e^{x^2}-\int 2x^2 e^{x^2}\,dx+\int 2x^2 e^{x^2}\,dx\\
&=x e^{x^2}+C
\end{align}$$
$(\text{a})$: Use integration by parts on the second integral with $u=e^{x^2}$ and $dv=dx$.

A:

$\textbf{Hint:}$  Write the integral as $\int2x^2e^{x^2}dx+\int e^{x^2}dx$.
Then use integration by parts on the first integral, with $dv=2xe^{x^2}dx$

