# Areas between curves

## A first example

• Let us find the area of the region bounded above by $$y=f(x)=e^x$$, bounded below by $$y=g(x)=x$$, and bounded on the sides by $$x=0$$ and $$x=1$$.
• The method to find this area is a generalization of the method to find the area under a graph.
• We'll calculate the area as a limit $$A=\lim_{n\to\infty}R_n$$.
• In the partial sum $$R_n$$, we once again split the interval $$I=[a,b]$$ to $$n$$ pieces of length $$\Delta x=\frac{b-a}{n}$$.
• The difference is that in this case, the rectangles will have height $$f(x_i^*)-g(x_i^*)$$.
• That is, we'll have $R_n=\sum_{i=1}^n(f(x_i^*)-g(x_i^*))\Delta x,$ and thus the area will be $A=\int_a^bf(x)-g(x)\,\mathrm dx=\int_0^1e^x-x\,\mathrm dx=e^x-\frac{x^2}{2}\Big|_0^1=e-\frac32.$

## Example 2

• Let us find the area of the region enclosed by the parabolas $$y=f(x)=x^2$$ and $$y=g(x)=2x-x^2$$.
• When the interval $$[a,b]$$ is not given, we have to find it. It will be the largest closed interval in which $$f(x)\ge g(x)$$ all along or $$f(x)\le g(x)$$ all along.
• For this, first we need to find the points $$x$$ such that $$f(x)=g(x)$$: \begin{align*} x^2=&2x-x^2\\ 2x^2=&2x, \end{align*} so the points we're looking for are $$x=0,1$$.
• Then we need to decide which function has a larger value on the interval. For this, we substitute a point in the open interval $$(0,1)$$, for example $$0.5$$: $f(0.5)=0.25<g(0.5)=0.75,$
• This shows that we have $$g(x)\ge f(x)$$ on $$[0,1]$$, therefore the area will be $A=\int_a^bg(x)-f(x)\,\mathrm dx=\int_0^12x-2x^2\,\mathrm dx=x^2-\frac23x^3\Big|_0^1=\frac13.$
• Let us find the area bounded by the curves $$y=\sin x$$, $$y=\cos x$$, $$x=0$$, and $$x=\frac{\pi}{2}$$.
• Here, although the base interval $$[a,b]=[0,\frac{\pi}{2}]$$ is given, we still need to decide which function has a larger value.
• We need this because the definite integral calculates the net area. Therefore, over subintervals where $$f(x)\le g(x)$$, the area between the curves gets subtracted, not added.
• Therefore, again we need to find all points $$x$$ in $$[0,\frac{\pi}{2}]$$ such that $$f(x)=g(x)$$: $\sin x=\cos x$ when $$x=\frac{\pi}{4}$$.
• Now we would need test points $$\frac{\pi}{6}$$ from $$(0,\frac{\pi}{4})$$ and $$\frac{\pi}{3}$$ from $$(\frac{\pi}{4},\frac{\pi}{2})$$, but alternatively we can just look at the graph or remember the shapes of the graphs of $$\sin x$$ and $$\cos x$$ to see that $$\cos x\ge \sin x$$ on $$[0,\frac{\pi}{4}]$$, but $$\sin x\ge\cos x$$ on $$[\frac{\pi}{4},\frac{\pi}{2}]$$.
• Therefore, the area is $A=\int_0^{\pi/4}\cos x-\sin x\,\mathrm dx+\int_{\pi/4}^{\pi/2}\sin x-\cos x\,\mathrm dx =[\sin x+\cos x]_0^{\pi/4}+[-\cos x-\sin x]_{\pi/4}^{\pi/2}=2\sqrt2-2.$
• In general, we can say that the area between $$y=f(x)$$ and $$y=g(x)$$ over $$[a,b]$$ is given by $A=\int_a^b|f(x)-g(x)|\,\mathrm dx.$