\documentclass[11pt,a4paper]{article}

\usepackage[margin=2.5cm,headheight=14pt]{geometry}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{tikz}
\usepackage{fancyhdr}
\usepackage{hyperref}  % keep hyperref last

% All of these share one counter, so the numbering runs 1.1, 1.2, 1.3 through
% a section whatever kind of block comes next.
\theoremstyle{definition}
\newtheorem{definition}{Definition}[section]
\newtheorem{example}[definition]{Example}
\theoremstyle{plain}
\newtheorem{theorem}[definition]{Theorem}
\newtheorem{lemma}[definition]{Lemma}
\theoremstyle{remark}
\newtheorem{remark}[definition]{Remark}

\pagestyle{fancy}
\fancyhf{}
\fancyhead[L]{Course 101}
\fancyhead[R]{Lecture Notes}
\fancyfoot[C]{\thepage}

% Course, lecturer and term.
\title{Course 101: Introduction to Real Analysis \\ Lecture Notes}
\author{Your Name \\ University of Somewhere}
\date{Fall Term}

\begin{document}
\maketitle
\thispagestyle{fancy}
\tableofcontents
\newpage

\section{Lecture 1: Sequences and Limits}

A sequence is an infinite list of real numbers $a_1, a_2, a_3, \dots$, written
$(a_n)$. The whole of this lecture is about one question: what it means for
such a list to settle down on a value.

\begin{definition}[Convergence]
  A sequence $(a_n)$ converges to $L \in \mathbb{R}$ if for every
  $\varepsilon > 0$ there is an $N \in \mathbb{N}$ such that
  \begin{equation} \label{eq:convergence}
    |a_n - L| < \varepsilon \quad \text{for all } n \ge N .
  \end{equation}
  We write $\lim_{n \to \infty} a_n = L$, or $a_n \to L$.
\end{definition}

Read \eqref{eq:convergence} as a game: your opponent names a tolerance
$\varepsilon$, and you have to name a point $N$ in the sequence beyond which
every term is within that tolerance of $L$. Figure~\ref{fig:neighborhood}
shows the picture on the number line.

\begin{figure}[htbp]
  \centering
  \begin{tikzpicture}
    \draw[->] (-0.5,0) -- (8.5,0) node[right] {$\mathbb{R}$};
    \foreach \x/\lbl in {2/{L - \varepsilon}, 4/{L}, 6/{L + \varepsilon}} {
      \draw (\x,0.15) -- (\x,-0.15) node[below] {$\lbl$};
    }
    \fill (4,0) circle (1.6pt);
    \draw[very thick] (2,0.5) -- (6,0.5);
    \node[above] at (4,0.55) {$a_n$ for every $n \ge N$};
  \end{tikzpicture}
  \caption{Beyond the index $N$, the whole tail of the sequence lies inside
    the band of width $2\varepsilon$ around $L$.}
  \label{fig:neighborhood}
\end{figure}

\begin{example}
  The sequence $a_n = 1/n$ converges to $0$. Given $\varepsilon > 0$, choose
  any $N$ larger than $1/\varepsilon$. Then for $n \ge N$ we have
  $|1/n - 0| = 1/n \le 1/N < \varepsilon$.
\end{example}

\begin{theorem}[Uniqueness of the limit]
  A sequence has at most one limit.
\end{theorem}

\begin{proof}
  Suppose $a_n \to L$ and $a_n \to M$ with $L \neq M$. Take
  $\varepsilon = |L - M| / 2$. Beyond some index every term is within
  $\varepsilon$ of $L$, and beyond some other index every term is within
  $\varepsilon$ of $M$. Past both indices a single term is within
  $\varepsilon$ of each, so $|L - M| < 2\varepsilon = |L - M|$, which is
  impossible.
\end{proof}

\begin{remark}
  The definition never mentions how fast the terms approach $L$. Convergence
  is about what happens in the end, so changing finitely many terms of a
  sequence changes neither whether it converges nor what it converges to.
\end{remark}

\section{Lecture 2: Continuity}

Continuity is the same idea moved from a sequence to a function: small changes
in the input are to make only small changes in the output.

\begin{definition}[Continuity at a point]
  A function $f : \mathbb{R} \to \mathbb{R}$ is continuous at $c$ if for every
  $\varepsilon > 0$ there is a $\delta > 0$ such that $|x - c| < \delta$
  implies $|f(x) - f(c)| < \varepsilon$.
\end{definition}

\begin{lemma}[Sequential criterion]
  $f$ is continuous at $c$ if and only if $f(a_n) \to f(c)$ for every sequence
  $(a_n)$ with $a_n \to c$.
\end{lemma}

This lemma is the reason Lecture 1 came first: it turns every question about
continuity into a question about sequences, so every result about limits of
sums and products carries straight over.

\begin{theorem}[Extreme value theorem]
  A continuous function on a closed bounded interval $[a, b]$ attains a
  largest and a smallest value on that interval.
\end{theorem}

\begin{example}
  The function $f(x) = 1/x$ attains no largest value on the open interval
  $(0, 1)$. The interval is bounded but not closed, so the theorem does not
  apply, which shows the hypothesis is doing real work.
\end{example}

\begin{remark}
  Next lecture: uniform continuity, and why $f(x) = x^2$ is continuous
  everywhere but not uniformly continuous on the whole real line.
\end{remark}

\end{document}
