\documentclass[letter,12pt]{article}
\usepackage[margin=0.5in]{geometry}
\pagestyle{headings}
\usepackage{amssymb,amsmath,hyperref,enumerate}
\usepackage{graphicx}
\begin{document}
\providecommand{\R}{\mathbb{R}}
\providecommand{\at}{\restriction}
\providecommand{\ddx}{\frac{d}{dx}}
\renewcommand{\o}{\circ}
\providecommand{\rcp}[1]{\frac{1}{#1}}
\providecommand{\dom}{\operatorname{dom}}

\section*{Adding up}

\paragraph{Summation notation:}
    Given numbers $a_i$ and integers $m\leq n$,
    \[ \sum_{i=m}^n a_i = a_m + a_{m+1} + ... + a_n .\]

    So e.g. if we have 50 boxes containing balls, and the $i^{th}$ box
    contains $B_i$ balls, then the total number of balls in the boxes is
    \[ \sum_{i=1}^{50} B_i .\]

    Similarly, given a function $f$ and integers $m\leq n$,
    \[ \sum_{i=m}^n f\left(i\right) = f\left(m\right) + f\left(m+1\right) + ... + f\left(n\right) .\]

    So e.g. we can abbreviate the sum
	\[ 1 + 2 + ... + n \]
    as
	\[ \sum_{i=1}^n i .\]

\paragraph{Remarks:}
    By basic algebra,
    \[ \sum_{i=m}^n ca_i = c \sum_{i=m}^n a_i \]
    \[ \sum_{i=m}^n \left(a_i+b_i\right) = \left(\sum_{i=m}^n a_i\right) + \left(\sum_{i=m}^n b_i\right) .\]

    Also, if $m\leq n<s$, then
    \[ \sum_{i=m}^n a_i + \sum_{i=n+1}^s a_i  = \sum_{i=m}^s .\]

    We don't have to use $i$ as the index; e.g.
      \[ \sum_{n=s}^t f\left(n\right) = \sum_{i=s}^t f\left(i\right) \]

\paragraph{Examples:}
  \[ \sum_{i=n}^n a_i = a_n \]

  \[ \sum_{i=1}^n 1 = n \]
  \[ \sum_{i=0}^n 1 = n+1 \]
  \[ \sum_{i=n}^n 1 = 1 \]
  \[ \sum_{i=m}^n 1 = n+1-m \]

  The $n^{th}$ /triangular number/ is
    \[ T_n := \sum_{i=0}^n i .\]

    \begin{align*} 2T_n
	&= \sum_{i=0}^n i + \sum_{i=0}^n \left(n-i\right) \\
	&= \sum_{i=0}^n n \\
	&= \left(n+1\right)n .\end{align*}
    So
	\[ T_n = \frac{n\left(n+1\right)}{2} .\]

    Note that we can then easily calculate e.g.
    \begin{align*} \sum_{i=37}^{1337} i
      &= \sum_{i=0}^{1337} i - \sum_{i=0}^{36} \\
      &= T_{1337} - T_{36}\\
      &= \frac{\left(1337\right)\left(1338\right) - \left(36\right)\left(37\right)}{2}\\
      &= 893787 .\end{align*}

\paragraph{Sum of consequetive squares:}
    \[ S_n := \sum_{i=0}^n i^2 \]

    \[ S_n = \frac{n\left(n+1\right)\left(2n+1\right)}{6} \]

    We can test this formula: clearly it works for $n=0$, and if it works for
    $n=k-1$ then
    \begin{align*} S_k
	&= S_{k-1} + k^2 \\
	&= \frac{\left(k-1\right)\left(k\right)\left(2k-1\right)}{6} + k^2\\
	&= \frac{k\left(\left(k-1\right)\left(2k-1\right)+6k\right)}{6}\\
	&= \frac{k\left(\left(k-1\right)\left(2k-1\right)+6k\right)}{6}\\
	&= \frac{k\left(k+1\right)\left(2k+1\right)}{6} .\end{align*}

    (since $\left(\left(k-1\right)+2\right)\left(\left(2k-1\right)+2\right) = \left(k-1\right)\left(2k-1\right) + \left(4k -2\right) + \left(2k -2\right) + 4 =
      \left(k-1\right)\left(2k-1\right)+6k$)

    So the formula works for all $n$.


\section*{Estimating areas}

Areas of shapes defined by straight lines (rectangles, triangles, polygons
etc) are easy to calculate. But what about when the boundary is a curve?

e.g. What is the area of an ellipse? What is the area below a catenary?

\paragraph{Area beneath a graph:}
    Let $[a,b]$ be an interval and let $f\left(x\right)$ be a function continuous and
    non-negative on the interval. We will try to estimate the area bounded by
    the graph of $f$, the x-axis, and the vertical lines $x=a$ and $x=b$.

    e.g. $f\left(x\right) = x^2$, $[a,b]=[0,1]$.

    \includegraphics[width=\textwidth]{graphs/quad.pdf}

    Idea: estimate area below the graph as the sum of the areas of rectangles,
      with height given by evaluating the function. When width of the
      rectangles is small, this should be a good estimate.

    e.g. split $[0,1]$ into $n$ equally sized intervals, so the endpoints are
      $a_i = i/n$ for $i=0,1,...,n$, and consider $n$ rectangles with bases
      these intervals, and with height the value of the function at, say, the
      right end-point of the corresponding interval.

      So the $i^{th}$ rectangle has width $1/n$ and height $f\left(a_i\right) =
      f\left(\frac{i}{n}\right) = \left(\frac{i}{n}\right)^2$, so its area is
	\[ RectArea_i = \left(\frac{1}{n}\right)\left(\frac{i}{n}\right)^2 = \frac{i^2}{n^3} .\]

      So the sum of the areas is
      \begin{align*} A_n &= \sum_{i=1}^n RectArea_i \\
	&= \sum_{i=1}^n \frac{i^2}{n^3}
	&= \frac{1}{n^3}\sum_{i=1}^n i^2
	&= \frac{n\left(n+1\right)\left(2n+1\right)}{6n^3} .\end{align*}

    e.g. with $n=10$: $A_{10} = 10*11*21/6000 = 0.385$.
    with $n=1000$: $A_{1000} = \left(1000*1001*2001\right)/\left(6*1000*1000*1000\right) = 0.3338335$

    Now: since the estimate gets more and more accurate for larger $n$, we can
    expect that the area *is* the limit $\lim_{n\rightarrow \infty} A_n = \frac{1}{3}$.

\paragraph{Remarks:}
    It wasn't important to our reasoning that we took the value of $f$ at the
    right end-point of each interval to define the height of the corresponding
    rectangle. Taking the value of $f$ at *any* point of the interval should
    work just as well.

    Sometimes, we won't be able to find a nice formula for the limit as
    $n\rightarrow \infty$ as we could above. Still, we expect the above approach to give
    a good estimate (assuming $f$ is ``reasonable'').

\section*{Definite Integrals}

\paragraph{Definition:}
    A function $f$ is \underline{integrable} on an interval $[a,b]$ if the limit
    $\lim_{n\rightarrow \infty} S_n$ of Riemann sums exists and is the same for any
    choice of Riemann sums, and in this case that limit is the
    \underline{definite integral} of $f$ from $a$ to $b$.

    Here, a Riemann sum $S_n$ is the sum
	\[ S_n = \sum_{i=1}^n \Delta_n f\left(x_i^*\right) \]
      where $\Delta_n = \frac{b-a}{n}$,
      and $x_i^*$ is a choice of a point in the interval
	\[ [a+\left(i-1\right)\Delta_n,a+i\Delta_n] .\]

So the definite integral is the limit of Riemann sums; but if $f$ is
ill-behaved, this limit might depend on exactly how we calculate the Riemann
sums (what points we calculate $f$ at), so then we don't get a well-defined
integral and we say that $f$ is not integrable on $[a,b]$. Luckily...

\paragraph{Theorem:}
    If $f$ is continuous on $[a,b]$, then $f$ is integrable on $[a,b]$.

\paragraph{Notation:}
    We write
	\[ \int_a^b f\left(x\right) dx \]
    for the definite integral from $a$ to $b$ of $f$.

    ``$dx$'' here should be read as notation indicating the variable we are
    integrating with respect to, much like the $\frac{d}{dx}$ of
    differentiation. So e.g.
	\[ \int_a^b f\left(x\right) dx = \int_a^b f\left(t\right) dt \]

So
\[ \int_a^b f\left(x\right) dx = \lim_{n\rightarrow \infty} \left(\frac{\left(b-a\right)}{n} \sum_{i=1}^n f\left(x_i^*\right)\right) \]
where for each $n$, each $x_i^*$ is a choice of point in the $n^{th}$
interval, and the limit exists and doesn't depend on these choices (which is
true if $f$ is continuous on $[a,b]$).

So e.g. we saw above that
    \[ \int_0^1 x^2 dx = \frac{1}{3} \]

If $f$ is non-negative on $[a,b]$, then $\int_a^b f\left(x\right) dx$ is precisely the
limit of the estimates to the area beneath the graph we discussed above. We
*define* that area to be the integral. More generally:

\paragraph{Interpretation/Definition:}
    If $a\leq b$, the \underline{signed area} (or \underline{net area}) between the graph of $f$, the
    $x$-axis, and the vertical lines $y=a$ and $y=b$ is defined to be
    $\int_a^b f\left(x\right) dx$.

So the signed area is the sum of the areas below the positive parts of the
graph minus the sum of the areas above the negative parts.

\paragraph{Example:}
    \[ \int_{-2}^2 \left(x^3-x\right) dx \]

    We can use right-hand endpoints, i.e. choosing sample point $x_i^*$ to be
    $-2 + i\Delta_n$

    \begin{align*} \int_{-2}^2 \left(x^3-x\right) dx &=
	\lim_{n\rightarrow \infty} \Delta_n \sum_{i=1}^n f\left(x_i^*\right) \\
	&= \lim_{n\rightarrow \infty} \frac{4}{n} \sum_{i=1}^n f\left(-2 + \frac{4i}{n}\right) \\
	&= \lim_{n\rightarrow \infty} \frac{4}{n} \sum_{i=1}^n
	  \left(-2+\frac{4i}{n}\right)^3-\left(-2+\frac{4i}{n}\right) \\
	&= \lim_{n\rightarrow \infty} \frac{4}{n} \sum_{i=1}^n
	    \left(-6 + \frac{\left(3\right)\left(4\right)\left(4i\right)-4i}{n} + \frac{\left(3\right)\left(-2\right)\left(4i\right)^2}{n^2} +
	    \frac{\left(4i\right)^3}{n^3} \right)\\
	&= \lim_{n\rightarrow \infty} \frac{4}{n} \sum_{i=1}^n
	    \left(-6 + 44\frac{i}{n} - 96\frac{i^2}{n^2} +
	    64\frac{i^3}{n^3} \right)\\
	&= \lim_{n\rightarrow \infty} 4
	  \left(-6 + 44\frac{n\left(n+1\right)}{2n^2} - 96\frac{n\left(n+1\right)\left(2n+1\right)}{6n^3} +
	    64\frac{\left(n\left(n+1\right)\right)^2}{4n^4} \right)\\
	    &= 4\left(-6+\frac{44}{2} - 96\frac{1}{3} + 64\frac{1}{4}\right) \\
	    &= 4\left(-6+22 - 32 + 16\right) \\
	    &= 0
	\end{align*}

    (we used here the formula

    \[ \sum_{i=1}^n i^3 = \left(\sum_{i=1}^n i\right)^2 = \left(\frac{n\left(n+1\right)}{2}\right)^2 \]

    see Appendix E problem 40 for a rather nice proof.)

\paragraph{Facts:}
\begin{enumerate}[(i)]\item $\int_a^b 1 dx = b-a$
\item $\int_a^b c f\left(x\right) dx = c\int_a^b f\left(x\right) dx$
\item $\int_a^b \left(f\left(x\right) + g\left(x\right)\right) dx = \int_a^b f\left(x\right) dx + \int_a^b g\left(x\right) dx$
\item $\int_a^b f\left(x\right) dx + \int_b^c f\left(x\right) dx = \int_a^c f\left(x\right) dx$
\item $\int_a^a f\left(x\right) dx = 0$
\end{enumerate}

\paragraph{Remark:}
    It follows from (iv) and (v) that
	$\int_b^a f\left(x\right) dx = - \int_a^b f\left(x\right) dx$
    so in terms of the signed area interpretation, taking the endpoints the
    ``wrong way round'' introduces a minus sign.

\end{document}
