\begin{frame}
\frametitle{Area Between Curves}
\begin{exampleblock}{}
Find the area between $f(x) = x^2 - 6x + 8$ from $1$ to $6$.
\medskip\pause
An antiderivative of $f$ is $F(x) = \pause \frac{1}{3}x^3 - 3x^2 + 8x$.
\pause\smallskip
We need to find the $x$-intercepts in $[1,6]$:
\begin{talign}
f(x) = \mpause[1]{(x - 2)(x-4)}\mpause{ = 0 \quad\iff\quad x = 2 \;\text{ or }\; x = 4}
\end{talign}
\pause\pause\pause\vspace{-2.5ex}
\only<-11>{\vspace{-1ex}
\begin{center}
\scalebox{.9}{
\begin{tikzpicture}[default,yscale=.7]
\def\mfun{(\x^2 - 6*\x + 8)}
\diagram[1]{-.5}{7}{-1}{3}{1}
\diagramannotatez
\def\mfunshift{0}
\begin{scope}[ultra thick]
\draw[fill=cgreen,draw=none,opacity=.5] plot[smooth,domain=1:2,samples=20] (\x,{\mfun}) -- (1,0) -- cycle;
\draw[fill=cgreen,draw=none,opacity=.5] plot[smooth,domain=2:4,samples=20] (\x,{\mfun}) -- cycle;
\draw[fill=cgreen,draw=none,opacity=.5] plot[smooth,domain=4:5,samples=20] (\x,{\mfun}) -- (6,3) -- (6,0) -- cycle;
\draw[cred] plot[smooth,domain=1:5,samples=20] (\x,{\mfun});
\node[anchor=north] at (1,0) {$1$};
\node[anchor=north] at (6,0) {$6$};
\draw[gray] (2,.2) -- node[at end,below,black] {$2$} (2,-.2);
\draw[gray] (4,.2) -- node[at end,below,black] {$4$} (4,-.2);
\end{scope}
\end{tikzpicture}
}
\end{center}\vspace{-1ex}
}
\pause
Then the area between the curve and the $x$-axis from $1$ to $6$ is
\begin{talign}
A \quad&=\quad
\mpause[1]{\left| \int_1^2 f(x)dx \right|}
\mpause{\;+\; \left|\int_2^4 f(x)dx\right|}
\mpause{\;+\; \left|\int_4^6 f(x)dx\right|}
\\\mpause{}
&\mpause{= \quad \left|F(2) - F(1)\right| \;+\; \left|F(4)-F(2)\right| \;+\; \left|F(6) - F(4)\right|}
\\
&\mpause{= \quad \left|\frac{20}{3} - \frac{16}{3}\right| \;+\; \left|\frac{16}{3} - \frac{20}{3}\right| \;+\; \left|\frac{36}{3} - \frac{16}{3}\right|}
\\
&\mpause{= \quad \left|\frac{4}{3}\right| \;+\; \left|-\frac{4}{3}\right| \;+\; \left|\frac{20}{3}\right|}
\\
&\mpause{= \quad \frac{28}{3}}
\end{talign}\vspace{-2ex}
\end{exampleblock}
\end{frame}