MAT1001 Differential Calculus: Lecture Notes

\(\newcommand{\footnotename}{footnote}\) \(\def \LWRfootnote {1}\) \(\newcommand {\footnote }[2][\LWRfootnote ]{{}^{\mathrm {#1}}}\) \(\newcommand {\footnotemark }[1][\LWRfootnote ]{{}^{\mathrm {#1}}}\) \(\let \LWRorighspace \hspace \) \(\renewcommand {\hspace }{\ifstar \LWRorighspace \LWRorighspace }\) \(\newcommand {\TextOrMath }[2]{#2}\) \(\newcommand {\mathnormal }[1]{{#1}}\) \(\newcommand \ensuremath [1]{#1}\) \(\newcommand {\LWRframebox }[2][]{\fbox {#2}} \newcommand {\framebox }[1][]{\LWRframebox } \) \(\newcommand {\setlength }[2]{}\) \(\newcommand {\addtolength }[2]{}\) \(\newcommand {\setcounter }[2]{}\) \(\newcommand {\addtocounter }[2]{}\) \(\newcommand {\arabic }[1]{}\) \(\newcommand {\number }[1]{}\) \(\newcommand {\noalign }[1]{\text {#1}\notag \\}\) \(\newcommand {\cline }[1]{}\) \(\newcommand {\directlua }[1]{\text {(directlua)}}\) \(\newcommand {\luatexdirectlua }[1]{\text {(directlua)}}\) \(\newcommand {\protect }{}\) \(\def \LWRabsorbnumber #1 {}\) \(\def \LWRabsorbquotenumber "#1 {}\) \(\newcommand {\LWRabsorboption }[1][]{}\) \(\newcommand {\LWRabsorbtwooptions }[1][]{\LWRabsorboption }\) \(\def \mathchar {\ifnextchar "\LWRabsorbquotenumber \LWRabsorbnumber }\) \(\def \mathcode #1={\mathchar }\) \(\let \delcode \mathcode \) \(\let \delimiter \mathchar \) \(\def \oe {\unicode {x0153}}\) \(\def \OE {\unicode {x0152}}\) \(\def \ae {\unicode {x00E6}}\) \(\def \AE {\unicode {x00C6}}\) \(\def \aa {\unicode {x00E5}}\) \(\def \AA {\unicode {x00C5}}\) \(\def \o {\unicode {x00F8}}\) \(\def \O {\unicode {x00D8}}\) \(\def \l {\unicode {x0142}}\) \(\def \L {\unicode {x0141}}\) \(\def \ss {\unicode {x00DF}}\) \(\def \SS {\unicode {x1E9E}}\) \(\def \dag {\unicode {x2020}}\) \(\def \ddag {\unicode {x2021}}\) \(\def \P {\unicode {x00B6}}\) \(\def \copyright {\unicode {x00A9}}\) \(\def \pounds {\unicode {x00A3}}\) \(\let \LWRref \ref \) \(\renewcommand {\ref }{\ifstar \LWRref \LWRref }\) \( \newcommand {\multicolumn }[3]{#3}\) \(\require {textcomp}\) \(\require {upgreek}\) \(\newcommand {\intertext }[1]{\text {#1}\notag \\}\) \(\let \Hat \hat \) \(\let \Check \check \) \(\let \Tilde \tilde \) \(\let \Acute \acute \) \(\let \Grave \grave \) \(\let \Dot \dot \) \(\let \Ddot \ddot \) \(\let \Breve \breve \) \(\let \Bar \bar \) \(\let \Vec \vec \) \(\require {cancel}\) \(\newcommand {\LWRsubmultirow }[2][]{#2}\) \(\newcommand {\LWRmultirow }[2][]{\LWRsubmultirow }\) \(\newcommand {\multirow }[2][]{\LWRmultirow }\) \(\newcommand {\mrowcell }{}\) \(\newcommand {\mcolrowcell }{}\) \(\newcommand {\STneed }[1]{}\) \(\def \ud {\mathrm {d}}\) \(\def \ui {\mathrm {i}}\) \(\def \uj {\mathrm {j}}\) \(\def \uh {\mathrm {h}}\) \(\newcommand {\R }{\mathbb {R}}\) \(\newcommand {\N }{\mathbb {N}}\) \(\newcommand {\C }{\mathbb {C}}\) \(\newcommand {\Z }{\mathbb {Z}}\) \(\newcommand {\CP }{\mathbb {C}P}\) \(\newcommand {\RP }{\mathbb {R}P}\) \(\def \bk {\vec {k}}\) \(\def \bm {\vec {m}}\) \(\def \bn {\vec {n}}\) \(\def \be {\vec {e}}\) \(\def \bE {\vec {E}}\) \(\def \bx {\vec {x}}\) \(\def \uL {\mathrm {L}}\) \(\def \uU {\mathrm {U}}\) \(\def \uW {\mathrm {W}}\) \(\def \uE {\mathrm {E}}\) \(\def \uT {\mathrm {T}}\) \(\def \uV {\mathrm {V}}\) \(\def \uM {\mathrm {M}}\) \(\def \uH {\mathrm {H}}\) \(\DeclareMathOperator {\sech }{sech}\) \(\DeclareMathOperator {\csch }{csch}\) \(\DeclareMathOperator {\arcsec }{arcsec}\) \(\DeclareMathOperator {\arccot }{arcCot}\) \(\DeclareMathOperator {\arccsc }{arcCsc}\) \(\DeclareMathOperator {\arccosh }{arcCosh}\) \(\DeclareMathOperator {\arcsinh }{arcsinh}\) \(\DeclareMathOperator {\arctanh }{arctanh}\) \(\DeclareMathOperator {\arcsech }{arcsech}\) \(\DeclareMathOperator {\arccsch }{arcCsch}\) \(\DeclareMathOperator {\arccoth }{arcCoth}\) \(\def \re {\textup {Re}}\) \(\def \im {\textup {Im}}\) \(\newcommand {\up }{\uppi }\) \(\newcommand {\ut }{\uptheta }\) \(\newcommand {\uw }{\upomega }\) \(\newcommand {\uph }{\upphi }\) \(\newcommand {\uvph }{\upvarphi }\) \(\polylongdiv \)

Chapter 4 Integration

Integration: The inverse process to differentiation, i.e. the process of finding a function with a derivative that is a given function.

Penguin Dictionary of Mathematics

4.1 Integration and antiderivatives

As the above quote from the Penguin Dictionary of Mathematics says, integration is the reverse process to differentiation. If differentiation is all about finding the rates of change of functions then we an think of integration as being about the areas under curves. As with differentiation it is a process that was discovered to handle problems from physics so you can find plenty of examples of applications by looking into topics from mechanics. We may meet some of those at the end of this chapter, but for now we will focus on the mathematics.

(Graph of sin(x).)

Figure 4.1: The graph of the sine function \(f(x)=\sin (x)\) with the area between the curve and the \(x\)-axis between \(x=0\) and \(x=3\pi /2\) shaded. Note that the total shaded area is \(A=A_{1}+A_{2}\).

The integral of a function over an interval is a measure of the signed area between the curve and the \(x\)-axis, with the convention that areas above the \(x\)-axis are positive and areas under the \(x\)-axis are negative. This is shown for \(f(x)=\sin (x)\) between \(0\) and \(3\pi /2\) in fig. 4.1. When we discuss numerical methods of integration in chapter 6 we will understand how to approximate these areas using thin rectangles as is shown in fig. 1.4.

For now we will approach integration as the reverse of differentiation. In other words, if we have a function \(f(x)\) we want to find the function whose derivative is \(f(x)\).

  • Example 4.1. If we have the function

    \begin{equation*} f(x)=x^{4}+2x^{2}+2 \end{equation*}

    what function is this the derivative of?

    To find this we need to remember our rules for differentiation, in particular the monomial rule of eq. (3.10), which says that we need to find an \(x^{n}, x^{m}\) and an \(x^{p}\) such that

    \begin{align*} \frac {\ud (ax^{n})}{\ud x}&=anx^{n-1}=x^{4},\\ \frac {\ud (bx^{m})}{\ud x}&=bmx^{m-1}=2x^{2},\\ \frac {\ud (cx^{p})}{\ud x}&=cpx^{p-1}=2. \end{align*}

    By observation we find that \(n=5, a=1/5\), \(m=3, b=2/3\), \(p=1\) and \(c=2\). Thus if we have the function

    \begin{equation*} F(x)=\frac {1}{5}x^{5}+\frac {2}{3}x^{3}+2x, \end{equation*}

    its derivative is \(F'(x)=f(x)\).

    This looks like we are done. However, recall that in eq. (3.9) we said that the derivative of a constant is zero. Thus we could add any constant to \(F(x)\) and still have a function whose derivative is \(f(x)\). This means that we should write

    \begin{equation*} F(x)=\frac {1}{5}x^{5}+\frac {2}{3}x^{3}+2x+c, \end{equation*}

    where \(c\) can be any constant such as \(0, 10, \pi , 11/25, -2, \dots \) , when we have our brief discussion in chapter 5, we will see that often there are conditions that we need to apply which determine the constant.

Notice that since the constant in the example is arbitrary there are actually an infinite number of \(F(x)\)’s such that their derivative is the given \(f(x)\). We call such functions \(F(x)\) antiderivatives of \(f(x)\).

As an aside, you might be wondering why a constant shows up here, but we did not mention anything about a constant when giving the intuition of an integral as the area under a curve. Surely the area is a fixed concept and cannot be arbitrarily changed by a constant? This is true. The difference is because when we talked about the area under a curve, we specified a region of the \(x\)-axis that we were interested in.

This leads to what is called a definite integral which we will study in more detail later. When we are constructing an antiderivative like \(F(x)\), we are not specifying any limits which is why we need to add the constant. You will gain more experience with this as we look at some more examples.

In general we say that given a function \(f(x)\), an antiderivative of \(f(x)\) is any function \(F(x)\) such that

\begin{equation} \frac {\ud F}{\ud x}=f(x). \label {eq: antiderivative} \end{equation}

When we are explicitly including the arbitrary constant \(c\) we refer to the indefinite integral of \(f(x)\) denoted by

\begin{equation} \int f(x) \ud x=F(x)+c. \label {eq: indefinite integral} \end{equation}

The symbol \(\int \) is the integral or integration symbol and in the above expression \(f(x)\) is called the integrand, the function being integrated, while \(x\) is called the integration variable and \(c\) is the constant of integration.

As with many things in this module, the easiest way to get to grips with the content and the new terminology is through solving example problems.

  • Example 4.2. The indefinite integral

    \begin{equation*} \int \left (x^{4}+2x^{2}+2\right )\ud x \end{equation*}

    is calculated as in the same way as the antiderivative above. Thus we have

    \begin{equation*} \int \left (x^{4}+2x^{2}+2\right )\ud x=\frac {1}{5}x^{5}+\frac {2}{3}x^{3}+2x+c. \end{equation*}

It is important to include the \(\ud x\) after the \(\int \) so that it is clear what is being integrated over. I also like to put brackets round the integrand when it involves multiple terms to make it unambiguous what is being integrated over.

Warning! If you are asked to calculate an indefinite integral you must include the constant of integration for your answer to be counted as correct.

Note that the integral has several nice properties which we will not prove here:

\begin{align} \int c f(x) \ud x &= c\int f(x) \ud x, \label {eq: integral scalar multiplication}\\ \int \left (-f(x)\right )\ud x&=-\int f(x)\ud x, \\ \int \left (f(x)\pm g(x)\right )\ud x &=\int f(x)\ud x \pm \int g(x)\ud x. \label {eq: integral of sum} \end{align} These are analogous to eqs. (3.3) to (3.5) for the derivative. We have implicitly been using them already.

Note that for all of the functions that we know the derivative of we now know the integral of by reversing the identities so we have that

\begin{align*} \int \cos (x)\ud x &=\sin (x) +c,\\ \int \sin (x) \ud x &=-\cos (x)+c,\\ \int \frac {1}{x}\ud x &=\ln (x) +c,\\ \int e^{x}\ud x &=e^{x}+c. \end{align*}

We can also invert the identity that

\begin{equation*} \frac {\ud x^{n}}{\ud x}=nx^{n-1} \end{equation*}

to be

\begin{equation} \int x^{n}\ud x =\frac {1}{n+1}x^{n+1} +c \label {eq: integral of monomial} \end{equation}

which holds for \(n\neq -1\).

  • Example 4.3. We know that the derivative of \(\tan (x)\) is \(\sec ^{2}(x)\) which means that the antiderivative of \(\sec ^{2}(x)\) is

    \begin{equation*} F(x)=\tan (x), \end{equation*}

    and the indefinite integral is thus

    \begin{equation*} \int \sec ^{2}(x)\ud x = \tan (x)+c. \end{equation*}

  • Exercise 4.4. Show that these trig functions have the claimed indefinite integrals:

    \begin{align*} \int \csc ^{2}(x)\ud x &=-\cot (x) +c,\\ \int \sec (x)\tan (x)\ud x &=\sec (x) +c,\\ \int \csc (x)\cot (x)\ud x &=-\csc (x) +c. \end{align*}

The process of calculating an integral by finding the antiderivative as the reverse of differentiation is sometimes called integration by inspection. This is very useful when you have a simple enough function that you already know what you differentiate to get it.

  • Example 4.5. The integral

    \begin{equation*} \int \ud x, \end{equation*}

    is found by inverting the derivative identity \(\left (x\right )'=1\) to give

    \begin{equation*} \int \ud x=\int 1\ud x =x+c. \end{equation*}

  • Example 4.6. Using some of the standard integrals that we have given above we evaluate

    \begin{equation*} \int \left (x^{2}+x^{-3}+x^{-1}\right )\ud x \end{equation*}

    as follows:

    \begin{align*} \int \left (x^{2}+x^{-3}+x^{-1}\right )\ud x&=\int x^{2}\ud x+\int x^{-3}\ud x+\int x^{-1}\ud x\\ &=\frac {1}{3}x^{3}-\frac {1}{2}x^{-2}+\ln (x) +c\\ &=\frac {x^{3}}{3}-\frac {1}{2x^{2}}+\ln (x)+c. \end{align*} Note that here we have used eq. (4.6) for both the positive and negative power terms.

4.2 Techniques for integration

Integration by substitution

Now that we know the basics of how to calculate indefinite integrals we can introduce some common techniques. The first of these is integration by substitution, which is a way to integrate more complicated expressions by making them look like expressions that we already know how to integrate.

The idea behind integration by substitution is to consider an integral like

\begin{equation*} I= \int 3x^{2}\sqrt [3]{x^{3}+4}\ud x. \end{equation*}

We then observe that if we let \(u=x^{3}+4\) and differentiate \(u\) with respect to \(x\) we get

\begin{equation*} \frac {\ud u}{\ud x}=3x^{2}. \end{equation*}

Then we see that we can rewrite \(I\) as

\begin{equation*} I=\int \frac {\ud u}{\ud x}\sqrt [3]{u}\ud x. \end{equation*}

Remember back in chapter 3 we said that in certain circumstances we could treat a derivative as a bit like a fraction, well we can do this under an integral sign. It turns out that if we define a function \(u(x)\) then integrating over \(u\) is related to integrating over \(x\) in the following way

\begin{equation} \int f(u)\ud u=\int f(u(x))\frac {\ud u}{\ud x}\ud x. \label {eq: measure change of variable} \end{equation}

This means that in our above integral we can rewrite \(\frac {\ud u}{\ud x}\ud x=\ud u\) so that

\begin{equation*} I=\int \frac {\ud u}{\ud x}\sqrt [3]{u}\ud x=\int \sqrt [3]{u}\ud u=\frac {3}{4}u^{\frac {4}{3}}. \end{equation*}

This is the same recipe that we will always use when integrating by substitution:

  • Simplify the integrand as much as possible.

  • Guess at a simplifying substitution \(u=u(x)\), or use the substitution that you are given.

  • Calculate the derivative \(\ud u/\ud x\) and turn the integral over \(x\) into an integral over \(u\).

  • Evaluate the integral over \(u\)

Not all substitutions are as obvious as the above one, this is particularly true for trig substitutions where identifying the correct substitution to use takes practice.

  • Example 4.7. Consider the integral

    \begin{equation*} I=\int \frac {1}{x^{2}+1}\ud x. \end{equation*}

    We can evaluate this using the substitution \(x=\tan (u)\), then since \(\tan (u)=\sin (u)/\cos (u)\) we use the quotient rule to evaluate the derivative of \(\sin (u)\)

    \begin{align*} \frac {\ud }{\ud u}\tan (u) &=\frac {\ud }{\ud u}\left (\frac {\sin (u)}{\cos (u)}\right )\\ &=\frac {1}{\cos ^{2}}\left (\cos ^{2}(u)+\sin ^{2}(u)\right )\\ &=1+\tan ^{2}(u). \end{align*} Recalling that \(x=\tan (u)\) we have that

    \begin{equation*} \frac {\ud x}{\ud u}=1+x^{2}, \end{equation*}

    which means that

    \begin{align*} I &=\int \frac {1}{x^{2}+1}\ud x\\ &=\int \frac {1}{x^{2}+1}\frac {\ud x}{\ud u}\ud u\\ &=\int \frac {1}{x^{2}+1}(x^{2}+1)\ud u\\ &=\int \ud u\\ &=u+c\\ &=\arctan (x)+c. \end{align*}

Approaches like the above example are how we can calculate integral expressions for all of the inverse trig functions. We just need to know the correct substitution.

Integration by parts

Integration by parts is the integral equivalent of the product rule from differentiation. We can use it whenever we have an integral which is the product of two functions and we know how to differentiate one of them and how to integrate the other.

Recall that the product rule says that given two functions of \(x\), \(f(x),g(x)\) the derivative of their product is

\begin{equation*} \frac {\ud }{\ud x}\left (fg\right )=\frac {\ud f}{\ud x}g(x)+f(x)\frac {\ud g}{\ud x}. \end{equation*}

If we integrate this expression we have that

\begin{align*} \int \frac {\ud }{\ud x}\left (fg\right )\ud x &=f(x)g(x)+c,\\ &=\int \left (\frac {\ud f}{\ud x}g(x)+f(x)\frac {\ud g}{\ud x}\right )\ud x\\ &=\int \frac {\ud f}{\ud x}g(x)\ud x+\int f(x)\frac {\ud g}{\ud x}\ud x. \end{align*} rearranging this and setting \(c\) to zero gives

\begin{equation} \int f(x)\frac {\ud g}{\ud x}\ud x=f(x)g(x)-\int \frac {\ud f}{\ud x}g(x)\ud x. \label {eq: integration by parts} \end{equation}

The reason that we can set \(c\) to zero is that we still have some other indefinite integrals that have not been evaluated and these contain a constant of integration. Thus we can absorb \(c\) into the remaining integral.

The formula in eq. (4.8) is known as the integration by parts formula. We will apply it for indefinite integrals first and then turn to definite integrals.

  • Example 4.8. Consider the integral

    \begin{equation*} \int \ln (x)\ud x=\int \ln (x) 1 \ud x=\int \ln (x)\frac {\ud x}{\ud x}\ud x \end{equation*}

    this can be evaluated using integration by parts with \(f(x)=\ln (x)\) and \(g(x)=x\).

    Applying eq. (4.8) gives

    \begin{align*} \int \ln (x)\ud x &=\int \ln (x)\frac {\ud x}{\ud x}\ud x\\ &=\ln (x) x -\int \left (\frac {\ud }{\ud x}\ln (x)\right )x\ud x\\ &=x\ln (x)-\int \frac {1}{x}x \ud x\\ &=x\ln (x)-x+c. \end{align*}

The trick when applying integration by parts is to look for one function that is easy to integrate, which will be our \(\ud g(x)/\ud x\), and another that is easy to differentiate, our \(f(x)\).

  • Example 4.9. Consider the integral

    \begin{equation*} \int x\sin (x)\ud x =\int x\frac {\ud }{\ud x}\left (-\cos (x)\right )\ud x. \end{equation*}

    We integrate this by parts taking \(f(x)=x\) and \(g(x)=-\cos (x)\), so that

    \begin{align*} \int x\sin (x)\ud x &=\int x\frac {\ud }{\ud x}\left (-\cos (x)\right )\ud x\\ &=x(-\cos (x))-\int \left (\frac {\ud x}{\ud x}\right )(-\cos (x))\ud x\\ &=-x\cos (x)+\int \cos (x)\ud x\\ &=-x\cos (x)+\sin (x)+c. \end{align*}

  • Exercise 4.10. Use integration by parts to evaluate

    \begin{equation*} I=\int x e^{2x}\ud x. \end{equation*}

In this module we will only come across problems where you need to apply integration by parts once. However, some integrals require us to apply integration by parts more than once, and some require other tricks.

  • Mathematical Diversion 4.1. As an example of repeated integration by parts consider

    \begin{equation*} I=\int x^{2}\sin (x)\ud x=\int x^{2}\frac {\ud }{\ud x}(-\cos (x))\ud x. \end{equation*}

    We can carry out an integration by parts taking \(f(x)=x^{2}\) and \(g(x)=-\cos (x)\) to get

    \begin{align*} I &=\int x^{2}(-\cos (x))\ud x\\ &=-x^{2}\cos (x)-\int 2x(-\cos (x))\ud x\\ &=-x^{2}\cos (x)+2\int x\cos (x)\ud x\\ &=-x^{2}\cos (x)+2\int x\frac {\ud }{\ud x}(\sin (x))\ud x. \end{align*} The integral in the last line is one that we have to do by parts taking \(f(x)=x\) and \(g(x)=\sin (x)\). This means that

    \begin{align*} I &=-x^{2}\cos (x)+2\int x\frac {\ud }{\ud x}(\sin (x))\ud x\\ &=-x^{2}\cos (x)+2\left (x\sin (x)-\int \sin (x)\ud x\right )\\ &=-x^{2}\cos (x)+2\left (x\sin (x)+\cos (x)+c\right )\\ &=-x^{2}\cos (x)+2x\sin (x)+2\cos (x)+\tilde {c}, \end{align*} where in the last line we have redefined the constant of integration to be \(\tilde {c}=2c\).

Partial fractions

Another integration technique that is useful for integration fractions is known as Partial fractions. It is an example of a simplification method and is not examinable within this module. However, it may be useful for you to have seen it at least once.

The idea is to take an expression like \(1/(x^{2}-1)\) and express it as the some of two fractions

\begin{equation*} \frac {1}{x^{2}-1}=\frac {1}{(x-1)(x+1)}=\frac {A}{x+1}+\frac {B}{x-1}, \end{equation*}

for \(A\) and \(B\) constants that need to be determined. This is done by multiplying through by \((x+1)(x-1)\) to get

\begin{equation*} 1=A(x-1)+B(x+1), \end{equation*}

which rearranges to

\begin{equation*} (A+B)x-A+B-1=0. \end{equation*}

For this to be true we need to match up coefficients of powers of \(x\) on both sides of the equation so that

\begin{align*} A+B&=0,\\ B-A-1&=0, \end{align*} which is solved by

\begin{align*} A&=-\frac {1}{2},\\ B&=\frac {1}{2}. \end{align*} Which gives

\begin{equation*} \frac {1}{x^{2}-1}=-\frac {1}{2}\left [\frac {1}{x+1}-\frac {1}{x-1}\right ]. \end{equation*}

These are both expressions that we can integrate to get

\begin{align*} \int \frac {1}{x^{2}-1}\ud x &=-\frac {1}{2}\left [\int \frac {1}{x+1}\ud x-\int \frac {1}{x-1}\ud x\right ]\\ &=-\frac {1}{2}\ln \left (x+1\right )+\frac {1}{2}\ln \left (x-1\right )+c\\ &=\ln \left [\left (\frac {x-1}{x+1}\right )^{\frac {1}{2}}\right ]+c. \end{align*} Note that in terms of what we know at this stage, the right hand side is only valid for \(x>1\).

The general procedure is as follows:

  • Factorise the denominator in terms of its roots.

  • Write down a sum of the reciprocals of the roots with arbitrary coefficients. This steps becomes complicated if there are repeated roots.

  • Multiply through by the denominator on the left hand side and express it as a polynomial in \(x\).

  • Solve the system of equations for the coefficients \(A, B, \dots {}\).

  • Substitute the coefficients into the partial fractions expression and carry out the integral making use of integration by parts or substitutions as necessary.

As mentioned in the second step, if there are repeated roots this becomes trickier, since this is already a non examinable diversion we will not give the details here.

4.3 Definite integrals

In the previous section we focussed on antiderivatives and indefinite integrals, now we return to the original motivation for the integral, as the measure of the area under a curve. This is called a definite integral and returns a number rather than a function as it involves us carrying out a definite integral and then evaluating the result at the end points. This may sound confusing at first but we will learn how to do it by seeing some examples.

4.4 Applications of integrals

As with the derivative, there are plenty of applications of integrals. We will touch on some of them here, but as usual there is a wealth of further details in both [Dawkins, 2025a] and [Riley et al., 2006].

Averaging functions
Areas between curves