1. ## evaluate an integral

Hi folks,

I am trying to evaluate the following integral $\int_{0.294}^{0.956}\sqrt{4x - x^2} dx$

I checked the result in wolfram and get 0.94493

I have tried it myself and consistently get the same wrong answer. Can you spot the error?

$\int \sqrt{4 - (2 - x)^2} dx$

let $u = 2 - x$, so $\frac{du}{dx} = -1$ so $\int \sqrt{2^2 - u^2}. (-1) du$

let $u = 2 sin w$ , then $\frac{du}{dw} = 2 \cos w$ and $\sqrt{4 - u^2} = 2 cos w$

so that $-4 \int \cos^2 w dw$

now $\cos^2 w = 1/2 (\cos 2w + 1)$

so

$-2 \int (\cos 2w + 1) dw = -2 ( 1/2 \sin 2w) - 2w = -\sin w - 2w = - u/2 - 2 \sin^{-1} (\frac{u}{2} )$

$\frac{x - 2}{2} - 2 \sin^{-1} \frac{2 - x}{2}$

Now put in the limits

$-0.522 - 2 \sin^{-1} (0.522) - (-0.853 - 2 \sin^{-1} (0.853) )$

$-0.522 - 1.0984 + 0.853 + 2.0434 = -0.5631$

as you see a different result.

2. ## Re: evaluate an integral

Originally Posted by s_ingram
Hi folks,

I am trying to evaluate the following integral $\int_{0.294}^{0.956}\sqrt{4x - x^2} dx$

I checked the result in wolfram and get 0.94493

I have tried it myself and consistently get the same wrong answer. Can you spot the error?

$\int \sqrt{4 - (2 - x)^2} dx$

let $u = 2 - x$, so $\frac{du}{dx} = -1$ so $\int \sqrt{2^2 - u^2}. (-1) du$

let $u = 2 sin w$ , then $\frac{du}{dw} = 2 \cos w$ and $\sqrt{4 - u^2} = 2 cos w$

so that $-4 \int \cos^2 w dw$

now $\cos^2 w = 1/2 (\cos 2w + 1)$
If you carry the limits along with your substitutions, at this step you will actually be doing this integral:$$\int_{1.021706683}^{.5491940886} -2(\cos(2w)+1)~dw =0.9449301179$$
and everything is OK to here.

so

$-2 \int (\cos 2w + 1) dw = -2 ( 1/2 \sin 2w) - 2w = -\sin w - 2w = - u/2 - 2 \sin^{-1} (\frac{u}{2} )$

$\frac{x - 2}{2} - 2 \sin^{-1} \frac{2 - x}{2}$

Now put in the limits

$-0.522 - 2 \sin^{-1} (0.522) - (-0.853 - 2 \sin^{-1} (0.853) )$

$-0.522 - 1.0984 + 0.853 + 2.0434 = -0.5631$

as you see a different result.
The rest of what you have shown gives a good argument for not doing this type of back-substituting in definite integrals.
My first suspicion is careless use of inverse trig functions, which are multiple valued, and for which you must be careful of their ranges.

3. ## Re: evaluate an integral

Interesting point you make about the right point to substitute the limits. Your way can provide a handy shortcut, but it should not alter the result.

I certainly get the right answer when I try it your way.

I used radians for the sin and inverse sine, so I don't think the problem is with the trig functions.

4. ## Re: evaluate an integral

the integral should be

$\displaystyle 2 w + \sin \left( 2 w \right)$

5. ## Re: evaluate an integral

Yes, it is! But I can't get there. I have a negative sign (that came when I switched variable from x to u) and it won't go away!
I also made a typo when I put - sin w instead of - sin 2w, but when I substituted the limits, I did it properly. The issue is the sign. Did I make a mistake when I introduced it or does another negative come from somewhere else?

6. ## Re: evaluate an integral

x from a to b where a < b

$\displaystyle 2-x$ from (2 - a) to (2 - b) with 2 - a > 2 - b

7. ## Re: evaluate an integral

I think you are cheating me here, Idea!
If I understand correctly, you are saying that the integral really is - sin 2w - 2w but when I put the w limits in (integrating from 1.0217 to 0.5492), the smaller number goes first and the larger second and this is where the negative comes from?
If you are saying this, then I am relieved, because it was the conclusion I came to with Walagaster.
When you told me the actual integral was sin 2w + 2w, it tied in with an example in my book, so it confirmed that your earlier post was right (not that I didn't believe you), I just couldn't get the same result.

8. ## Re: evaluate an integral

the x integral

$\displaystyle \sqrt{4x-x^2}$ where $\displaystyle \left\{x,\frac{294}{1000},\frac{956}{1000}\right\}$

the u integral

$\displaystyle -\sqrt{4-u^2},\left\{u,2-\frac{294}{1000},2-\frac{956}{1000}\right\}$

or

$\displaystyle \sqrt{4-u^2},\left\{u,2-\frac{956}{1000},2-\frac{294}{1000}\right\}$

$\displaystyle \sqrt{4-u^2},\left\{u,\frac {261}{250},\frac {853}{500}\right\}$

the w-integral $\displaystyle u=2 sin w$

$\displaystyle 4\cos ^2w,\left\{w,\arcsin \left(\frac{261}{500}\right),\arcsin \left(\frac{853}{1000}\right)\right\}$

$\displaystyle 2+2 \cos ( 2w),\left\{w,\arcsin \left(\frac{261}{500}\right),\arcsin \left(\frac{853}{1000}\right)\right\}$

Integrate to get

$\displaystyle g(w)=2w+\sin (2w)$

and so the final result is

$\displaystyle g\left(\arcsin \left(\frac{853}{1000}\right)\right)-g\left(\arcsin \left(\frac{261}{500}\right)\right)$

9. ## Re: evaluate an integral

Great!
Many thanks, Idea.