Is the integral always the area under the curve?
Solution 1:
Saying "the integral is the area under the curve" is a common misconception that needs qualification. More precisely:
- If $f(x)\ge 0$ on $(a,b)$, then the area under the curve is given by $\int_a^b f(x)\,dx$.
- More generally, with no qualifications on the sign of $y=f(x)$, we say that $\int_a^b f(x)\,dx$ represents the (net) signed area under the curve meaning that on subinterval(s) where $f(x)\leq 0$, we think of the integral as "negative area", and on subintervals where $f(x)\geq 0$, we think of the integral as "positive area". Then the integral over the whole interval is the sum of these two.
More precisely, if $f:I\to\mathbb R$ with $I=P\cup N$ and $$ \begin{cases} f(x)\geq 0, &x\in P,\\ f(x)\leq 0, &x\in N, \end{cases} $$ then $$ \int_I f(x)\,dx=\underbrace{\int_P f(x)\,dx}_{\geq 0}+\underbrace{\int_N f(x)\,dx}_{\leq 0}.$$
In your example, $$\int_{-\pi/2}^{\pi/2}\sin x\,dx,$$ we can envision the problem like this
We see that $\sin x\leq 0$ on $[-\pi/2,0]$ and $\sin x\geq 0$ on $[0,\pi/2]$, thus \begin{align} \int_{-\pi/2}^{\pi/2}\sin x\,dx=\int_{-\pi/2}^0 \sin x\,dx+\int_0^{\pi/2}\sin x\,dx =-1+1=0. \end{align} From the picture, the "net area" of the $-1$ in red and the $+1$ in green is of course $0$, and the calculus reflects that.
On the other hand, the total area of the shaded region (not signed area) is $$ \int_{-\pi/2}^{\pi/2}|\sin x|\,dx=\int_{-\pi/2}^0 -\sin x\,dx+\int_0^{\pi/2}\sin x\,dx=-(-1)+1=2. $$ In this case, we negated the $-1$ area in red to get a $+1$ and then added this to the $+1$ area in green to get a total area of $2$.
So be careful about saying "integral is the area under the curve" without qualification!