Math Help - Can somebody find my error in solving this integral?

1. Can somebody find my error in solving this integral?

Evaluate $\int_0^{\pi}f(x)dx$
where $f(x) = 2sin(x), 0 \leq x< \frac{\pi}{2}$
$7cos(x), \frac{\pi}{2} \leq x < \pi$
(Sorry I can't get the LaTex for piecewise to work properly, hope it's not too hard to read)

$\int_0^{\pi}f(x)dx = \int_0^{\frac{\pi}{2}}f(x)dx + \int_{\frac{\pi}{2}}^{\pi}f(x)dx$

= $\int_0^{\frac{\pi}{2}}2sin(x)dx + \int_{\frac{\pi}{2}}^{\pi}7cos(x)dx$

= $[-2cos(x)]_0^{\frac{\pi}{2}} + [7sin(x)]_{\frac{\pi}{2}}^{\pi}$

= $2 + 7 = 9$

I believe the correct answer is -2 + 7 = 5.

2. Originally Posted by Em Yeu Anh
Evaluate $\int_0^{\pi}f(x)dx$
where $f(x) = 2sin(x), 0 \leq x< \frac{\pi}{2}$
$7cos(x), \frac{\pi}{2} \leq x < \pi$
(Sorry I can't get the LaTex for piecewise to work properly, hope it's not too hard to read)

$\int_0^{\pi}f(x)dx = \int_0^{\frac{\pi}{2}}f(x)dx + \int_{\frac{\pi}{2}}^{\pi}f(x)dx$

= $\int_0^{\frac{\pi}{2}}2sin(x)dx + \int_{\frac{\pi}{2}}^{\pi}7cos(x)dx$

= $[-2cos(x)]_0^{\frac{\pi}{2}} + [7sin(x)]_{\frac{\pi}{2}}^{\pi}$

= $2 + 7 = 9$

I believe the correct answer is -2 + 7 = 5.

If you draw the function it must be clear there's much more area under the x-axis than over it, so the integral will be negative:

$[-2cos(x)]_0^{\frac{\pi}{2}} + [7sin(x)]_{\frac{\pi}{2}}^{\pi}$ $=-2(0-1) + 7(0-1)=2-7=-5$

Now, if you were asked to evaluate the (geometrical) AREA between the graph of the function and the x-axis then you have to change the sign of the second integral to make it positive and then the area is 9.

Tonio