\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}{\"dom}

## Adding up

Summation notation:
    Given numbers $a_i$ and integers $m<=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<=n$,
    \[ \sum_{i=m}^n f(i) = f(m) + f(m+1) + ... + f(n) .\]

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

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

    Also, if $m<=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(n) = \sum_{i=s}^t f(i) \]

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 .\]

    *\[a* 2T_n
	&= \sum_{i=0}^n i + \sum_{i=0}^n (n-i) \\
	&= \sum_{i=0}^n n \\
	&= (n+1)n .*a\]*
    So
	\[ T_n = \frac{n(n+1)}{2} .\]

    Note that we can then easily calculate e.g.
    *\[a* \sum_{i=37}^{1337} i
      &= \sum_{i=0}^{1337} i - \sum_{i=0}^{36} \\
      &= T_{1337} - T_{36}\\
      &= \frac{(1337)(1338) - (36)(37)}{2}\\
      &= 893787 .*a\]*

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

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

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

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

    So the formula works for all $n$.


## 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?

Area beneath a graph:
    Let $[a,b]$ be an interval and let $f(x)$ 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(x) = 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(a_i) =
      f(\frac{i}{n}) = (\frac{i}{n})^2$, so its area is
	\[ RectArea_i = (\frac{1}{n})(\frac{i}{n})^2 = \frac{i^2}{n^3} .\]

      So the sum of the areas is
      *\[a* 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(n+1)(2n+1)}{6n^3} .*a\]*

    e.g. with $n=10$: $A_{10} = 10*11*21/6000 = 0.385$.
    with $n=1000$: $A_{1000} = (1000*1001*2001)/(6*1000*1000*1000) = 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->\infty} A_n = \frac{1}{3}$.

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->\infty$ as we could above. Still, we expect the above approach to give
    a good estimate \(assuming $f$ is ``reasonable''\).

## Definite Integrals

Definition:
    A function $f$ is _integrable_ on an interval $[a,b]$ if the limit
    $\lim_{n->\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
    _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(x_i^*) \]
      where $\Delta_n = \frac{b-a}{n}$,
      and $x_i^*$ is a choice of a point in the interval
	\[ [a+(i-1)\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...

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

Notation:
    We write
	\[ \int_a^b f(x) 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(x) dx = \int_a^b f(t) dt \]

So
\[ \int_a^b f(x) dx = \lim_{n->\infty} (\frac{(b-a)}{n} \sum_{i=1}^n f(x_i^*)) \]
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(x) 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:

Interpretation/Definition:
    If $a<=b$, the _signed area_ \(or _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(x) 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.

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

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

    *\[a* \int_{-2}^2 (x^3-x) dx &=
	\lim_{n->\infty} \Delta_n \sum_{i=1}^n f(x_i^*) \\
	&= \lim_{n->\infty} \frac{4}{n} \sum_{i=1}^n f(-2 + \frac{4i}{n}) \\
	&= \lim_{n->\infty} \frac{4}{n} \sum_{i=1}^n
	  (-2+\frac{4i}{n})^3-(-2+\frac{4i}{n}) \\
	&= \lim_{n->\infty} \frac{4}{n} \sum_{i=1}^n
	    (-6 + \frac{(3)(4)(4i)-4i}{n} + \frac{(3)(-2)(4i)^2}{n^2} +
	    \frac{(4i)^3}{n^3} )\\
	&= \lim_{n->\infty} \frac{4}{n} \sum_{i=1}^n
	    (-6 + 44\frac{i}{n} - 96\frac{i^2}{n^2} +
	    64\frac{i^3}{n^3} )\\
	&= \lim_{n->\infty} 4
	  (-6 + 44\frac{n(n+1)}{2n^2} - 96\frac{n(n+1)(2n+1)}{6n^3} +
	    64\frac{(n(n+1))^2}{4n^4} )\\
	    &= 4(-6+\frac{44}{2} - 96\frac{1}{3} + 64\frac{1}{4}) \\
	    &= 4(-6+22 - 32 + 16) \\
	    &= 0
	*a\]*

    \(we used here the formula

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

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

Facts:
    **(i) $\int_a^b 1 dx = b-a$
    ** $\int_a^b c f(x) dx = c\int_a^b f(x) dx$
    ** $\int_a^b (f(x) + g(x)) dx = \int_a^b f(x) dx + \int_a^b g(x) dx$
    ** $\int_a^b f(x) dx + \int_b^c f(x) dx = \int_a^c f(x) dx$
    ** $\int_a^a f(x) dx = 0$
    *ee*

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

\end{document}
