# Thread: [SOLVED] HELP: Evaluate the integral

1. ## [SOLVED] HELP: Evaluate the integral

HELP: Evaluate the integral

2. Originally Posted by babyMT
HELP: Evaluate the integral

$\displaystyle \int_0^1 (x^2+1)e^{-x} \; dx$

Use integration by parts twice.

Or observe that there exists polynomials $\displaystyle p(x)$ such that:

$\displaystyle \frac{d}{dx} p(x)e^{-x} = (x^2+1)e^{-x}$

and the polynomials must be quadratic. Now find such a
polynomial and you will have the indefinite integral for your
integral, so you can then apply the limits of integration to

RonL

3. Originally Posted by CaptainBlack
and the polynomials must be quadratic. Now find such a
polynomial and you will have the indefinite integral for your
integral, so you can then apply the limits of integration to

RonL

I am interested, can you explain how that is done / works please ?

4. Originally Posted by babyMT
HELP: Evaluate the integral
$\displaystyle \int_0^1 (x^2+1)e^{-x}dx$

$\displaystyle =\int_0^1 x^2e^{-x}dx + \int_0^1 e^{-x}dx$

$\displaystyle =\int_0^1 x^2e^{-x}dx + \int_0^1 e^{-x}dx$

Integrate by parts:
$\displaystyle u=x^2$
$\displaystyle du=2xdx$
$\displaystyle dv=e^{-x}$
$\displaystyle v=-e^{-x}$

$\displaystyle =\left[-x^2e^{-x}+C\right]_0^1-(-2)\int_0^1 xe^{-x}dx + \int_0^1 e^{-x}dx$

Integrate by parts:
$\displaystyle u=x$
$\displaystyle du=dx$
$\displaystyle dv=e^{-x}$
$\displaystyle v=-e^{-x}$

$\displaystyle =\left[-x^2e^{-x}+C\right]_0^1+2\left([-xe^{-x}+C]_0^1 + \int_0^1 e^{-x}dx\right) + \int_0^1 e^{-x}dx$

$\displaystyle =\left[-x^2e^{-x}+C\right]_0^1+[-2xe^{-x}+C]_0^1 + 3\int_0^1 e^{-x}dx$

$\displaystyle =\left[-x^2e^{-x}-2xe^{-x}+C\right]_0^1 + 3\int_0^1 e^{-x}dx$

$\displaystyle =\left[-x^2e^{-x}-2xe^{-x}+C\right]_0^1 + [-3e^{-x}+C]_0^1$

$\displaystyle =\left[-x^2e^{-x}-2xe^{-x}-3e^{-x}+C\right]_0^1$

$\displaystyle =(-1^2e^{-1}-2(1)e^{-1}-3e^{-1}+C) - (-0^2e^{-0}-2(0)e^{-0}-3e^{-0}+C)$

$\displaystyle =-e^{-1}-2e^{-1}-3e^{-1}+C +3(1)-C$

$\displaystyle =-6e^{-1} +3$

5. Originally Posted by bobak
I am interested, can you explain how that is done / works please ?
$\displaystyle \frac{d}{dx} p(x)e^{-x} = (x^2+1)e^{-x}$.

Let $\displaystyle p(x) = ax^2 + bx + c$. Then:

$\displaystyle \frac{d}{dx} (ax^2 + bx + c) e^{-x} = (x^2+1)e^{-x}$.

From the product rule:

$\displaystyle (2ax + b) e^{-x} - (ax^2 + bx + c) e^{-x} = (x^2+1)e^{-x}$

Factorise, group like terms and simplify the left hand side:

$\displaystyle (-ax^2 + [2a - b]x + [b - c]) e^{-x} = (x^2+1) e^{-x}$.

Equate coefficients of the quadratic on each side:

-a = 1 => a = -1.

2a - b = 0 => -2 - b = 0 => b = -2.

b - c = 1 => -2 - c = 1 => c = -3.

So $\displaystyle \frac{d}{dx} (-x^2 - 2x - 3) e^{-x} = (x^2+1)e^{-x}$.

Now integrate both sides, noting that the left hand side becomes $\displaystyle (-x^2 - 2x - 3) e^{-x}$ .......

6. That was brilliant, do you have any others that can be done like this? I want to give it a try.

7. Originally Posted by angel.white
That was brilliant, do you have any others that can be done like this? I want to give it a try.
Let it first be said that the kudos goes to CaptainBlack (but I'll hold it in safe-keeping - for a while )

It works for integrands of the form:

$\displaystyle (\text{polynomial of degree } n) e^{kx}$ (an example has already been seen).

$\displaystyle (\text{polynomial of degree } n) \sin (kx)$ or $\displaystyle (\text{polynomial of degree } n) \cos (kx)$,

where you would observe that there exists polynomials $\displaystyle p(x)$ and $\displaystyle q(x)$ of degree n such that $\displaystyle \frac{d}{dx} [p(x) \cos (kx) + q(x) \sin (kx)]$ gives the integrand.

Try integrating $\displaystyle (x^2 + 1) \sin x$ this way. There's a subtle difference to the example just done ....

If you think about it a bit, you'll think of more.

The idea boils down to making a shrewd guess or observation as to the form of function which, when differentiated, gives the integrand. The technique is sometimes refered to as integration by recognition.

8. Originally Posted by mr fantastic
Let it first be said that the kudos goes to CaptainBlack (but I'll hold it in safe-keeping - for a while )

It works for integrands of the form:

$\displaystyle (\text{polynomial of degree } n) e^{kx}$ (an exmaple has already been seen).

$\displaystyle (\text{polynomial of degree } n) \sin (kx)$ or $\displaystyle (\text{polynomial of degree } n) \cos (kx)$,

where you would observe that there exists polynomials $\displaystyle p(x)$ of degree n such that $\displaystyle \frac{d}{dx} p(x) (\cos (kx) + \alpha \sin (kx)$ gives the integrand.

Try integrating $\displaystyle (x^2 + 1) \sin x$ this way. There's a subtle difference to the example just done ....

If you think about it a bit, you'll think of more.

The idea boils down to making a shrewd guess or observation as to the form of function which, when differentiated, gives the integrand. The technique is sometimes refered to as integration by recognition.
I had a professor that solved his differential equations that way. He'd start with a proposed solution and modify it until it worked. I never have been able to figure out how he did it, other than perhaps a great deal of experience and intuition.

-Dan

9. topsquark beat my erratum edit by 1 minute, so I'll just add the corrected bit here so that there's no chance of a mixup when reading his quote of my previous reply.

Originally Posted by after editing by mr fantastic
[snip]
$\displaystyle (\text{polynomial of degree } n) \sin (kx)$ or $\displaystyle (\text{polynomial of degree } n) \cos (kx)$,

where you would observe that there exists polynomials $\displaystyle p(x)$ and $\displaystyle q(x)$ of degree n such that $\displaystyle \frac{d}{dx} [p(x) \cos (kx) + q(x) \sin (kx)]$ gives the integrand.
[snip]

10. Originally Posted by mr fantastic
Let it first be said that the kudos goes to CaptainBlack (but I'll hold it in safe-keeping - for a while )

It works for integrands of the form:

$\displaystyle (\text{polynomial of degree } n) e^{kx}$ (an example has already been seen).

$\displaystyle (\text{polynomial of degree } n) \sin (kx)$ or $\displaystyle (\text{polynomial of degree } n) \cos (kx)$,

where you would observe that there exists polynomials $\displaystyle p(x)$ and $\displaystyle q(x)$ of degree n such that $\displaystyle \frac{d}{dx} [p(x) \cos (kx) + q(x) \sin (kx)]$ gives the integrand.

Try integrating $\displaystyle (x^2 + 1) \sin x$ this way. There's a subtle difference to the example just done ....

If you think about it a bit, you'll think of more.

The idea boils down to making a shrewd guess or observation as to the form of function which, when differentiated, gives the integrand. The technique is sometimes refered to as integration by recognition.
Well, here was my first attempt

$\displaystyle (x+1)sin(x)=\frac d{dx}\left[(a_1x^2+b_1x+c_1)sin(x) + (a_2x^2+b_2x+c_2)cos(x) \right]$

$\displaystyle (x+1)sin(x)=(a_1x^2+b_1x+c_1)cos(x)+ (2a_1x+b_1)sin(x) + (2a_2x+b_2)cos(x)$ $\displaystyle - (a_2x^2+b_2x+c_2)sin(x)$

$\displaystyle (x+1)sin(x)=[a_1x^2+x(b_1+2a_2)+(c_1+b_2)]cos(x)+ [-a_2x^2 +x(2a_1-b_2)+(b_1-c_2)]sin(x)$

I got really confused at this point and realized I had chosen n=2 which should have been n=1

------------------------------

Here was my second attempt, I set n=1 and used only cosine
$\displaystyle (x+1)sin(x)=\frac d{dx}(ax+b)cos(x)$

$\displaystyle (x+1)sin(x)=acos(x)-(ax+b)sin(x)$

Here I didn't know what to do with the acos(x) but I realized if I added -asin(x) to the initial formula, I could get it to go away, so I stuck that onto the initial formula:

$\displaystyle (x+1)sin(x)=\frac d{dx}[(ax+b)cos(x)-asin(x)]$

$\displaystyle (x+1)sin(x)=(-ax-b)sin(x)$

$\displaystyle x+1=-ax-b$

$\displaystyle x+1=-ax-b$

a=-1
b=-1

Revising the Initial formula:

$\displaystyle (x+1)sin(x)=\frac d{dx}[(-x-1)cos(x)+sin(x)]$

$\displaystyle \int (x+1)sin(x)=(-x-1)cos(x)+sin(x)$

------------------------------

Still didn't seem right, I tried it a third time using n=1 and both cos and sin

$\displaystyle (x+1)sin(x)=\frac d{dx}\left[(a_1x+b_1)sin(x) + (a_2x + b_2)cos(x) \right]$

$\displaystyle (x+1)sin(x)=-(a_1x+b_1)cos(x)+a_1sin(x) + (a_2x + b_2)sin(x)+a_2cos(x)$

$\displaystyle (x+1)sin(x)=[-a_1x+(a_2-b_1)]cos(x)+[a_2x+(a_1+b_2)]sin(x)$

------------------------------

Then I got frustrated, and checked my answer, and realized my second answer was correct, and I just differentiated it wrong when I checked it >.<

So I guess It's still confusing to me to figure out how to set this one up. I think I can do the e^(kx) ones, though. They seem much more straightforward.

11. Originally Posted by mr fantastic
Let it first be said that the kudos goes to CaptainBlack (but I'll hold it in safe-keeping - for a while )

It works for integrands of the form:

$\displaystyle (\text{polynomial of degree } n) e^{kx}$ (an example has already been seen).

$\displaystyle (\text{polynomial of degree } n) \sin (kx)$ or $\displaystyle (\text{polynomial of degree } n) \cos (kx)$,

where you would observe that there exists polynomials $\displaystyle p(x)$ and $\displaystyle q(x)$ of degree n such that $\displaystyle \frac{d}{dx} [p(x) \cos (kx) + q(x) \sin (kx)]$ gives the integrand.

Try integrating $\displaystyle (x^2 + 1) \sin x$ this way. There's a subtle difference to the example just done ....

If you think about it a bit, you'll think of more.

The idea boils down to making a shrewd guess or observation as to the form of function which, when differentiated, gives the integrand. The technique is sometimes refered to as integration by recognition.
There is of course another trick to integrating $\displaystyle (x^2 + 1) \sin x$. That is to integrate $\displaystyle (x^2 + 1) e^{ix}, x \in \mathbb{R}$ and keep the imaginary part of the integral.

RonL