# Calculate $\int_0^2 x^2 e^x dx$

How do I calculate $$\int_0^2 x^2 e^x dx$$

Is there a product rule for integration ?

-
Look up "integration by parts". You'll need to do it twice here. – JohnD Dec 15 '12 at 16:04
In a sense, yes there is a product rule for integration. It's the integration by parts formula; which is obtained by integrating both sides of the product rule for derivatives: $$(fg)'=f'g+g'f\Rightarrow fg=\int f'g+\int g'f.$$Rearranging the above gives the integration by parts formula (which is useful for your integral):$$\int f'g=fg-\int g'f.$$ – David Mitra Dec 15 '12 at 16:30
@DavidMitra Wow :O , now I really understand ! Thank you! Off-topic, how should I ask my question next time? To make sure it isn't downvoted. I couldn't find this integration by parts trick in my (highschool) book, and on wikipedia it just looked so difficult. But luckily now I understand :) – 90intuition Dec 15 '12 at 16:38
Unfortunately, it seems you're in the position where you have to ask a basic (to people who have studied math for a while) question without providing any work. I imagine for this reason, some people deemed it worthy of a downvote (I didn't downvote). Perhaps next time you're in this situation, explain where the problem came from, your background concerning the relevant subject, and why you find the problem intractable. See this thread for other advice. – David Mitra Dec 15 '12 at 16:48

The answer of your question is yes, existis. The conection is the fundamental theorem of calculus and produtc ruler diferentiation. We have that $$D_x(u(x)\cdot v(x))=v(x)\cdot D_x u(x)+u(x)\cdot D_x v(x)$$ implies $$v(x)\cdot D_x u(x)= D_x(u(x)\cdot v(x)) -u(x)\cdot D_x v(x)$$ and $$\int^b_a v(x)\cdot D_x u(x)\, dx= \int^b_a D_x(u(x)\cdot v(x))\,dx -\int^b_a u(x)\cdot D_x v(x)\, dx$$
By Fundamental Theorem of Calculus $$\int^b_a v(x)\cdot D_x u(x)\, dx= u(x)\cdot v(x)\bigg|^b_a -\int^b_a u(x)\cdot D_x v(x)\, dx$$ This is the formula of integration by parts. \begin{align} \int^{2}_{0} x^2 e^x dx= & \int^{2}_{0} x^2 (e^x)^{\prime} dx & (e^x)^{\prime}=e^x \\ = & x^2e^x\bigg|^{2}_{0}-\int|^{2}_{0} (x^2)^{\prime} e^xdx & \mbox{formula of integration by parts} \\ = & x^2e^x\bigg|^{2}_{0}-\int^{2}_{0}2xe^xdx & (x^2)^{\prime}=2x \\ = & x^2e^x\bigg|^{2}_{0}-2\int^{2}_{0} x (e^x)^{\prime} dx & (e^x)^{\prime}=e^x \\ = & x^2e^x\bigg|^{2}_{0}-2xe^x\bigg|^{2}_{0}+2\int^{2}_{0} e^x dx & \mbox{formula of integration by parts} \\ = & x^2e^x-2xe^x+2e^x\bigg|^{2}_{0} & \end{align}

-
I've never seen the notation $D_x$. I like this notation, is this the standard notation ? – 90intuition Dec 15 '12 at 16:59
And thank you for this long informative post ! I absolutely love it ! – 90intuition Dec 15 '12 at 17:06
@90intuition This is too a standard notation. See any calculus book. Good look. – MathOverview Dec 15 '12 at 17:24

We shall use integration by parts: $$\int f^{\prime}(x)g(x)dx=f(x)g(x)-\int f(x)g^{\prime}(x)dx$$

We have $$\int x^2 e^x dx=\int x^2 (e^x)^{\prime} dx=x^2e^x-\int (x^2)^{\prime} e^xdx=x^2e^x-\int2xe^xdx=\\x^2e^x-2\int x (e^x)^{\prime} dx=x^2e^x-2xe^x+2\int e^x=x^2e^x-2xe^x+2e^x+c$$

-
The final answer is then $x^2e^x-2xe^x+2e^x|_0^2$ ? – 90intuition Dec 15 '12 at 16:13
@90intuition Yes – Nameless Dec 15 '12 at 16:14
Thanks for your amazingly quick answer! I understand I think. You're using $f(x)=x^2$ and $g'(x)=e^x$ ? – 90intuition Dec 15 '12 at 16:21
@90intuition In the first integration by parts I do. In the second, I use $f(x)=x$ and $g^{\prime}(x)=e^x$ – Nameless Dec 15 '12 at 16:22
Why is my question down voted ? – 90intuition Dec 15 '12 at 16:26

Hint: Note that $$\int_0^2 x^ne^xdx=\int_0^2 x^nd(e^x)=x^ne^x|_0^2-n\int_0^2 x^{n-1}e^xdx$$ Now continue reducing the power of $x$.

-
If you call LHS as $I(n)$, then $I(n) = 2^ne^2 - nI(n - 1)$, therefore $I(2) = 4e^2 - 2(2e^2 - I(0)) = 4e^2 - 4e^2 + 2I(0) = 2e^2 - 2$ where $I(0)$ is explicitly evaluated. – TenaliRaman Dec 15 '12 at 16:27

$$f(r) = \int_0^{2} e^{rx} dx = \frac{e^2 - 1}{r}$$ $$f'(r) = \int_0^{2} xe^{rx} dx = -\frac{e^2 - 1}{r^2}$$ $$f''(r) = \int_0^{2} x^2e^{rx} dx = \frac{2e^2 - 2}{r^3}$$ $$f''(1) = \int_0^{2} x^2e^{x} dx = 2e^2 - 2$$

-