Integral X2 Ex
1. **Stating the problem:** We want to find the integral $$\int x^2 e^x \, dx$$.
2. **Method:** Use integration by parts, where we let:
- $$u = x^2$$ so that $$du = 2x \, dx$$
- $$dv = e^x \, dx$$ so that $$v = e^x$$
3. **Apply integration by parts formula:**
$$\int u \, dv = uv - \int v \, du$$
So,
$$\int x^2 e^x \, dx = x^2 e^x - \int e^x (2x) \, dx = x^2 e^x - 2 \int x e^x \, dx$$
4. **Integrate $$\int x e^x \, dx$$ using integration by parts again:**
Let:
- $$u = x$$ so $$du = dx$$
- $$dv = e^x \, dx$$ so $$v = e^x$$
Then,
$$\int x e^x \, dx = x e^x - \int e^x \, dx = x e^x - e^x + C$$
5. **Substitute back:**
$$\int x^2 e^x \, dx = x^2 e^x - 2 (x e^x - e^x) + C = x^2 e^x - 2 x e^x + 2 e^x + C$$
6. **Factor the expression:**
$$\int x^2 e^x \, dx = e^x (x^2 - 2x + 2) + C$$
**Final answer:**
$$\boxed{\int x^2 e^x \, dx = e^x (x^2 - 2x + 2) + C}$$