\chapter{A bit of manifolds}
\label{ch:manifolds_diffgeo}
Last chapter, we stated Stokes' theorem for cells.
It turns out there is a much larger class of spaces,
the so-called \emph{smooth manifolds}, for which this makes sense.

Unfortunately, the definition of a smooth manifold is \emph{complete garbage},
and so by the time I am done defining differential forms and orientations,
I will be too lazy to actually define what the integral on it is,
and just wave my hands and state Stokes' theorem.

\section{Topological manifolds}
\prototype{$S^2$: ``the Earth looks flat''.}

Long ago, people thought the Earth was flat,
i.e.\ homeomorphic to a plane, and in particular they thought that
$\pi_2(\text{Earth}) = 0$.
But in fact, as most of us know, the Earth is actually a sphere,
which is not contractible and in particular $\pi_2(\text{Earth}) \cong \ZZ$.
This observation underlies the definition of a manifold:
\begin{moral}
	An $n$-manifold is a space which locally looks like $\RR^n$.
\end{moral}
Actually there are two ways to think about a topological manifold $M$:
\begin{itemize}
	\ii ``Locally'': at every point $p \in M$,
	some open neighborhood of $p$ looks like an open set of $\RR^n$.
	For example, to someone standing on the surface of the Earth,
	the Earth looks much like $\RR^2$.

	\ii ``Globally'': there exists an open cover of $M$
	by open sets $\{U_i\}_i$ (possibly infinite) such that each $U_i$
	is homeomorphic to some open subset of $\RR^n$.
	For example, from outer space, the Earth can be covered
	by two hemispherical pancakes.
\end{itemize}
\begin{ques}
	Check that these are equivalent.
\end{ques}
While the first one is the best motivation for examples,
the second one is easier to use formally.

\begin{definition}
	\label{def:topological_manif}
	A \vocab{topological $n$-manifold} $M$ is a Hausdorff space
	with an open cover $\{U_i\}$ of sets
	homeomorphic to subsets of $\RR^n$,
	say by homeomorphisms
	\[ \phi_i \colon U_i \taking\cong E_i \subseteq \RR^n \]
	where each $E_i$ is an open subset of $\RR^n$.
	Each $\phi_i \colon U_i \to E_i$ is called a \vocab{chart},
	and together they form a so-called \vocab{atlas}.
\end{definition}
\begin{remark}
	Here ``$E$'' stands for ``Euclidean''.
	I think this notation is not standard; usually
	people just write $\phi_i(U_i)$ instead.
\end{remark}
\begin{remark}
	This definition is nice because it doesn't depend on embeddings:
	a manifold is an \emph{intrinsic} space $M$,
	rather than a subset of $\RR^N$ for some $N$.
	Analogy: an abstract group $G$ is an intrinsic object
	rather than a subgroup of $S_n$.
\end{remark}

\begin{example}[An atlas on $S^1$]
Here is a picture of an atlas for $S^1$, with two open sets.
\begin{center}
	\begin{asy}
		size(8cm);
		draw(unitcircle, black+2);
		label("$S^1$", dir(45), dir(45));
		real R = 0.1;
		draw(arc(origin,1-R,-100,100), red);
		label("$U_2$", (1-R)*dir(0), dir(180), red);
		draw(arc(origin,1+R,80,280), blue);
		label("$U_1$", (1+R)*dir(180), dir(180), blue);
		dotfactor *= 2;
		pair A = opendot( (-3, -2), blue );
		pair B = opendot( (-1, -2), blue );
		label("$E_1$", midpoint(A--B), dir(-90), blue);
		draw(A--B, blue, Margins);
		draw( (-1.25, -0.2)--(-2,-2), blue, EndArrow, Margins );
		label("$\phi_1$", (-1.675, -1.1), dir(180), blue);

		pair C = opendot( (1, -2), red );
		pair D = opendot( (3, -2), red );
		label("$E_2$", midpoint(C--D), dir(-90), red);
		draw(C--D, red, Margins);
		draw( (1.25, -0.2)--(2,-2), red, EndArrow, Margins );
		label("$\phi_2$", (1.672, -1.1), dir(0), red);
	\end{asy}
\end{center}
\end{example}

\begin{ques}
	Where do you think the words ``chart'' and ``atlas'' come from?
\end{ques}

\begin{example}
	[Some examples of topological manifolds]
	\listhack
	\begin{enumerate}[(a)]
		\ii As discussed at length,
		the sphere $S^2$ is a $2$-manifold: every point in the sphere has a
		small open neighborhood that looks like $D^2$.
		One can cover the Earth with just two hemispheres,
		and each hemisphere is homeomorphic to a disk.

		\ii The circle $S^1$ is a $1$-manifold; every point has an
		open neighborhood that looks like an open interval.

		\ii The torus, Klein bottle, $\RP^2$ are all $2$-manifolds.

		\ii $\RR^n$ is trivially a manifold, as are its open sets.
	\end{enumerate}
	All these spaces are compact except $\RR^n$.

	A non-example of a manifold is $D^n$, because it has a \emph{boundary};
	points on the boundary do not have open neighborhoods
	that look Euclidean.
\end{example}

\section{Smooth manifolds}
\prototype{All the topological manifolds.}

Let $M$ be a topological $n$-manifold with atlas
$\{U_i \taking{\phi_i} E_i\}$.
\begin{definition}
	For any $i$, $j$ such that $U_i \cap U_j \neq \varnothing$,
	the \vocab{transition map} $\phi_{ij}$ is the composed map
	\[
		\phi_{ij} \colon E_i \cap \phi_i\im(U_i \cap U_j)
		\taking{\phi_i\inv}
		U_i \cap U_j
		\taking{\phi_j} E_j \cap \phi_j\im(U_i \cap U_j).
	\]
\end{definition}
Sorry for the dense notation, let me explain.
The intersection with the image $\phi_i\im(U_i \cap U_j)$
and the image $\phi_j\im(U_i \cap U_j)$ is a notational annoyance
to make the map well-defined and a homeomorphism.
The transition map is just the natural way to go from $E_i \to E_j$,
restricted to overlaps.
Picture below, where the intersections are just the green portions
of each $E_1$ and $E_2$:

\begin{center}
	\begin{asy}
		size(8cm);
		draw(unitcircle, black);
		draw(arc(origin, 1, 80, 100), heavygreen+2);
		draw(arc(origin, 1, -100, -80), heavygreen+2);
		label("$S^1$", dir(45), dir(45));
		real R = 0.1;
		draw(arc(origin,1-R,-100,100), red);
		label("$U_2$", (1-R)*dir(0), dir(180), red);
		draw(arc(origin,1+R,80,280), blue);
		label("$U_1$", (1+R)*dir(180), dir(180), blue);
		dotfactor *= 2;
		pair A = opendot( (-3, -2), blue );
		pair B = opendot( (-1, -2), blue );
		label("$E_1$", midpoint(A--B), dir(-90), blue);
		draw(A--B, blue, Margins);
		draw( (-1.25, -0.2)--(-2,-2), blue, EndArrow, Margins );
		label("$\phi_1$", (-1.675, -1.1), dir(180), blue);

		pair C = opendot( (1, -2), red );
		pair D = opendot( (3, -2), red );
		label("$E_2$", midpoint(C--D), dir(-90), red);
		draw(C--D, red, Margins);
		draw( (1.25, -0.2)--(2,-2), red, EndArrow, Margins );
		label("$\phi_2$", (1.672, -1.1), dir(0), red);

		draw(A--(0.7*A+0.3*B), heavygreen+2, Margins);
		draw(B--(0.7*B+0.3*A), heavygreen+2, Margins);
		draw(C--(0.7*C+0.3*D), heavygreen+2, Margins);
		draw(D--(0.7*D+0.3*C), heavygreen+2, Margins);
		draw(B--C, heavygreen, EndArrow, Margin(4,4));
		label("$\phi_{12}$", B--C, dir(90), heavygreen);
	\end{asy}
\end{center}


We want to add enough structure so that we can use differential forms.

\begin{definition}
	\label{def:smooth_manif}
	We say $M$ is a \vocab{smooth manifold}
	if all its transition maps are smooth.
\end{definition}

This definition makes sense, because we know what it means
for a map between two open sets of $\RR^n$ to be differentiable.

With smooth manifolds we can try to port over definitions that
we built for $\RR^n$ onto our manifolds.
So in general, all definitions involving smooth manifolds will reduce to
something on each of the coordinate charts, with a compatibility condition.

As an example, here is the definition of a ``smooth map'':
\begin{definition}
	\begin{enumerate}[(a)]
		\ii Let $M$ be a smooth manifold.
		A continuous function $f \colon M \to \RR$ is called \vocab{smooth}
		if the composition
		\[ E_i \taking{\phi_i\inv} U_i \injto M \taking f \RR \]
		is smooth as a function $E_i \to \RR$.
		\ii Let $M$ and $N$ be smooth
		with atlases $\{ U_i^M \taking{\phi_i} E_i^M \}_i$
		and $\{ U_j^N \taking{\phi_j} E_j^N \}_j$.
		A map $f \colon M \to N$ is \vocab{smooth} if for every $i$ and $j$,
		the composed map
		\[ E_i \taking{\phi_i\inv} U_i \injto M
			\taking f N \surjto U_j \taking{\phi_j} E_j \]
		is smooth, as a function $E_i \to E_j$.
	\end{enumerate}
\end{definition}

\section{Regular value theorem}
\prototype{$x^2+y^2=1$ is a circle!}
Despite all that I've written about general manifolds,
it would be sort of mean if I left you here
because I have not really told you how to actually construct
manifolds in practice, even though we know the circle
$x^2+y^2=1$ is a great example of a one-dimensional
manifold embedded in $\RR^2$.

\begin{theorem}
	[Regular value theorem]
	Let $V$ be an $n$-dimensional real normed vector
	space, let $U \subseteq V$ be open
	and let $f_1, \dots, f_m \colon U \to \RR$
	be smooth functions.
	Let $M$ be the set of points $p \in U$
	such that $f_1(p) = \dots = f_m(p) = 0$.

	Assume $M$ is nonempty and that the map
	\[ V \to \RR^m \quad\text{by}\quad
		v \mapsto \left( (Df_1)_p(v), \dots, (Df_m)_p(v) \right) \]
	has rank $m$, for every point $p \in M$.
	Then $M$ is a manifold of dimension $n-m$.
\end{theorem}
For a proof, see \cite[Theorem 6.3]{ref:manifolds}.

One very common special case is to take $m = 1$ above.
\begin{corollary}
	[Level hypersurfaces]
	Let $V$ be a finite-dimensional real normed vector
	space, let $U \subseteq V$ be open
	and let $f \colon U \to \RR$ be smooth.
	Let $M$ be the set of points $p \in U$
	such that $f(p) = 0$.
	If $M \neq \varnothing$ and $(Df)_p$ is not the zero map for any $p \in M$,
	then $M$ is a manifold of dimension $\dim V-1$.
\end{corollary}

\begin{example}
	[The circle $x^2+y^2-c=0$]
	Let $f(x,y) = x^2+y^2 - c$, $f \colon \RR^2 \to \RR$,
	where $c$ is a positive real number.
	Note that
	\[ Df = 2x \cdot dx + 2y \cdot dy \]
	which in particular is nonzero
	as long as $(x,y) \neq (0,0)$, i.e.\ as long as $c \neq 0$.
	Thus:
	\begin{itemize}
		\ii When $c > 0$, the resulting curve ---
		a circle with radius $\sqrt c$ ---
		is a one-dimensional manifold, as we knew.
		\ii When $c = 0$, the result fails.
		Indeed, $M$ is a single point,
		which is actually a zero-dimensional manifold!
	\end{itemize}
\end{example}

We won't give further examples
since I'm only mentioning this in passing
in order to increase your capacity to write real concrete examples.
(But \cite[Chapter 6.2]{ref:manifolds} has some more examples,
beautifully illustrated.)

\section{Differential forms on manifolds}
We already know what a differential form is on an open set $U \subseteq \RR^n$.
So, we naturally try to port over the definition of
differentiable form on each subset, plus a compatibility condition.

Let $M$ be a smooth manifold with atlas $\{ U_i \taking{\phi_i} E_i \}_i$.

\begin{definition}
	A \vocab{differential $k$-form} $\alpha$ on a smooth manifold $M$
	is a collection $\{\alpha_i\}_i$ of differential $k$-forms on each $E_i$,
	such that for any $j$ and $i$ we have that
	\[ \alpha_j = \phi_{ij}^\ast(\alpha_i). \]
\end{definition}
In English: we specify a differential form on each chart,
which is compatible under pullbacks of the transition maps.

\section{Orientations}
\prototype{Left versus right, clockwise vs.\ counterclockwise.}

This still isn't enough to integrate on manifolds.
We need one more definition: that of an orientation.

The main issue is the observation from standard calculus that
\[ \int_a^b f(x) \; dx = - \int_b^a f(x) \; dx. \]
Consider then a space $M$ which is homeomorphic to an interval.
If we have a $1$-form $\alpha$, how do we integrate it over $M$?
Since $M$ is just a topological space (rather than a subset of $\RR$),
there is no default ``left'' or ``right'' that we can pick.
As another example, if $M = S^1$ is a circle, there is
no default ``clockwise'' or ``counterclockwise'' unless we decide
to embed $M$ into $\RR^2$.

To work around this we actually have to
make additional assumptions about our manifold.
\begin{definition}
	A smooth $n$-manifold is \vocab{orientable} if
	there exists a differential $n$-form $\omega$ on $M$
	such that for every $p \in M$,
	\[ \omega_p \neq 0. \]
\end{definition}
Recall here that $\omega_p$ is an element of $\bigwedge^n(V^\vee)$.
In that case we say $\omega$ is a \vocab{volume form} of $M$.

How do we picture this definition?
If we recall that a differential form is supposed to take
tangent vectors of $M$ and return real numbers.
To this end, we can think of each point $p \in M$ as
having a \vocab{tangent plane} $T_p(M)$ which is $n$-dimensional.
Now since the volume form $\omega$ is $n$-dimensional,
it takes an entire basis of the $T_p(M)$ and gives a real number.
So a manifold is orientable if there exists a consistent choice of
sign for the basis of tangent vectors at every point of the manifold.

For ``embedded manifolds'', this just amounts to being able
to pick a nonzero field of normal vectors to each point $p \in M$.
For example, $S^1$ is orientable in this way.
\begin{center}
	\begin{asy}
		size(5cm);
		draw(unitcircle, blue+1);
		label("$S^1$", dir(100), dir(100), blue);
		void arrow(real theta) {
			pair P = dir(theta);
			dot(P);
			pair delta = 0.5*P;
			draw( P--(P+delta), EndArrow );
		}
		arrow(0);
		arrow(50);
		arrow(140);
		arrow(210);
		arrow(300);
	\end{asy}
\end{center}
Similarly, one can orient a sphere $S^2$ by having
a field of vectors pointing away (or towards) the center.
This is all non-rigorous,
because I haven't defined the tangent plane $T_p(M)$;
since $M$ is in general an intrinsic object one has to be
quite roundabout to define $T_p(M)$ (although I do so in an optional section later).
In any event, the point is that guesses about the orientability
of spaces are likely to be correct.

\begin{example}
	[Orientable surfaces]
	\listhack
	\begin{enumerate}[(a)]
		\ii Spheres $S^n$, planes, and the torus $S^1 \times S^1$ are orientable.
		\ii The M\"obius strip and Klein bottle are \emph{not} orientable:
		they are ``one-sided''.
		\ii $\CP^n$ is orientable for any $n$.
		\ii $\RP^n$ is orientable only for odd $n$.
	\end{enumerate}
\end{example}


\section{Stokes' theorem for manifolds}
Stokes' theorem in the general case is based on the idea
of a \vocab{manifold with boundary} $M$, which I won't define,
other than to say its boundary $\partial M$ is an $n-1$ dimensional manifold,
and that it is oriented if $M$ is oriented.
An example is $M = D^2$, which has boundary $\partial M = S^1$.

Next,
\begin{definition}
	The \vocab{support} of a differential form $\alpha$ on $M$
	is the closure of the set
	\[ \left\{ p \in M \mid \alpha_p \neq 0 \right\}. \]
	If this support is compact as a topological space,
	we say $\alpha$ is \vocab{compactly supported}.
\end{definition}
\begin{remark}
	For example, volume forms are supported on all of $M$.
\end{remark}

Now, one can define integration on oriented manifolds,
but I won't define this because the definition is truly awful.
Then Stokes' theorem says
\begin{theorem}
	[Stokes' theorem for manifolds]
	Let $M$ be a smooth oriented $n$-manifold with boundary
	and let $\alpha$ be a compactly supported $(n-1)$-form.
	Then
	\[ \int_M d\alpha = \int_{\partial M} \alpha. \]
\end{theorem}
All the omitted details are developed in full in \cite{ref:manifolds}.

\section{(Optional) The tangent and cotangent space}
\prototype{Draw a line tangent to a circle, or a plane tangent to a sphere.}

Let $M$ be a smooth manifold and $p \in M$ a point.
I omitted the definition of $T_p(M)$ earlier,
but want to actually define it now.

As I said, geometrically we know what this \emph{should}
look like for our usual examples.
For example, if $M = S^1$ is a circle embedded in $\RR^2$,
then the tangent vector at a point $p$
should just look like a vector running off tangent to the circle.
Similarly, given a sphere $M = S^2$,
the tangent space at a point $p$ along the sphere
would look like a plane tangent to $M$ at $p$.

\begin{center}
	\begin{asy}
		size(5cm);
		draw(unitcircle);
		label("$S^1$", dir(140), dir(140));
		pair p = dir(0);
		draw( (1,-1.4)--(1,1.4), mediumblue, Arrows);
		label("$T_p(M)$", (1, 1.4), dir(-45), mediumblue);
		draw(p--(1,0.7), red, EndArrow);
		label("$\vec v \in T_p(M)$", (1,0.7), dir(-15), red);
		dot("$p$", p, p, blue);
	\end{asy}
\end{center}

However, one of the points of all this manifold stuff
is that we really want to see the manifold
as an \emph{intrinsic object}, in its own right,
rather than as embedded in $\RR^n$.\footnote{This
	can be thought of as analogous to the way
	that we think of a group as an abstract object in its own right,
	even though Cayley's Theorem tells us that any group is a subgroup
	of the permutation group.

	Note this wasn't always the case!
	During the 19th century, a group was literally defined
	as a subset of $\text{GL}(n)$ or of $S_n$.
	In fact Sylow developed his theorems without the word ``group''.
	Only much later was the abstract definition of a group given,
	an abstract set $G$ which was independent of any \emph{embedding} into $S_n$,
	and an object in its own right.}
So, we would like our notion of a tangent vector to not refer to an ambient space,
but only to intrinsic properties of the manifold $M$ in question.

\subsection{Tangent space}
To motivate this construction, let us start
with an embedded case for which we know the answer already:
a sphere.

Suppose $f \colon S^2 \to \RR$ is a
function on a sphere, and take a point $p$.
Near the point $p$, $f$ looks like a function
on some open neighborhood of the origin.
Thus we can think of taking a \emph{directional derivative}
along a vector $\vec v$ in the imagined tangent plane
(i.e.\ some partial derivative).
For a fixed $\vec v$ this partial derivative is a linear map
\[ D_{\vec v} \colon C^\infty(M) \to \RR. \]

It turns out this goes the other way:
if you know what $D_{\vec v}$ does to every smooth function,
then you can recover $v$.
This is the trick we use in order to create the tangent space.
Rather than trying to specify a vector $\vec v$ directly
(which we can't do because we don't have an ambient space),
\begin{moral}
	The vectors \emph{are} partial-derivative-like maps.
\end{moral}
More formally, we have the following.
\begin{definition}
	A \vocab{derivation} $D$ at $p$ is a linear map
	$D \colon C^\infty(M) \to \RR$
	(i.e.\ assigning a real number to every smooth $f$)
	satisfying the following Leibniz rule:
	for any $f$, $g$ we have the equality
	\[ D(fg) = f(p) \cdot D(g) + g(p) \cdot D(f) \in \RR. \]
\end{definition}
This is just a ``product rule''.
Then the tangent space is easy to define:
\begin{definition}
	A \vocab{tangent vector} is just a derivation at $p$, and
	the \vocab{tangent space} $T_p(M)$ is simply
	the set of all these tangent vectors.
\end{definition}
In this way we have constructed the tangent space.

\subsection{The cotangent space}
In fact, one can show that the product rule
for $D$ is equivalent to the following three conditions:
\begin{enumerate}
	\ii $D$ is linear, meaning $D(af+bg) = a D(f) + b D(g)$.
	\ii $D(1_M) = 0$, where $1_M$ is the constant function on $M$.
	\ii $D(fg) = 0$ whenever $f(p) = g(p) = 0$.
	Intuitively, this means that if a function $h = fg$
	vanishes to second order at $p$,
	then its derivative along $D$ should be zero.
\end{enumerate}

This suggests a third equivalent definition:
suppose we define
\[ \km_p \defeq \left\{ f \in C^\infty M \mid f(p) = 0 \right\} \]
to be the set of functions which vanish at $p$
(this is called the \emph{maximal ideal} at $p$).
In that case,
\[ \km_p^2 = \left\{ \sum_i f_i \cdot g_i
	\mid f_i(p) = g_i(p) = 0 \right\} \]
is the set of functions vanishing to second order at $p$.
Thus, a tangent vector is really just a linear map
\[ \km_p / \km_p^2 \to \RR. \]
In other words, the tangent space is actually the
dual space of $\km_p / \km_p^2$;
for this reason, the space $\km_p / \km_p^2$ is defined as the
\vocab{cotangent space} (the dual of the tangent space).
This definition is even more abstract than the one with derivations above,
but has some nice properties:
\begin{itemize}
	\ii it is coordinate-free, and
	\ii it's defined only in terms of the smooth functions $M \to \RR$,
	which will be really helpful later on in algebraic geometry
	when we have varieties or schemes and can repeat this definition.
\end{itemize}

\subsection{Sanity check}
With all these equivalent definitions, the last thing I should do is check that
this definition of tangent space actually gives a vector space of dimension $n$.
To do this it suffices to verify this for open subsets of $\RR^n$,
which will imply the result for general manifolds $M$
(which are locally open subsets of $\RR^n$).
Using some real analysis, one can prove the following result:
\begin{theorem}
	Suppose $M \subset \RR^n$ is open and $0 \in M$.
	Then
	\[
	\begin{aligned}
		\km_0 &= \{ \text{smooth functions } f \mid f(0) = 0 \} \\
		\km_0^2 &= \{ \text{smooth functions } f \mid f(0) = 0, (\nabla f)_0 = 0 \}.
	\end{aligned}
	\]
	In other words $\km_0^2$ is the set of functions which vanish at $0$
	and such that all first derivatives of $f$ vanish at zero.
\end{theorem}
Thus, it follows that there is an isomorphism
\[ \km_0 / \km_0^2 \cong \RR^n
	\quad\text{by}\quad
	f \mapsto
	\left[ \frac{\partial f}{\partial x_1}(0),
		\dots, \frac{\partial f}{\partial x_n}(0) \right] \]
and so the cotangent space, hence tangent space,
indeed has dimension $n$.

%\subsection{So what does this have to do with orientations?}
%\todo{beats me}

\section\problemhead
\begin{problem}
	Show that a differential $0$-form on a smooth manifold $M$
	is the same thing as a smooth function $M \to \RR$.
\end{problem}
\todo{some applications of regular value theorem here}
