# Midpoint Rule with n = 4 to approximate the area of the region bounded between the curves

Use the Midpoint Rule with $n = 4$ to approximate the area of the region bounded between the curves $y = \sin^2 (\pi x/4$) and $y = \cos^2 (\pi x/4$) for $0 ≤ x ≤ 1$.

So here $\delta x = 1/4 = 0.25$

So, the final answer will be this: $0.25((\cos(.125\pi /4)^2 + (\cos(.375\pi /4)^2 + (\cos(.625\pi /4)^2 +(\cos(.875\pi /4)^2) - 0.25((\sin(.125\pi /4)^2 + (\sin(.375\pi /4)^2 + (\sin(.625\pi /4)^2 + (sin(.875\pi /4)^2)$

I put this in calculator and get $0.77$ however, my homework system says it's wrong. I have no clue where I'm wrong.

Any help?

-
Do you know the analytical result? Or can you derive it? – Ron Gordon Jan 25 '13 at 2:38
@rlgordonma I'm not sure what you mean by it. I solved it right now on paper and got the aforementioned equation. – None Jan 25 '13 at 2:39
I mean actually doing out the integral in closed form as a baseline comparison for your midpoint result, i.e. $\int_0^1 dx\,(\cos^2{(\pi x/4)}-\sin^2{(\pi x/4)})$, which just so happens to equal $\int_0^1 dx\,\cos{(\pi x/2)}$. – Ron Gordon Jan 25 '13 at 2:42
@rlgordonma No I haven't done that way since doing that will give a much better approximation than by using the mid point rule (we must use mid point rule). – None Jan 25 '13 at 2:45
I meant to check your work, as well as to see another way (note how I transformed the integral into something simpler). – Ron Gordon Jan 25 '13 at 2:46

The basic idea is right, although the first version of the OP had parentheses in odd places. Undoubtedly the issue is improper use of the calculator. Wrong parentheses maybe. Or even something silly like being in degree mode.

Let us do the calculation again, carefully. I am much too lazy to do all that squaring. So let us note that we want to approximate $$\int_0^1 \left(\cos^2(\pi x/4)-\sin^2(\pi x/4)\right)\,dx.$$ But $\cos 2t=\cos^2 t-\sin^2 t$.

So we want to approximate $$\int_0^1\cos(\pi x/2)\,dx.$$

Now we can do the Midpoint Rule stuff without wearing out our fingers. Note that in principle this should give exactly the same number as what one gets through your calculation, just a lot fewer key presses, so a lot fewer opportunities for error. I get about $0.6407$.

The exact answer is $\dfrac{2}{\pi}$, which is about $0.6366$. Am a little surprised $n=4$ got us this close. Midpoint Rule rules!

-
Thank, that helped. But I still get 0.67: wolframalpha.com/input/… What am I doing wrong? – None Jan 25 '13 at 2:55
@KaranGoel: $\frac 78=0.875,$ not $0.775$. See wolframalpha.com/input/… which agrees with André Nicolas – Ross Millikan Jan 25 '13 at 3:51
Wikipedia says the error bound [given that the second derivative is bounded by $(\frac {\pi}2)^2$] is $\frac {\pi ^2}{4}\frac 1{24}\frac 1{16}\approx 0.0064$. We are about $\frac 23$ of that. – Ross Millikan Jan 25 '13 at 4:02

$$\int_0^1 dx \: \left [\cos^2{\left (\frac{\pi}{4} x \right )} - \sin^2{\left (\frac{\pi}{4} x \right )} \right ] = \int_0^1 dx \: \cos{\left (\frac{\pi}{2} x \right )} = \frac{2}{\pi} \approx 0.63662$$
$$\frac{1}{4} \left [ \cos{\left (\frac{\pi}{2} \frac{1}{8} \right )} + \cos{\left (\frac{\pi}{2} \frac{3}{8} \right )} + \cos{\left (\frac{\pi}{2} \frac{5}{8} \right )} + \cos{\left (\frac{\pi}{2} \frac{7}{8} \right )} \right ] \approx 0.64073$$
I calculated your sum as is and got $0.6407$. So actually it is important that you check your calculator steps individually to see where a mistake is happening. is it on radians? are your doing the squares correctly, etc. Do one terms at a time for a well known angle such as $\pi/4$ and check.