\section{Lines and Planes}\label{sec:3Dlinesplanes}

Lines and planes are perhaps the simplest of curves and surfaces in
three dimensional space. They also will prove important as we seek to
understand more complicated curves and surfaces.

You may recall that the equation of a line in two dimensions is $ax+by=c$; it is
reasonable to expect that a line in three dimensions is
given by $ax + by +cz = d$. However it turns out that
this is the equation of a plane. We will turn our attention to a study of planes and return to consider lines later in this section.

A plane does not have an obvious ``direction'' as does a line. It is
possible to associate a plane with a direction in a very useful way,
however: there are exactly two directions perpendicular to a
plane. Any vector with one of these two directions is called \dfont{normal}\index{normal vector}\index{plane!normal vector} to the plane.
While there are many normal vectors to a given plane, they are all
parallel or anti-parallel to each other.

Suppose two points $(v_1,v_2,v_3)$ and $(w_1,w_2,w_3)$ are in a plane;
then the vector $\langle w_1-v_1,w_2-v_2,w_3-v_3\rangle$ is parallel
to the plane. In particular, if this vector is placed with its tail at
$(v_1,v_2,v_3)$ then its head is at $(w_1,w_2,w_3)$ and it lies in the
plane. As a result, any vector perpendicular to the plane is
perpendicular to $\langle w_1-v_1,w_2-v_2,w_3-v_3\rangle$. In fact, it
is easy to see that the plane consists of \emph{precisely} those points
$(w_1,w_2,w_3)$ for which $\langle w_1-v_1,w_2-v_2,w_3-v_3\rangle$ is
perpendicular to a normal to the plane, as indicated in
Figure~\ref{fig:plane defined via perp vectors}. Turning this around, suppose
we know that $\langle a,b,c\rangle$ is normal to a plane containing
the point $(v_1,v_2,v_3)$. Then $(x,y,z)$ is in the plane if and only
if $\langle a,b,c\rangle$ is perpendicular to $\langle
x-v_1,y-v_2,z-v_3\rangle$. In turn, we know that this is true
precisely when $\langle a,b,c\rangle\cdot\langle
x-v_1,y-v_2,z-v_3\rangle=0$. That is, $(x,y,z)$ is in the plane if and
only if
\begin{align*}
  \langle a,b,c\rangle\cdot\langle x-v_1,y-v_2,z-v_3\rangle&=0	\\
  a(x-v_1)+b(y-v_2)+c(z-v_3)&=0	\\
  ax+by+cz-av_1-bv_2-cv_3&=0	\\
  ax+by+cz&=av_1+bv_2+cv_3.
\end{align*}
Working backwards, note that if $(x,y,z)$ is a point satisfying
$ax+by+cz=d$ then
\begin{align*}
  ax+by+cz&=d	\\
  ax+by+cz-d&=0	\\
  a(x-d/a)+b(y-0)+c(z-0)&=0	\\
  \langle a,b,c\rangle\cdot\langle x-d/a,y,z\rangle&=0.
\end{align*}
Namely, $\langle a,b,c\rangle$ is perpendicular to the vector with
tail at $(d/a,0,0)$ and head at $(x,y,z)$. This means that the points
$(x,y,z)$ that satisfy the equation $ax+by+cz=d$ form a plane
perpendicular to $\langle a,b,c\rangle$. (This doesn't
work if $a=0$, but in that case we can use $b$ or $c$ in the role of
$a$. That is, either $a(x-0)+b(y-d/b)+c(z-0)=0$ or
$a(x-0)+b(y-0)+c(z-d/c)=0$.)

\begin{figure}[H]
\centerline{
\vbox{\beginpicture
\normalgraphs
\setcoordinatesystem units <3truecm,3truecm>
\setplotarea x from 0 to 1.1, y from 0 to 1.1
\put {\hbox{\epsfxsize6cm\epsfbox{images/plane_as_perps.eps}}} at 0 0
\endpicture}}
\caption{A plane defined via vectors perpendicular to a normal. \label{fig:plane defined via perp vectors}}
\end{figure}

Thus, given a vector $\langle a,b,c\rangle$ we know that all planes
perpendicular to this vector have the form $ax+by+cz=d$, and any surface
of this form is a plane perpendicular to $\langle a,b,c\rangle$.

\begin{formulabox}[Standard Form of a Plane]
Any plane can be written in the form
\[
ax + by + cz = d
\]
where $a, b, c, d$ are constants and not all $a, b, c$ are zero.

This plane is perpendicular to the vector $\langle a,b,c \rangle$. \index{plane!standard form}
\end{formulabox}

\begin{example}{Perpendicular Plane}{perpplaneexample}
Find an equation for the plane perpendicular to $\langle 1,2,3\rangle$
and containing the point $(5,0,7)$.
\end{example}
\begin{solution}
Using the formula above,
the plane is $1x+2y+3z=d$. To find $d$ we may substitute
the known point on the plane to get $5+2\cdot0+3\cdot7=d$, so $d=26$.
\end{solution}

\begin{example}{Normal Vector}{normalvectorexample}
Find a vector normal to the plane $2x-3y+z=15$.
\end{example}
\begin{solution}
One example is $\langle 2, -3,1\rangle$. Any vector parallel or
anti-parallel to this works as well, so for example
$-2\langle 2, -3,1\rangle=\langle -4,6,-2\rangle$ is also normal to the plane.
\end{solution}

We will frequently need to find an equation for a plane given certain
information about the plane. While there may occasionally be slightly
shorter ways to get to the desired result, it is always possible, and
usually advisable, to use the given information to find a normal to
the plane and a point on the plane, and then to find the equation as
above.

\begin{example}{Plane Perpendicular}{}
The planes $x-z=1$ and $y+2z=3$ intersect in a line. Find a
third plane that contains this line and is perpendicular to the plane
$x+y-2z=1$.
\end{example}
\begin{solution}
First, we note that two planes are perpendicular if and only if their
normal vectors are perpendicular. Thus, we seek a vector $\langle
a,b,c\rangle$ that is
perpendicular to $\langle 1,1,-2\rangle$. In addition, since the
desired plane is to contain a certain line, $\langle
a,b,c\rangle$ must be perpendicular to any vector parallel to this
line. Since $\langle
a,b,c\rangle$ must be perpendicular to two vectors, we may find it by
computing the cross product of the two.

Therefore we need a vector parallel
to the line of intersection of the given planes. For this, it suffices
to know two points on the line. To find two points on this line, we
must find two points that are simultaneously on the two planes,
$x-z=1$ and $y+2z=3$. Any point on both planes will satisfy
$x-z=1$ and $y+2z=3$. It is easy to find values for $x$ and $z$
satisfying the first, such as $x=1, z=0$ and $x=2, z=1$. Then
we can find corresponding values for $y$ using the second equation,
namely $y=3$ and $y=1$, so
$(1,3,0)$ and $(2,1,1)$ are two such points. They are both on the line
of intersection since they are contained in both planes.

Now
$\langle 2-1,1-3,1-0\rangle=\langle 1,-2,1\rangle$ is parallel to the
line. Finally, we may choose $\langle a,b,c\rangle=\langle
1,1,-2\rangle\times \langle 1,-2,1\rangle=\langle -3,-3,-3\rangle$.
While this vector will do perfectly well, any vector parallel or
anti-parallel to it will work as well. For example we might choose
$\langle 1,1,1\rangle$ which is anti-parallel to it, and easier to work with.

Now we know that $\langle 1,1,1\rangle$ is normal to the desired plane
and $(2,1,1)$ is a point on the plane. This gives an equation of $(1)x + (1)y + (1)z = d$. Substituting the value of the point into the equation gives $d = 4$, and therefore an equation of the
plane is $x+y+z=4$. As a quick check, since $(1,3,0)$ is also on the
line, it should be on the plane; since $1+3+0=4$, we see that this is
indeed the case.

Note that had we used $\langle -3,-3,-3\rangle$ as the normal, we
would have discovered the equation $-3x-3y-3z=-12$. Then we might well
have noticed that we could divide both sides by $-3$ to get the
equivalent $x+y+z=4$.
\end{solution}

We will now turn our attention to a study of lines. Unfortunately, it turns out to be quite inconvenient to
represent a typical line with a single equation; we need to approach
lines in a different way.

Unlike a plane, a line in three dimensions does have an obvious
direction, namely, the direction of any vector parallel to it. In fact
a line can be defined and uniquely identified by providing one point
on the line and a vector parallel to the line (in one of two possible
directions). That is, the line consists of exactly those points we can
reach by starting at the point and going for some distance in the
direction of the vector. Let's see how we can translate this into more
mathematical language.

Suppose a line contains the point $(v_1,v_2,v_3)$ and is parallel
to the vector $\langle a,b,c\rangle$. If we place the vector
$\langle v_1,v_2,v_3\rangle$ with its tail at the origin and its head
at $(v_1,v_2,v_3)$, and if we place the vector $\langle
a,b,c\rangle$ with its tail at $(v_1,v_2,v_3)$, then the head of
$\langle a,b,c\rangle$ is at a point on the line. We can get to
\emph{any} point on the line by doing the same thing, except using
$t\langle a,b,c\rangle$ in place of $\langle a,b,c\rangle$, where $t$
is some real number. Because of the way vector addition works, the
point at the head of the vector $t\langle a,b,c\rangle$ is the point
at the head of the vector $\langle v_1,v_2,v_3\rangle+t\langle
a,b,c\rangle$, namely $(v_1+ta,v_2+tb,v_3+tc)$; see
Figure~\ref{fig:vector line}.

\begin{figure}[H]
\centerline{
\vbox{\beginpicture
\normalgraphs
\setcoordinatesystem units <6truemm,6truemm>
\setplotarea x from -3 to 7, y from 0 to 4.5
\arrow <4pt> [0.35, 1] from 0 0 to 2 3
\arrow <4pt> [0.35, 1] from 2 3 to 7 4
\arrow <4pt> [0.35, 1] from 0 0 to 7 4
\put {$(v_1,v_2,v_3)$} [br] <-3pt,3pt> at 2 3
\put {$\langle v_1,v_2,v_3\rangle$} [r] <-5pt,0pt> at 1 1.5
\put {$t\langle a,b,c\rangle$} [br] <0pt,4pt> at 4.5 3.5
\put {$\langle v_1,v_2,v_3\rangle+t\langle a,b,c\rangle$} [tl]
  <3pt,-3pt> at 3.5 2
\setdashes
\plot -3 2 9.5 4.5 /
\endpicture}}
\caption{Vector form of a line. \label{fig:vector line}}
\end{figure}

In other words, as $t$ runs through all possible real values, the
vector $\langle v_1,v_2,v_3\rangle+t\langle a,b,c\rangle$ points to
every point on the line when its tail is placed at the origin. It is occasionally useful to use this form of a line even in two
dimensions; a vector form for a line in the $x$-$y$ plane is
$\langle v_1,v_2\rangle+t\langle a,b\rangle$, which is the same as
$\langle v_1,v_2,0\rangle+t\langle a,b,0\rangle$.

\begin{formulabox}[Vector Equation of a Line]
An equation for a line passing through point $(v_1, v_2, v_3)$ and parallel to the vector$\langle a, b, c\rangle$ is
\[
\langle v_1,v_2,v_3\rangle+t\langle a,b,c\rangle
\]\index{line!vector equation}
\end{formulabox}

The vector $\langle a, b, c\rangle$ is called the \dfont{direction vector}\index{direction vector}\index{line!direction vector} for the line.

Another
common way to write this is as a set of
\dfont{parametric equations}\index{parametric equations}:
$$ x= v_1+ta\qquad y=v_2+tb \qquad z=v_3+tc.$$

\begin{formulabox}[Parametric Equations of a Line]
A line in space can be described as
\begin{align*}
x = v_1 + ta \\
y = v_2 + tb \\
z = v_3 + tc
\end{align*}
where $(v_1, v_2, v_3)$ is a point on the line and $\langle a, b, c \rangle$ is parallel to the line.\index{line!parametric equations}
\end{formulabox}

\begin{example}{Vector Expression}{vectorexpexample}
Find a vector expression for the line through $(6,1,-3)$ and
$(2,4,5)$.
\end{example}
\begin{solution}
To get a vector parallel to the line we subtract $\langle
6,1,-3\rangle-\langle2,4,5\rangle=\langle 4,-3,-8\rangle$.  The line
is then given by $\langle 2,4,5\rangle+t\langle 4,-3,-8\rangle$; there
are of course many other possibilities, such as $\langle
6,1,-3\rangle+t\langle 4,-3,-8\rangle$.
\end{solution}

\begin{example}{Intersecting Lines}{intersecting lines}
Determine whether the lines $\langle 1,1,1\rangle+t\langle 1,2,-1\rangle$ and
$\langle 3,2,1\rangle+t\langle -1,-5,3\rangle$ are parallel, intersect, or
neither.
\end{example}
\begin{solution}
In two dimensions, two lines either intersect or are parallel; in
three dimensions, lines that do not intersect might not be parallel.
In this case, since the direction vectors for the lines are not
parallel or anti-parallel we know the lines are not parallel.
If they intersect, there must be two values $a$ and $b$ so that
$\langle 1,1,1\rangle+a\langle 1,2,-1\rangle=
\langle 3,2,1\rangle+b\langle -1,-5,3\rangle$. That is, the following must have a solution:
\begin{align*}
  1+a&=3-b	\\
  1+2a&=2-5b	\\
  1-a&=1+3b
\end{align*}
This gives three equations in two unknowns, so there may or may not be
a solution in general. In this case, it is easy to discover that $a=3$
and $b=-1$ satisfies all three equations. Substituting these values into $\langle 1,1,1\rangle+a\langle 1,2,-1\rangle=
\langle 3,2,1\rangle+b\langle -1,-5,3\rangle$, the point of intersection is $(4,7,-2)$.
\end{solution}

\begin{example}{Distance from a Point to a Plane}{distancepointplaneexample}
Find the distance from the point $(1,2,3)$ to the plane
$2x-y+3z=5$.
\end{example}
\begin{solution}
The distance from a point $P$ to a plane is the shortest
distance from $P$ to any point on the plane; this is the
distance measured from $P$ perpendicular to the plane; see
Figure~\ref{fig:point to plane}. This distance
is the absolute value of the scalar projection of
$\overrightarrow{\strut QP}$
onto a normal vector $\vect{n}$, where $Q$ is any point on the plane.
It is easy to find a point on the plane, say $(1,0,1)$.
Thus the distance is
$$
  {\langle 0,2,2\rangle\cdot\langle 2,-1,3\rangle\over|\langle 2,-1,3\rangle|}=
  {4\over\sqrt{14}}.
$$
\end{solution}

\begin{figure}[H]
\centerline{
\vbox{\beginpicture
\normalgraphs
\setcoordinatesystem units <6truemm,6truemm>
\setplotarea x from -2 to 4, y from -3.5 to 4.5
\put {$P$} [b] <0pt,3pt> at 1 4
\put {$\vect{n}$} [b] <0pt,3pt> at -1.5 2
\put {$Q$} [t] <0pt,-3pt> at 0 0
\multiput {$\bullet$} at 0 0 1 4 /
\arrow <4pt> [0.35, 1] from 0 0 to 1 4
\arrow <4pt> [0.35, 1] from 0 0 to -1.5 2
\setdashes
\setlinear
\plot -2 0 4 4.5 3.5 0.5 -2.5 -3.5 -2 0 /
\endpicture}}
\caption{Distance from a point to a plane. \label{fig:point to plane}}
\end{figure}

\begin{example}{Distance from a Point to a Line}{distancepointplaneexample}
Find the distance from the point $(-1,2,1)$ to the line
$\langle 1,1,1\rangle + t\langle 2,3,-1\rangle$.
\end{example}
\begin{solution}
Again we want the distance
measured perpendicular to the line, as indicated in
Figure~\ref{fig:point to line}. The desired distance is
$$
  |\overrightarrow{\strut QP}|\sin\theta=
  {|\overrightarrow{\strut QP}\times\vect{v}|\over|\vect{v}|},
$$
where $\vect{v}$ is any vector parallel to the line. From the equation of
the line, we can use $Q=(1,1,1)$ and $\vect{v}=\langle 2,3,-1\rangle$ along with $P = (-1,2,1)$, so
the distance is
$$
  {|\langle -2,1,0\rangle\times\langle2,3,-1\rangle|\over\sqrt{14}}=
  {|\langle-1,-2,-8\rangle|\over\sqrt{14}}={\sqrt{69}\over\sqrt{14}}.
$$
\end{solution}

\begin{figure}[H]
\centerline{
\vbox{\beginpicture
\normalgraphs
\setcoordinatesystem units <6truemm,6truemm>
\setplotarea x from -3 to 4, y from -1.5 to 4
\put {$P$} [b] <0pt,3pt> at 2 4
\put {$\theta$} [b] <3pt,3pt> at -0.5 -0.25
\put {$Q$} [t] <0pt,-3pt> at -1 -0.5
\put {$\vect{v}$} [t] <0pt,-3pt> at 1 0.5
\put {$|\overrightarrow{\vrule height8pt width 0pt QP}|\sin\theta$}
     [bl] <3pt,3pt> at 2.6 2.8
\multiput {$\bullet$} at -1 -0.5 2 4 /
\arrow <4pt> [0.35, 1] from -1 -0.5 to 1 0.5
\arrow <4pt> [0.35, 1] from -1 -0.5 to 2 4
\setdashes
\setlinear
\plot -3 -1.5 4 2 /
\plot 2 4 3.2 1.6 /
\endpicture}}
\caption{Distance from a point to a line. \label{fig:point to line}}
\end{figure}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\Opensolutionfile{solutions}[ex]
\section*{Exercises for \ref{sec:3Dlinesplanes}}

\begin{enumialphparenastyle}

\begin{ex}
Find an equation of the plane containing $(6,2,1)$ and
perpendicular to $\langle 1,1,1\rangle$.
\begin{sol}
	$(x-6)+(y-2)+(z-1)=0$
\end{sol}
\end{ex}

\begin{ex}
Find an equation of the plane containing $(-1,2,-3)$ and
perpendicular to $\langle 4,5,-1\rangle$.
\begin{sol}
	$4(x+1)+5(y-2)-(z+3)=0$
\end{sol}
\end{ex}

\begin{ex}
Find an equation of the plane containing $(1,2,-3)$,
$(0,1,-2)$ and $(1,2,-2)$.
\begin{sol}
	$(x-1)-(y-2)=0$
\end{sol}
\end{ex}

\begin{ex}
Find an equation of the plane containing $(1,0,0)$,
$(4,2,0)$ and $(3,2,1)$.
\begin{sol}
	$-2(x-1)+3y-2z=0$
\end{sol}
\end{ex}

\begin{ex}
Find an equation of the plane containing $(1,0,0)$ and the
line $\langle 1,0,2\rangle + t\langle 3,2,1\rangle$.
\begin{sol}
	$4(x-1)-6y = 0$
\end{sol}
\end{ex}

\begin{ex}
Find an equation of the plane containing the line of
intersection of $x+y+z=1$ and $x-y+2z=2$, and perpendicular to the
$x$-$y$ plane.
\begin{sol}
	$x+3y=0$
\end{sol}
\end{ex}

\begin{ex}
Find an equation of the line through $(1,0,3)$ and
$(1,2,4)$.
\begin{sol}
	$\langle 1,0,3\rangle+t\langle 0,2,1\rangle$
\end{sol}
\end{ex}

\begin{ex}
Find an equation of the line through $(1,0,3)$ and
perpendicular to the plane $x+2y-z=1$.
\begin{sol}
	$\langle 1,0,3\rangle+t\langle 1,2,-1\rangle$
\end{sol}
\end{ex}

\begin{ex}
Find an equation of the line through the origin
and perpendicular to the plane $x+y-z=2$.
\begin{sol}
	$t\langle 1,1,-1\rangle$
\end{sol}
\end{ex}

\begin{ex}
Find $a$ and $c$ so that $(a,1,c)$ is on the line through
$(0,2,3)$ and $(2,7,5)$.
\begin{sol}
	$-2/5$, $13/5$
\end{sol}
\end{ex}

\begin{ex}
Explain how to discover the solution in
Example~\ref{exa:intersecting lines}.
\end{ex}

\begin{ex}
Determine whether the lines $\langle 1,3,-1\rangle+t\langle
1,1,0\rangle$ and $\langle 0,0,0\rangle+t\langle 1,4,5\rangle$ are
parallel, intersect, or neither.
\begin{sol}
	neither
\end{sol}
\end{ex}

\begin{ex}
Determine whether the lines $\langle 1,0,2\rangle+t\langle
-1,-1,2\rangle$ and $\langle 4,4,2\rangle+t\langle 2,2,-4\rangle$ are
parallel, intersect, or neither.
\begin{sol}
	parallel
\end{sol}
\end{ex}

\begin{ex}
Determine whether the lines $\langle 1,2,-1\rangle+t\langle
1,2,3\rangle$ and $\langle 1,0,1\rangle+t\langle 2/3,2,4/3\rangle$ are
parallel, intersect, or neither.
\begin{sol}
	intersect at $(3,6,5)$
\end{sol}
\end{ex}

\begin{ex}
Determine whether the lines $\langle 1,1,2\rangle+t\langle
1,2,-3\rangle$ and $\langle 2,3,-1\rangle+t\langle 2,4,-6\rangle$ are
parallel, intersect, or neither.
\begin{sol}
	same line
\end{sol}
\end{ex}

\begin{ex}
Find a unit normal vector to each of the coordinate planes.
\end{ex}

\begin{ex}
Show that $\langle 2,1,3 \rangle + t \langle 1,1,2 \rangle$ and
$\langle 3, 2, 5 \rangle + s \langle 2, 2, 4 \rangle$ are the same
line.
\end{ex}

\begin{ex}
Give a prose description for each of the following processes:
\begin{enumerate}
\item	Given two distinct points, find the line that goes through them.
\item	Given three points (not all on the same line), find the plane
  that goes through them. Why do we need the caveat that not all
  points be on the same line?
\item	Given a line and a point not on the line, find the plane that
contains them both.
\item	Given a plane and a point not on the plane, find the line that
is perpendicular to the plane through the given point.
\end{enumerate}
\end{ex}

\begin{ex}
Find the distance from $(2,2,2)$ to $x+y+z=-1$.
\begin{sol}
	$7/\sqrt3$
\end{sol}
\end{ex}

\begin{ex}
Find the distance from $(2,-1,-1)$ to $2x-3y+z=2$.
\begin{sol}
	$4/\sqrt{14}$
\end{sol}
\end{ex}

\begin{ex}
Find the distance from $(2,-1,1)$ to
$\langle 2,2,0\rangle+t\langle 1,2,3\rangle$.
\begin{sol}
	$\sqrt{131}/\sqrt{14}$
\end{sol}
\end{ex}

\begin{ex}
Find the distance from $(1,0,1)$ to
$\langle 3,2,1\rangle+t\langle 2,-1,-2\rangle$.
\begin{sol}
	$\sqrt{68}/3$
\end{sol}
\end{ex}

\begin{ex}
Find the cosine of the angle
between the planes $x+y+z=2$ and $x+2y+3z=8$.
\begin{sol}
	$\sqrt{42}/7$
\end{sol}
\end{ex}

\begin{ex}
Find the cosine of the angle
between the planes $x-y+2z=2$ and $3x-2y+z=5$.
\begin{sol}
	$\sqrt{21}/6$
\end{sol}
\end{ex}

\end{enumialphparenastyle}


\documentclass{homework}
\course{Math 5522H}
\author{Alex Li}
\input{preamble}

\begin{document}
\maketitle

\begin{inspiration}
It is singularity which often makes the worst part of our suffering.\\
\byline{Jane Austen}, not talking about this problem set.
\end{inspiration}

\section{Terminology}

This week, there is a lot of new terminology to classify the various
sorts of singularities we might encounter.  For full credit, be sure
to give careful precise definitions.

\begin{problem}
  What is an \textbf{isolated singularity}?
  \end{problem}
  \begin{solution}
  A holomorphic function $f:U\setminus \{z_0\}\to\C$ has an isolated singularity at a point $z_0$ if there is an $r$ such that $(B_r(z_0)\cup z_0) \subset U$.
  \end{solution}
  \begin{problem}
    What is meant by the \textbf{order} (or \textbf{multiplicity}) of a zero?  Of a pole?
    \end{problem}
    \begin{solution}
    Suppose that $f:U\to \C$ is a  holomorphic function from an open set with a zero at $z_0$. The zero is said to have multiplicity $n$ if the function $g(z) = \frac{f(z)}{(z-z_0)^n}$ is holomorphic and $\lim_{z\to z_0} g(z) \neq 0$.

    If $f$ has a pole at $z_0$, then it is said to have multiplicity $n$ if $g(z) = 1/f(z)$ has a zero of multiplicity $n$ at $z_0$.
    \end{solution}
    \begin{problem}
      What is a \textbf{removable singularity}?
      \end{problem}
      \begin{solution}
      An isolated singularity of $f$ at $z_0$ is said to be removable if $\lim_{z\to z_0} f(z)$ exists.
      \end{solution}
      \begin{problem}
        What does it mean to say that a function $f : \C \to \C$ has a zero of order $n$ at infinity?  Has a pole of order $n$ at infinity?
        \end{problem}
        \begin{solution}
        $f$ has a zero or pole of order $n$ at infinity if $f(\frac{1}{z})$ has a zero or pole respectively of order $n$ at 0.
        \end{solution}
        \begin{problem}
        What is a \textbf{meromorphic function}?
        \end{problem}
        \begin{solution}
        A function $f$ is said to be meromorphic on an open subset $U$ if there is a set of points $S = \{x_i\}_i$ such that $f:U\setminus S\to \C$ is holomorphic and every point $x_i$ is removable singularity that happens to also be a pole of $f$.
        \end{solution}
        \section{Numericals}

        \begin{problem}
          Let $f(z) = e^{z \sin^2 z} - 1$.  What is the order of the zero at $z = 0$?
          \end{problem}
          \begin{solution}
          We can use a Taylor expansion of the polynomial at 0, and the index of the first nonzero term will be the order of the zero. Equivalently, the order is the index of the first nonzero derivative.

          \begin{align}
          f'(z)  &= (\sin^2(z) + 2z\sin(z)\cos(z))e^{z\sin^2 z}
          \end{align}
          Clearly this is 0 at $z=0$.
          Define $g(z) = \sin^2(z) + 2z\sin(z)\cos(z)$.
          \begin{align*}
          g'(z) &= 2\sin(z)\cos(z) + 2[\sin(z)\cos(z) + z\cos^2(z) - z\sin^2(z)]\\
          &= 4\sin(z)\cos(z) + 2z(\cos^2(z) - \sin^2(z))\\
          f''(z)  &= (g'(z)+g(z)^2)e^{z\sin^2 z}
          \end{align*}
          We can check that $g'(0)=g(0)=0$, so we look towards the third derivative...
          \begin{align*}
          g''(z) &= (4\cos^2(z) - 4\sin^2(z)) + 2(\cos^2(z) - \sin^2(z)) + 2z(-2\cos(z)\sin(z))-2\cos(z)\sin(z))\\
          g''(z) &= 6\cos^2(z) - 6\sin^2(z) - 8z(\cos(z)\sin(z)))\\
          f'''(z)  &= g(z)(g'(z)+g(z)^2)e^{z\sin^2 z} + (g''(z)+g'(z)^2)e^{z\sin^2 z}
          \end{align*}
          At $z=0$, $g''(0) = 6$ and so $f''(0) = 6$. Thankfully we don't have to compute the fourth derivative and can conclude that the order of the zero at 0 is 3.
          \end{solution}
          \begin{problem}
            Let $f(z) = \left( \cos z \right) - 1 - z^2/2$, and compute
              \[
                  \int_\gamma \frac{f'(z)}{f(z)} \, dz
                    \]
                      for $\gamma : [0,2\pi]$ given by $\gamma(\theta) = e^{i\theta}$.
                      \end{problem}
                      \begin{solution}
                      First, let's expand $\cos z$ as a Taylor series:
                      \begin{align}\label{f_leading_coef_cos}
                      f(z) = (\sum_{n=0}^\infty \frac{(-1)^nz^{2n}}{(2n)!}) - 1 - z^2/2 =-z^2 + \sum_{n=2}^\infty \frac{(-1)^nz^{2n}}{(2n)!}
                      \end{align}
                      Now let us use the residue theorem to compute this integral. It will be equal to the sum of the residues at the zeros of $f$. To do this, let's find all poles of the function. At $z=0$, the denominator is 0, and this occurs at no other point, since the magnitude of the first term will be greater than the magnitude of the rest
                      \[
                      \abs{f(z)} \geq \abs{z^2} - \sum_{n=2}^\infty \abs{\frac{z^{2n}}{(2n)!}} \geq  \abs{z^2}(1 - \sum_{n=2}^\infty \frac{1}{(2n)!}) \geq 0
                      \]
                      That this is more than 0 can be verified by comparison to the formula
                      \begin{align*}
                      e &= \sum_{n=1}^\infty \frac{1}{n!}\\
                      .05 \approx e - \sum_{n=0}^3 \frac{1}{n!} &= \sum_{n=4}^\infty \frac{1}{n!}\\
                      1 &\geq \sum_{n=4}^\infty \frac{1}{n!} \geq \sum_{n=2}^\infty \frac{1}{2n!}
                      \end{align*}

                      Next we need to determine the order of the pole at $z=0$. Since we already know the first positive coefficient of the power series for f is at $x^2$ from equation \ref{f_leading_coef_cos}, we can quickly check that we are dealing with a first order pole:
                      \begin{align*}
                          \frac{f'(z)}{f(z)} &= \frac{\Theta(z)}{\Theta(z^2)} = \Theta(z^{-1})
                          \end{align*}
                          Thus we can compute the residue by evaluating the limit as $z\frac{f(z)}{f'(z)}$ approaches 0.
                          \[
                          \lim_{z\to 0} \frac{zf'(z)}{f(z)} =  \lim_{z\to 0} \frac{z(-2z + \Theta(z^3))}{-z^2 + \Theta(z^4)} = 2
                          \]
                          The original integral is equal to the sum of the residues, so we can conclude that the value of the integral is 2.
                          \end{solution}
                          \section{Exploration}

                          \begin{problem}
                            Explain the topology on $\mathbb{C} \cup \{ \infty \}$, the \textbf{Riemann sphere}.
                            \end{problem}
                            \begin{solution}
                            Well, it's the topology of... a sphere. To see this, we can consider the homeomorphism given by projecting any point $x$ on a unit sphere sitting on the complex plane to the point on the plane on the line between $x$ and the top of the sphere $x_{top}$. The exception is that $x_{top} $ will map to $\infty$.

                            It's geometrically clear enough that this is a bijection, and besides infinity, it's also clear that this is continuous with a continuous inverse. To see that it's continuous at infinity, notice that any neighborhood of $x_{top}$ is a small circle at the top of the sphere, so it's image under this bijection contains all point sufficiently far from 0. The inverse transformation is continuous since for any neighborhood of $\infty$, there is an $R$ so that all points distance $R$ from 0 are contained in the neighborhood, so the preimage will be a neighborhood of $x_{top}$.

                            \end{solution}
                            \begin{problem}\label{jordans-lemma}
                              Prove \textbf{Jordan's lemma}; next week, this lemma will help us estimate integrals over the contour $\gamma : [0,\pi] \to \C$ given by $\gamma(\theta) = re^{i\theta}$.
                                Specifically, show that if $a > 0$, then
                                  \[
                                      \abs{\int_\gamma e^{iaz} \, g(z) \, dz } \leq \frac{\pi}{a} \sup_{\theta \in [0,\pi]} \abs{g(\gamma(\theta))}.
                                          \]
                                          \end{problem}
                                          \begin{solution}
                                          Let \(M = \sup_{\theta \in [0,\pi]} \abs{g(\gamma(\theta))}\)
                                          \begin{align*}
                                          \abs{\int_\gamma e^{iaz}g(z)dz}  &= \abs{\int_0^\pi e^{iare^{i\theta}} g(re^{i\theta})rie^{i\theta}d\theta}\\
                                          &= r\abs{\int_0^\pi e^{iar\cos(\theta) - ar\sin(\theta)}e^{i\theta}g(re^{i\theta})d\theta}\\
                                          &\leq rM\abs{\int_0^\pi e^{-ar\sin(\theta)}d\theta}\\
                                          &= 2rM\int_0^{\pi/2} e^{-ar\sin(\theta)}d\theta\\
                                          &= 2rM\frac{\pi e^{-ar\frac{2\theta}{\pi}}}{2ar}\big|_0^{2\pi}\\
                                          &\leq 2\pi rM\frac{1}{2ar} = \frac{\pi}{a}M
                                          \end{align*}
                                          \end{solution}

                                          \begin{problem}\label{riemann-removable-singularity}
                                            For an open set $U \ni z_0$, suppose
                                              $f : U \setminus \{z_0\} \to \C$ is holomorphic.  Show that
                                                $\lim_{z\to z_0} (z-z_0)f(z)=0$ if and only $f$ extends to a
                                                  holomorphic function $F : U \to \C$.
                                                  \end{problem}
                                                  \begin{solution}
                                                  We will additionally assume that $z_0$ is a isolated singularity, to prevent the case where $z_0$ is an isolated point where the limit doesn't exist but $f$ can extend to $F$ just by giving it any value at $z_0$.

                                                  We have 3 cases depending on the type of singularity. If $z_0$ is an essential singularity, then the limit has no chance of existing - since $f(z)$ is dense in every open ball and $z-z_0$ is not, their product is dense in every open ball.  If $z_0$ is a removable discontinuity, then $f$ surely extends to a holomorphic function $F$ with $F(z_0)$ finite. Thus
                                                  \[\lim_{z\to z_0} (z-z_0)f(z)=\lim_{z\to z_0} (z-z_0)F(z) = 0\]

                                                  Finally, if $z_0$ is a pole of order 1 then by definition $g_1(z) = f(z)/(z-z_0)$ is holomorphic and has a nonzero limit. If the order is $n>1$, then $f(z)/(z-z_0)^n$ has a nonzero limit so $f(z)/(z-z_0)^{n-1}$ diverges.In either case, the limit is not zero, consistend with the fact that $f$ does not extend to $F$.
                                                  \end{solution}

                                                  \begin{problem}\label{idempotent-entire}
                                                  Describe holomorphic functions
                                                    $f : \C \to \C$ with the property that $f(f(z)) = f(z)$ for all
                                                      $z \in \C$.
                                                      \end{problem}
                                                      \begin{solution}
                                                      One possible case occurs when $f(z)=c$. Otherwise, since $f:\C\to\C$, the image of $f$ is dense in $\C$. And for every point $z$ in the image of $f$, $f(z) = z$, so this implies that $f(z)-z = 0$ at a dense subset of the plane, in particular at some convergent sequence of points. Therefore $f(z)-z$ is identically 0, so the only functions with this property are $f(z)=c$ and $f(z)=z$.
                                                      \end{solution}

                                                      \begin{problem}
                                                        Suppose $U$ is a disk and $f : U \to \C$ is holomorphic with
                                                          finitely many zeros, and repeatedly invoke \ref{factor-theorem} to
                                                            explain why you can find $z_1,z_2,\ldots,z_n \in \C$ and write
                                                              \[
                                                                  f(z) = (z-z_1)(z-z_2) \cdots (z-z_n) \, g(z)
                                                                    \]
                                                                      for a nowhere-vanishing analytic function $g : U \to \C$.
                                                                      \end{problem}
                                                                      \begin{solution}
                                                                      Let $w_1, w_2, \dots w_k$ correspond to the locations of the zeros. If $w_l$ is the location of a zero of order $m_l$, then by \ref{factor-theorem}, the function $f(z)/ (z-w_l)^{m_l}$ does not vanish at $w_l$ and is still analytic. Furthermore, this does not introduce any new zeros since we are multiplying by a nonzero quantity everywhere besides $w_l$. Repeating this for each root, we see that
                                                                      \[
                                                                      \frac{f(z)}{\prod_{l=0}^k (z-w_l)^{m_l}} = g(z)
                                                                      \]
                                                                      is nonzero everywhere in $U$.
                                                                      \end{solution}
                                                                      \begin{problem}\label{argument-principle-zeros}
                                                                        Continuing as above, compute $f'(z)/f(z)$ in terms of $z_1,z_2,\ldots,z_n \in \C$ and $g'(z)/g(z)$, and evaluate
                                                                          \[
                                                                              \frac{1}{2\pi i} \int_\gamma \frac{f'(z)}{f(z)} \, dz
                                                                                \]
                                                                                in terms of the winding numbers $n(\gamma,z_j)$.
                                                                                \end{problem}
                                                                                \begin{solution}
                                                                                \begin{align*}
                                                                                \frac{f'(z)}{f(z)} &= \left(\frac{d}{dz}\Log f(z)\right) \\
                                                                                &= \left(\frac{d}{dz}\Log g(z)\prod_{k=1}^n (z-z_k)\right) \\
                                                                                &=  \frac{g(z)\prod (z-z_i)\left(\frac{g'(z)}{g(z)} \sum_{i=1}^n \frac{1}{z-z_i}\right)}{g(z)\prod (z-z_i)}\\
                                                                                &=  \frac{g'(z)}{g(z)} + \sum_{i=1}^n \frac{1}{z-z_i}
                                                                                \end{align*}
                                                                                The function $\frac{g'(z)}{g(z)}$ is everywhere holomorphic since $g$ is holomorphic with no zeros, and the rest of the functions have obvious residues. So we can compute the integral:
                                                                                \begin{align*}
                                                                                \frac{1}{2\pi i} \int_\gamma \frac{f'(z)}{f(z)} \, dz &= \frac{1}{2\pi i} \int_\gamma \frac{g'(z)}{g(z)} + \sum_{i=1}^n \frac{1}{z-z_i} \, dz\\
                                                                                &= \sum_{i=1}^n n(\gamma, z_i)
                                                                                \end{align*}
                                                                                \end{solution}
                                                                                \begin{problem}
                                                                                Let's justify the terminology that a ``zero of multiplicity $n$''
                                                                                really means there are $n$ solutions to a certain equation.  Suppose
                                                                                the holomorphic function $f : B_1(0) \to \C$ has a zero of order $n$
                                                                                at zero, i.e., suppose $f(z) = z^n g(z)$ for a holomorphic
                                                                                $g : B_1(0) \to \C$ with $g(0) \neq 0$.  For all sufficiently small
                                                                                $\epsilon > 0$, find $\delta > 0$ so that for all
                                                                                $w \in B_\epsilon(0) - \{0\}$, the set
                                                                                $f^{-1}(\{w\}) \cap B_\delta(0)$ consists of $n$ elements.
                                                                                \end{problem}
                                                                                \begin{solution}
                                                                                Consider the Talyor expansion of $f$, since $f(z)=z^ng(z)$ is the first nonzero term, the first $n$ coefficents must be zero. Thus
                                                                                \[
                                                                                f(z) = \sum_{k=1}^\infty a_nx^n
                                                                                \]
                                                                                We want to show that for some small $w=f(z_0)$, $w - f(z)$ has $k$ roots near 0. Where can the following equation be satisfied?
                                                                                \[
                                                                                w - f(z) = w + a_nz^n + O(z^{n+1}) = 0
                                                                                \]
                                                                                Where $O(f(z))$ means that $\exists c$ such that $|f(z)|\leq cz^n$ as $z\to 0$.
                                                                                By definition, $z_0$ is a root of this equation, and if we choose a sufficiently small $\delta>0$, then the dominant term of the equation is $w + a_nz^n$, so any zeros will be in a neighborhood of $z_0e^{2i\pi k/n}$ for some $k$, and there should be at least one zero in each neighborhood. % Weak argument

                                                                                We can indirectly control the size of the neighborhood by adjusting $\delta$ and make it suuuper small so that none intersect. Now choose one of the n neighborhoods. If there are two values $z_0, z_1$ in this neighborhood that are equal, then
                                                                                \[0 = f(z_0) - f(z_1) = a_n(z_0^n + z_1^n) + \sum_{k=n+1}^\infty a_k(z_0^{k+1}-z_1^{k+1})\]
                                                                                Writing $z_1 = z_0 + h$ and using the fact that $z_0, z_1$ being in the same neighborhood implies $h$ can be made arbitrarily small,
                                                                                \[
                                                                                0 = a_n(z_0^n + z_1^n) + \sum_{k=n+1}^\infty a_k(z_0^{k+1}-z_1^{k+1}) = anz_0^{n-1}h + O(h^2z_0^{n-1}) + O(hz_0^n) = hz_0^{n-1}(a_n + O(h + z_0))
                                                                                \]
                                                                                But since $z_0\neq 0, a_n\neq 0$, this implies that $h=0$ and so $z_0=z_1$. Thus there is exactly one point $z_0$ in each neighborhood such that $f(z_0)=w$, so there must be exactly $n$ points within $\delta$ such that $f(z)=w$.
                                                                                \end{solution}
                                                                                \section{Prove or Disprove and Salvage if Possible}

                                                                                \begin{problem}\label{factor-theorem}
                                                                                Suppose $U \subset \C$ is open, and $f : U \to \C$ is analytic, and for some $z_0 \in U$, we have $f(z_0) = 0$.  Then there is a positive $m \in \Z$ so that
                                                                                \[
                                                                                g(z) := \frac{f(z)}{(z-z_0)^m}
                                                                                \]
                                                                                yields an analytic function $g : U \to \C$ which does not vanish at $z_0$.
                                                                                \end{problem}
                                                                                \begin{solution}
                                                                                Since $f$ is analytic, it has a power series representation
                                                                                \[
                                                                                f(z) = \sum_{k=0}^\infty a_k(z-z_0)^k
                                                                                \]
                                                                                Letting $m$ be the index of the first nonzero term $a_m$ in this representation, the function
                                                                                \[
                                                                                g(z) = \frac{f(z)}{(z-z_0)^m} =  a_m + \sum_{k=m+1}^\infty a_k(z-z_0)^k
                                                                                \]
                                                                                is also analytic, and at the point $z=z_0$, all but the first term vanish and so $g(z_0)=a_m\neq 0$.
                                                                                \end{solution}
                                                                                \begin{problem}\label{entire-dominate-entire}Suppose $f, g : \C \to \C$ are holomorphic and for all $z \in \C$ we have $\abs{f(z)} \leq \abs{g(z)}$.  In this case, we say that $g$ dominates $f$.  Then $f(z) = \lambda \cdot g(z)$ for some $\lambda \in \C$.  (Compare \ref{identity-dominate-entire}.)
                                                                                \end{problem}
                                                                                \begin{solution}
                                                                                For all $\epsilon>0$, we see that $\abs{f(z)/(g(z)+\epsilon)} \leq 1$ when $g(z)\neq 0$. By the identity theorem, the set of points where $g(z)=0$ is isolated, so the set excluding these points is open, and we can apply Liouville's theorem to say that the function $f/g$ is bounded on that open set and hence everywhere. Thus $f/g$ is a constant $\lambda$.
                                                                                \end{solution}
                                                                                \begin{problem}
                                                                                If $f : \C \to \C$ has a pole of order $n$ at infinity, then $f$ is a polynomial of degree at most $n$.
                                                                                \end{problem}
                                                                                \begin{solution}
                                                                                False, we aren't assuming that $f$ is holomorphic so we will be destroyed by functions like $\begin{cases}x&x\neq 0\\ 1 &x=0\end{cases}$ with a pole of order 1 at infinity. With $f$ holomorphic, it is true, in fact we can say it is a polynomial of degree exactly $n$.

                                                                                Since $f(z)$ is a function with a pole of order $n$ at infinity, the function $f(\frac{1}{z})$ has a pole of order $n$ at 0. Thus the function $f(\frac{1}{z})z^n$ is analytic and approaches some nonzero value $a_n$ at the point 0.

                                                                                Then the function $f(z)/z^n$ approaches $a_n$ as $z\to \infty$.

                                                                                Now, $f(z)$ is analytic so we can write it out as a power series.
                                                                                \[
                                                                                f(z) = \sum_{k=0}^\infty a_kz^k
                                                                                \]
                                                                                After dividing by $z^n$, we get a term $\frac{f(z)}{z^n} = \sum_{k=0}^n a_kz^k$ which evidentally approaches $a_n$ as $z$ goes to infinity. Thus the other component must be 0 in the limit.
                                                                                \[
                                                                                0 = \lim_{z\to\infty} \sum_{k=n+1}^\infty a_kz^{k-n}
                                                                                \]
                                                                                Now, this function is holomorphic on all of $\C$ and since the limit exists it is bounded, hence constant, hence 0. Therefore $f(z)$ is a degree $n$ polynomial.

                                                                                \end{solution}
                                                                                \begin{problem}\label{casorati-weierstrass}
                                                                                Suppose $f : U \setminus \{ z_0 \} \to \C$ is holomorphic with an essential singularity at $z_0 \in U$.  If $V \subset U$ is a neighborhood of $z_0$, then $f(V \setminus \{ z_0 \})$ is dense in $\C$.
                                                                                \end{problem}
                                                                                \begin{solution}
                                                                                True. Suppose that it was not dense. Then there is a point $w_0\in \C$ such that $f(V\setminus \{z_0\})$ does not take on any value within $\epsilon$ of $w_0$. Now consider the function
                                                                                \[\frac{1}{f(z) - w_0}.\]

                                                                                For $z \in V$, the norm of the denominator will always be greater than $\epsilon$, and thus the norm of this function is bounded above by $\frac{1}{\epsilon}$. Since it is bounded, the Riemann theorem on removable singularities says that $g(z) = \frac{1}{f(z)-w_0}$ has a removable discontinuity. After removing this discontinuity, if $g(z_0) \neq 0$ then $\frac{1}{g(z)}+w_0 = f(z)$ will be analytic so $f(z)$ has a removable discontinuity at $z_0$.  If, however, $g(z_0)=0$, then by \ref{factor-theorem}, we can find an analytic $h(z) = \frac{g(z)}{(z-z_0)^m}$ that is not zero at $z_0$, so
                                                                                \[
                                                                                h(z) = \frac{1}{(z-z_0)^m(f(z)-w_0)}\implies f(z) = \frac{1}{(z-z_0)^mh(z)}+w_0
                                                                                \]
                                                                                From this it is clear that $(z-z_0)^mf(z)$ is analytic and equal to $\frac{1}{h(z_0)}\neq 0$ at $z_0$, so $f(z)$ has a pole of degree $m$ at $z_0$.

                                                                                In any case, the discontinuity is not essential, a contradictio.
                                                                                \end{solution}
                                                                                \begin{problem}
                                                                                There exists a holomorphic function $f : \C \to \C$ so that both $f$
                                                                                and $z \mapsto e^{f(z)}$ have poles at zero.
                                                                                \end{problem}
                                                                                \begin{solution}
                                                                                False, if $f$ is holomorphic on all of $\C$ it doesn't have any discontinuities, so it doesn't have a pole. Here is a salvage:

                                                                                If $f$ is a meromorphic function with a pole at 0, then $e^f$ has a essential discontinuity at 0.

                                                                                Even without this tecnhicality, it is impossible: if $f$ has a pole of degree $d$, then we can write $f = \sum_{k=-d}^{\infty} a_kx^k$, and since the leading term dominates as $x$ tends to zero, when $\epsilon$ is sufficiently small, we can find a value $x_1$ such that $f(x_1)\approx |\epsilon|^{-d}$ near 0.

                                                                                Then $e^{f(x)}$ cannot possibly be a pole or removable discontinuity at 0, as if it were, for some $n\in \N$,
                                                                                \[
                                                                                0 = \lim_{x\to 0} e^{f(x)}/x^n  = \lim_{x\to 0} e^{x^d}/x^n = \infty
                                                                                \]
                                                                                \end{solution}
                                                                                \begin{problem}
                                                                                There exists a nowhere-vanishing holomorphic function
                                                                                $f : \C \to \C$ such that $\lim_{z \to \infty} f(z) = \infty$.
                                                                                \end{problem}
                                                                                \begin{solution}
                                                                                False. Such a function is a meromorphic function on the extended complex plane with a pole at infinity, so it is a rational function, and can be written out as a quotient of two polynomials $f=p(x)/q(x)$. If $q(x)$ is not constant, it has a root, contradicting the domain of $f$ being all of $\C$. If $p(x)$ is not constant, then there is a zero of $f$. Thus $f$ is a constant.

                                                                                A correct statement could be something like
                                                                                \begin{theorem}
                                                                                Any non constant meromorphic function $f:\C\to \C$ with $\lim_{z\to\infty} = C$ for some constant $C$ has at least 1 pole.
                                                                                \end{theorem}
                                                                                The limit being constant happens exactly when the degree of $p(x)$ is equal to the degree of $q(x)$ in the precceding proof. Since the $f$ isn't constant, $q(x)$ has a root somewhere, and by the definition of meromorphic this root corresponds to a pole.
                                                                                \end{solution}
                                                                                % All such functions are rational

                                                                                \end{document}


%!TEX root =  ../main.tex

\subsection{Derivatives of Exponentials}

\objective{Describe and use the special status of $e^x$ amongst exponential equations}

As we move past power function, derivatives become a lot harder to compute.  If we
begin with the premise that there is some exponential function which is its own
derivative --- that the height of the function at every point is the same as its slope
--- then we should find constant for the base.  Empirically, it is easy to see that
such a number is between 2 and 3, but how can we be more precise?  We
begin with the definition
$$
f'(x) = \lim_{h\rightarrow0}\frac{f(x+h)-f(x)}{h}
$$
We will use the letter $e$ next, but assume we do not know its exact value.  In
the problem set, you saw that it's definition is
$$
e = \lim_{h\rightarrow\infty}\left(1+\frac{1}{h}\right)^h
$$
and so right away we see we are dealing with opposite limits.  We can convert
from a limit at infinity to a limit at zero by taking the reciprocal of the variable
at every instance.  This leads to a modified definition of $e$:
$$
e = \lim_{h\rightarrow0}\left(1+\cfrac{1}{\frac{1}{h}}\right)^{\frac{1}{h}}
$$
Armed wth compatible limits, let us return to the definition of a derivative.
$$
(e^x)'  = \lim_{h\rightarrow0}\frac{e^{x+h}-e^x}{h}
$$
By the properties of exponents, a sum in the degree must come
from a multiplication of the bases (i.e. $e^{x+h}=e^x\cdot{}e^h$).
Factoring out $e^x$, we get
$$
(e^x)' = e^x \cdot{}\lim_{h\rightarrow0}\frac{e^h-1}{h}
$$
Will our definition of $e$ work here?  Substituting it in is very messy, but cleans up
perfectly.  Just evaluating the limit,
\begin{align*}
	\lim_{h\rightarrow0} & \frac{\left[\left(1+\cfrac{1}{\frac{1}{h}}\right)^{\frac{1}{h}}\right]-1}{h} &\\
	& \frac{1+\left(\cfrac{1}{\frac{1}{\frac{1}{h}}}\right) - 1}{h} &\\
	& \frac{\cfrac{1}{\frac{1}{h}}}{h} & \Rightarrow \frac{h}{h} \\
	& = 1
\end{align*}

\begin{derivation}{Derivative of $e^x$}
$$
(e^x)' = e^x
$$
\end{derivation}

\personfeature[0in]{\chapdir/pics/Charles_Hermite_circa_1901_edit}{Charles Hermite}{1822
- 1901}{was a French mathematician who did research on number theory,
quadratic forms, invariant theory, orthogonal polynomials, elliptic functions, and algebra.
He was the first to prove that $e$, the base of natural logarithms, is a transcendental number.
His methods were later used by Ferdinand von Lindemann to prove that $\pi$ is transcendental.
\href{https://en.wikipedia.org/wiki/Charles_Hermite}{Wikipedia}}

\subsection{Implications}
How does this explain the behavior of $2^x, 3^x$ or any other base?  The limit portion of
the work shown above was equal to 1, but if we had substituted any other number in,
we would have obtained some constant.  We can extend the definition of exponential
derivative like so:

\begin{derivation}{Derivative of $b^x$}
$$
(b^x)' = b^x \cdot{} \ln{b}
$$
\end{derivation}

Often we will need to apply the Chain Rule, since the exponent is rarely just $x$
$$
\left(e^{f(x)}\right)' = e^{f(x)} \cdot f'(x)
$$

Lastly, if $e^x$ is it's own derivative, then it is its own anti-derivative as well:
$$
\int e^xdx = e^x + C
$$

The TI-8* has an $e^x$ function (2nd-LN) and most computer programs (e.g. MS Excel)
have a function \texttt{exp()}, which is the same thing.

\begin{figure}
\begin{centering}
\includegraphics[width=\textwidth]{\chapdir/pics/exponentialderivatives}
\caption[Exponential tangent lines at (0,1)]{A set of exponential equations tangent lines at (0,1), with original function dotted.  $1.4^x$ in green, $e^x$ in blue, $20^x$ in red.}
\end{centering}
\end{figure}


\chapter{Statistics}

\section{Statistical model}

\index{nonparametric statistical model}%
\index{statistical model!nonparametric}%
A \emph{nonparametric model} is a set of pdfs.
\index{parametric statistical model}%
\index{statistical model!parametric}%
\index{parameter space}%
A \emph{parametric model} \(F : \Theta \to \Omega \to \Real\)
maps a parameter \(\theta\)
to a pdf \(F(\theta)\)
where \(\Theta\) is the type of the \emph{parameter space}.

\section{Point estimation}

\index{point estimation}%
\index{point estimator}%
A \emph{point estimator} \(g : (\RV(\Real))^n \to \RV(\Theta)\)
is a function taking \(n\) iid random variables \(X_1, \ldots, X_n\)
and giving an \emph{estimate} \(\estimate\theta = g(X_1,\ldots,X_n)\) which is also a random variable.

The \emph{sampling distribution} of the estimate is the distribution of the estimate.

The \emph{standard error} of the estimate is the variance of the estimate.

\(\estimate\theta\) is a random variable.
\(\theta\) is an unknown \emph{constant}.

\index{estimate}%
\(\estimate\theta\) is an \emph{estimate} of \(\theta\).
The \emph{bias} of \(g\) is \(\Expect{\estimate\theta} - \theta\).

Estimation assumes that the distribution is \emph{constant} and
that the random variables are iid.

Example:
Checking coin fairness is estimating the parameter of the underlying Bernoulli distribution.
If \(X_1, \ldots, X_n \sim \Bernoulli(p)\) for an unknown \(p\),
then \(p\) can be estimated by \(\hat{p} = g(X_1,\ldots,X_n) = \frac{1}{n} \sum_{k=1}^n X_k\).
As \(n\) grows,
due to the central limit theorem,
the distribution of \(\estimate{p}\) approaches
a normal distribution whose mean is \(p\).

Example:
In Bayesian point estimation,
checking coin fairness is computing \(\Pr(\estimate{p} = \frac{1}{2} | X_1 = x_1, \ldots, X_n = x_n)\).
Assume that \(\estimate{p}\) is uniformly distributed in \([0,1]\).
Assume \(\Pr(h)\), compute \(\Pr(h|d)\), given \(\Pr(d|h)\).

There is no way to find out whether the coin is exactly fair,
but the estimate can always be made more precise by adding data.

\section{Central limit theorem}

The \emph{central limit theorem} is:

The distribution of a sum of iid random variables tends to be normal.

\section{Interval estimation}

Confidence interval is an interval estimation (as opposed to point
estimation) of a parameter.

\section{Hypothesis testing}

\section{Weak law of large numbers}

\emph{Weak law of large numbers}

\section{Regression}

\index{hyperplane!least-squares}%
\index{least-squares!linear regression}%
\index{least-squares!hyperplane}%
\index{least-squares hyperplane}%
\index{linear regression!least-squares}%
\index{regression!linear!least-squares}%
The \emph{least-squares hyperplane} fitting the data
\([(x_1,y_1),\ldots,(x_n,y_n)] : [(\Real^m,\Real)]\)
is the \(f~x = A (x|1)\) that minimizes
\(\sum_{k=1}^n \norm{f~x_k - y_k}^2 \)
where
\(m\) is the number of input variables
and \(n\) is the sample size.
That \(A\) is also the least-squares solution
of \(Z A = Y\)
where \(A\) is the unknown,
\(Z = \bmat{(x_1|1) & \ldots & (x_n|1)}^T\),
\(Y = \bmat{y_1 & \ldots & y_n}^T\).
That hyperplane is the result of
\emph{least-squares linear regression} on the data.

The dictionary meaning of
\index{regression}%
\index{regress}%
``to \emph{regress}'' is ``to go back''
but in statistics it \emph{also} means
``to estimate model parameters from sample''.

\emph{Regression} is ...
\emph{Parametric regression} is ...
\emph{Nonparametric regression} is ...

Elsewhere,
\index{input variable}%
\index{independent variable}%
\index{predictor variable}%
\index{explanatory variable}%
\index{variable!input}%
\index{variable!independent}%
\index{variable!predictor}%
\index{variable!explanatory}%
\emph{input}
variable is also called independent variable, predictor variable, explanatory variable,
and
\index{output variable}%
\index{dependent variable}%
\index{criterion variable}%
\index{variable!output}%
\index{variable!criterion}%
\index{variable!dependent}%
\emph{output} variable is also called dependent variable, criterion variable.

Estimation is computing probability space from a random variable.
Estimation is computing the parameters of the distribution from a distribution family and some samples.
An estimation is \emph{parametric} iff the shape of the probability measure function is known.

Law of the unconscious statistician / law of the lazy statistician

Modeling is computing the population probability space from some samples?

Some statistical problems:
\begin{enumerate*}[label={(\arabic*)}]
    \item Given distribution, generate samples.
    \item
Given a population and a sample, compute the probability that
the sample was indeed taken from the population.
\end{enumerate*}

\section{Tikhonov regularization}

\emph{Tikhonov regularization} is ...

\section{Sobolev spaces}

\index{Sobolev space}%
An example of \emph{Sobolev spaces} is \( \{ f ~|~ \int_\Real (x \to (f''(x))^2) < \infty \} \).


\documentclass[12pt]{article}
\usepackage[margin=2cm]{geometry}
\usepackage{amsmath}
\usepackage{slashed}
\usepackage{tikz} % includes graphicx

\begin{document}

\noindent
Electron positron annihilation creates two photons.
\begin{center}
\begin{tikzpicture}
\draw[dashed] (0,0) circle (0.5cm);
\draw[thick,->] (2,0) node[anchor=west] {$e^+$} -- (0.6,0);
\draw[thick,->] (-2,0) node[anchor=east] {$e^-$} -- (-0.6,0);
\draw[thick,->] (0.40,0.40) -- (1.3,1.3) node[anchor=south west] {$\gamma$};
\draw[thick,->] (-0.4,-0.4) -- (-1.3,-1.3) node[anchor=north east] {$\gamma$};
\draw (1,0.5) node {$\theta$};
\end{tikzpicture}
\end{center}

\noindent
Here is the same diagram with momentum and spinor labels.
\begin{center}
\begin{tikzpicture}
\draw[dashed] (0,0) circle (0.5cm);
\draw[thick,->] (2,0) node[anchor=west] {$p_2, v_2$} -- (0.6,0);
\draw[thick,->] (-2,0) node[anchor=east] {$p_1, u_1$} -- (-0.6,0);
\draw[thick,->] (0.40,0.40) -- (1.3,1.3) node[anchor=south west] {$p_3$};
\draw[thick,->] (-0.4,-0.4) -- (-1.3,-1.3) node[anchor=north east] {$p_4$};
\draw (1,0.5) node {$\theta$};
\end{tikzpicture}
\end{center}

\noindent
In a typical collider experiment the momentum vectors are
\begin{equation*}
\underset{\text{inbound electron}}
{p_1=\begin{pmatrix}E\\0\\0\\p\end{pmatrix}}
\quad
\underset{\text{inbound positron}}
{p_2=\begin{pmatrix}E\\0\\0\\-p\end{pmatrix}}
\quad
\underset{\text{outbound photon}}
{p_3=\begin{pmatrix}E\\ E\sin\theta\cos\phi\\ E\sin\theta\sin\phi\\ E\cos\theta\end{pmatrix}}
\quad
\underset{\text{outbound photon}}
{p_4=\begin{pmatrix}E\\ -E\sin\theta\cos\phi\\ -E\sin\theta\sin\phi\\ -E\cos\theta\end{pmatrix}}
\end{equation*}

\noindent
Symbol $p$ is incident momentum,
$E$ is total energy $E=\sqrt{p^2+m^2}$,
and $m$ is electron mass.
Polar angle $\theta$ is the observed scattering angle.
Azimuth angle $\phi$ cancels out in scattering calculations.

\bigskip
\noindent
The spinors are
\begin{equation*}
\underset{\text{inbound electron, spin up}}
{u_{11}=\begin{pmatrix}E+m\\0\\p\\0\end{pmatrix}}
\quad
\underset{\text{inbound electron, spin down}}
{u_{12}=\begin{pmatrix}0\\E+m\\0\\-p\end{pmatrix}}
\quad
\underset{\text{inbound positron, spin up}}
{v_{21}=\begin{pmatrix}-p\\0\\E+m\\0\end{pmatrix}}
\quad
\underset{\text{inbound positron, spin down}}
{v_{22}=\begin{pmatrix}0\\p\\0\\E+m\end{pmatrix}}
\end{equation*}

\noindent
The spinors shown above are not individually normalized.
Instead, a combined spinor normalization constant $N=(E+m)^2$ will be used.

\bigskip
\noindent
The following formula computes a probability density $|\mathcal{M}_{ab}|^2$
for annihilation where $a$ is the spin state of the inbound electron and
$b$ is the spin state of the inbound positron.
The formula is from Feynman diagrams.
\begin{equation*}
|\mathcal{M}_{ab}|^2
=
\frac{e^4}{N}
\left|
-\frac{\bar{v}_{2b}\gamma^\mu(\slashed{q}_1+m)\gamma^\nu u_{1a}}{t-m^2}
-\frac{\bar{v}_{2b}\gamma^\nu(\slashed{q}_2+m)\gamma^\mu u_{1a}}{u-m^2}
\right|^2
\end{equation*}

\noindent
Symbol $e$ is electron charge and
\begin{align*}
q_1&=p_1-p_3
\\
q_2&=p_1-p_4
\end{align*}
Symbols $t$ and $u$ are Mandelstam variables
\begin{align*}
t&=q_1^2=(p_1-p_3)^2
\\
u&=q_2^2=(p_1-p_4)^2
\end{align*}

\noindent
Let
\begin{equation*}
a_1=\bar{v}_{2b}\gamma^\mu(\slashed{q}_1+m)\gamma^\nu u_{1a}
\qquad
a_2=\bar{v}_{2b}\gamma^\nu(\slashed{q}_2+m)\gamma^\mu u_{1a}
\end{equation*}

\noindent
Then
\begin{align*}
|\mathcal{M}_{ab}|^2&=\frac{e^4}{N}\left|-\frac{a_1}{t-m^2}-\frac{a_2}{u-m^2}\right|^2\\
&=
\frac{e^4}{N}
\left(-\frac{a_1}{t-m^2}-\frac{a_2}{u-m^2}\right)
\left(-\frac{a_1}{t-m^2}-\frac{a_2}{u-m^2}\right)^*\\
&=
\frac{e^4}{N}\left(
\frac{a_1a_1^*}{(t-m^2)^2}
+\frac{a_1a_2^*}{(t-m^2)(u-m^2)}
+\frac{a_1^*a_2}{(t-m^2)(u-m^2)}
+\frac{a_2a_2^*}{(u-m^2)^2}
\right)
\end{align*}

\noindent
The expected probability density $\langle|\mathcal{M}|^2\rangle$
is computed by summing $|\mathcal{M}_{ab}|^2$ over all spin and polarization states
and then dividing by the number of inbound states.
There are four inbound states.
The sum over polarization states is already accomplished by contraction
of $aa^*$ over $\mu$ and $\nu$.
\begin{align*}
\langle|\mathcal{M}|^2\rangle
&=\frac{1}{4}\sum_{a=1}^2\sum_{b=1}^2|\mathcal{M}_{ab}|^2\\
&=\frac{e^4}{4N}\sum_{a=1}^2\sum_{b=1}^2
\left(
\frac{a_1a_1^*}{(t-m^2)^2}
+\frac{a_1a_2^*}{(t-m^2)(u-m^2)}
+\frac{a_1^*a_2}{(t-m^2)(u-m^2)}
+\frac{a_2a_2^*}{(u-m^2)^2}
\right)
\end{align*}

\noindent
Use the Casimir trick to replace sums over spins with matrix products.
\begin{align*}
f_{11}&=\frac{1}{N} \sum_{a=1}^2\sum_{b=1}^2 a_1a_1^*=\mathop{\rm Tr}
\left(
(\slashed{p}_1+m)\gamma^\mu(\slashed{q}_1+m)\gamma^\nu(\slashed{p}_2-m)\gamma_\nu(\slashed{q}_1+m)\gamma_\mu
\right)
\\
f_{12}&=\frac{1}{N} \sum_{a=1}^2\sum_{b=1}^2 a_1a_2^*=\mathop{\rm Tr}
\left(
(\slashed{p}_1+m)\gamma^\mu(\slashed{q}_2+m)\gamma^\nu(\slashed{p}_2-m)\gamma_\mu(\slashed{q}_1+m)\gamma_\nu
\right)
\\
f_{22}&=\frac{1}{N} \sum_{a=1}^2\sum_{b=1}^2 a_2a_2^*=\mathop{\rm Tr}
\left(
(\slashed{p}_1+m)\gamma^\mu(\slashed{q}_2+m)\gamma^\nu(\slashed{p}_2-m)\gamma_\nu(\slashed{q}_2+m)\gamma_\mu
\right)
\end{align*}

\noindent
Hence
\begin{equation*}
\langle|\mathcal{M}|^2\rangle
=
\frac{e^4}{4}
\left(
\frac{f_{11}}{(t-m^2)^2}
+\frac{f_{12}}{(t-m^2)(u-m^2)}
+\frac{f_{12}^*}{(t-m^2)(u-m^2)}
+\frac{f_{22}}{(u-m^2)^2}
\right)
\end{equation*}

\noindent
Run ``annihilation-1.txt'' to verify the Casimir trick for electron positron annihilation.

\bigskip
\noindent
The following formulas are equivalent to the Casimir trick.
(Recall that $a\cdot b=a^\mu g_{\mu\nu}b^\nu$)
\begin{align*}
f_{11}&=
 32 (p_1 \cdot p_3) (p_1 \cdot p_4) -
 32 m^2 (p_1 \cdot p_2) +
 64 m^2 (p_1 \cdot p_3) +
 32 m^2 (p_1 \cdot p_4) - 64 m^4
\\
f_{12}&=
 16 m^2 (p_1 \cdot p_3) +
 16 m^2 (p_1 \cdot p_4) - 32 m^4
\\
f_{22}&=
 32 (p_1 \cdot p_3) (p_1 \cdot p_4) -
 32 m^2 (p_1 \cdot p_2) +
 32 m^2 (p_1 \cdot p_3) +
 64 m^2 (p_1 \cdot p_4) - 64 m^4
\end{align*}

\noindent
In Mandelstam variables
\begin{align*}
s&=(p_1+p_2)^2
\\
t&=(p_1-p_3)^2
\\
u&=(p_1-p_4)^2
\end{align*}
the formulas are
\begin{align*}
f_{11}&=8 t u - 24 t m^2 - 8 u m^2 - 8 m^4
\\
f_{12}&=8 s m^2 - 32 m^4
\\
f_{22}&=8 t u - 8 t m^2 - 24 u m^2 - 8 m^4
\end{align*}

\noindent
Run ``annihilation-2.txt'' to verify.

\subsection*{High energy approximation}
When $E\gg m$ a useful approximation is to set $m=0$ and obtain
\begin{align*}
f_{11}&=8tu
\\
f_{12}&=0
\\
f_{22}&=8tu
\end{align*}

\noindent
Hence
\begin{align*}
\langle|\mathcal{M}|^2\rangle
&=
\frac{e^4}{4}
\left(
\frac{8tu}{t^2}
+\frac{8tu}{u^2}
\right)
\\
&=
2e^4
\left(
\frac{u}{t}
+\frac{t}{u}
\right)
\end{align*}

\noindent
For $m=0$ the Mandelstam variables are
\begin{align*}
s&=4E^2\\
t&=-2E^2(1-\cos\theta)
\\
u&=-2E^2(1+\cos\theta)
\end{align*}

\noindent
Hence
\begin{equation*}
\langle|\mathcal{M}|^2\rangle
=2e^4\left(
\frac{1+\cos\theta}{1-\cos\theta}+
\frac{1-\cos\theta}{1+\cos\theta}
\right)
\end{equation*}

\subsection*{Cross section}
The differential cross section is
\begin{equation*}
\frac{d\sigma}{d\Omega}=\frac{\langle|\mathcal{M}|^2\rangle}{64\pi^2s}
=
\frac{e^4}{32\pi^2s}
\left(
\frac{1+\cos\theta}{1-\cos\theta}+
\frac{1-\cos\theta}{1+\cos\theta}
\right),\quad s\gg m
\end{equation*}

\noindent
Substituting $e^4=16\pi^2\alpha^2$ yields
\begin{equation*}
\frac{d\sigma}{d\Omega}
=
\frac{\alpha^2}{2s}
\left(
\frac{1+\cos\theta}{1-\cos\theta}+
\frac{1-\cos\theta}{1+\cos\theta}
\right)
\end{equation*}

\noindent
We can integrate $d\sigma$ to obtain a cumulative distribution function.
Recall that
\begin{equation*}
d\Omega=\sin\theta\,d\theta\,d\phi
\end{equation*}

\noindent
Hence
\begin{equation*}
d\sigma=
\frac{\alpha^2}{2s}
\left(
\frac{1+\cos\theta}{1-\cos\theta}+
\frac{1-\cos\theta}{1+\cos\theta}
\right)\sin\theta\,d\theta\,d\phi
\end{equation*}

\noindent
Let $I(\theta)$ be the following integral of $d\sigma$.
\begin{align*}
I(\theta)&=
\frac{2s}{2\pi\alpha^2}
\int_0^{2\pi}\int d\sigma
\\
&=\int
\left(
\frac{1+\cos\theta}{1-\cos\theta}+
\frac{1-\cos\theta}{1+\cos\theta}
\right)
\sin\theta\,d\theta,
\quad a\le\theta\le\pi-a
\end{align*}

\noindent
Angular support is limited to an arbitrary $a>0$
because $I(0)$ and $I(\pi)$ are undefined.
Assume that $I(\theta)-I(a)$ is computable given $\theta$ by either symbolic
or numerical integration.

\bigskip
\noindent
Let $C$ be the normalization constant
\begin{equation*}
C=I(\pi-a)-I(a)
\end{equation*}

\noindent
Then the cumulative distribution function $F(\theta)$ is
\begin{equation*}
F(\theta)=\frac{I(\theta)-I(a)}{C},
\quad a\le\theta\le\pi-a
\end{equation*}

\noindent
The probability of observing scattering events in the interval
$\theta_1$ to $\theta_2$ can now be computed.
\begin{equation*}
P(\theta_1\le\theta\le\theta_2)=F(\theta_2)-F(\theta_1)
\end{equation*}

\noindent
Probability density function $f(\theta)$ is the derivative of $F(\theta)$.
\begin{equation*}
f(\theta)=\frac{dF(\theta)}{d\theta}=\frac{1}{C}
\left(
\frac{1+\cos\theta}{1-\cos\theta}+
\frac{1-\cos\theta}{1+\cos\theta}
\right)\sin\theta,
\quad a\le\theta\le\pi-a
\end{equation*}

\noindent
Run ``annihilation-4.txt" to plot $f(\theta)$ for $a=\pi/6=30^\circ$.

\begin{center}
\includegraphics[scale=0.5]{annihilation.png}
\end{center}

\noindent
Probability distribution for $30^\circ$ bins ($a=30^\circ$).

\begin{center}
\begin{tabular}{|c|c|c|}
\hline
$\theta_1$ & $\theta_2$ & $P(\theta_1\le\theta\le\theta_2)$\\
\hline
$0^\circ$ & $30^\circ$ & -- \\
$30^\circ$ & $60^\circ$ & 0.33 \\
$60^\circ$ & $90^\circ$ & 0.17 \\
$90^\circ$ & $120^\circ$ & 0.17 \\
$120^\circ$ & $150^\circ$ & 0.33 \\
$150^\circ$ & $180^\circ$ & -- \\
\hline
\end{tabular}
\end{center}

\subsection*{Data from DESY PETRA experiment}
\noindent
See www.hepdata.net/record/ins191231, Table 2, 14.0 GeV.

\begin{center}
\begin{tabular}{|c|c|}
\hline
$x$ & $y$\\
\hline
$0.0502$ & 0.09983\\
$0.1505$ & 0.10791\\
$0.2509$ & 0.12026\\
$0.3512$ & 0.13002\\
$0.4516$ & 0.17681\\
$0.5521$ & 0.1957\phantom{0}\\
$0.6526$ & 0.279\phantom{00}\\
$0.7312$ & 0.33204\\
\hline
\end{tabular}
\end{center}

\noindent
Data $x$ and $y$ have the following relationship
with the differential cross section formula.
\begin{equation*}
x=\cos\theta
\qquad
y=\frac{d\sigma}{d\Omega}
\end{equation*}

\noindent
To compute predicted values $\hat{y}$ from the cross section formula,
use $s=(14.0\,\text{GeV})^2$.
Multiply by $(\hbar c)^2$ to convert to SI
and multiply by $10^{37}$ to convert square meters to nanobarns.
\begin{equation*}
\hat{y}
=
\frac{\alpha^2}{2s}
\left(
\frac{1+x}{1-x}+
\frac{1-x}{1+x}
\right)
\times(\hbar c)^2
\times10^{37}
\end{equation*}

\noindent
The following table shows predicted values $\hat{y}$.

\begin{center}
\begin{tabular}{|c|c|c|}
\hline
$x$ & $y$ & $\hat{y}$\\
\hline
$0.0502$ & 0.09983 & 0.106325\\
$0.1505$ & 0.10791 & 0.110694\\
$0.2509$ & 0.12026 & 0.120005\\
$0.3512$ & 0.13002 & 0.135559\\
$0.4516$ & 0.17681 & 0.159996\\
$0.5521$ & 0.1957\phantom{0} & 0.198562\\
$0.6526$ & 0.279\phantom{00} & 0.262745\\
$0.7312$ & 0.33204 & 0.348884\\
\hline
\end{tabular}
\end{center}

\noindent
The coefficient of determination $R^2$ measures how well predicted values fit the real data.
\begin{equation*}
R^2=1-\frac{\sum(y-\hat{y})^2}{\sum(y-\bar{y})^2}=0.98
\end{equation*}

\noindent
The result indicates that the model $d\sigma$ explains 98\% of the variance in the data.

\bigskip
\noindent
Run ``annihilation-3.txt'' to verify.

\subsection*{Notes}
Here are some notes on how the Eigenmath scripts work.

\bigskip
\noindent
To convert $a_1$ and $a_2$ to Eigenmath code,
it is instructive to write $a_1$ and $a_2$ in full component form.
\begin{equation*}
a_1^{\mu\nu}
=\bar{v}_{2\alpha}\gamma^{\mu\alpha}{}_\beta(\slashed{q}_1+m)^\beta{}_\rho\gamma^{\nu\rho}{}_\sigma u_1^\sigma
\qquad
a_2^{\nu\mu}
=\bar{v}_{2\alpha}\gamma^{\nu\alpha}{}_\beta(\slashed{q}_2+m)^\beta{}_\rho\gamma^{\mu\rho}{}_\sigma u_1^\sigma
\end{equation*}

\noindent
Transpose the $\gamma$ tensors to form inner products over $\alpha$ and $\rho$.
\begin{equation*}
a_1^{\mu\nu}
=\bar{v}_{2\alpha}\gamma^{\alpha\mu}{}_\beta(\slashed{q}_1+m)^\beta{}_\rho\gamma^{\rho\nu}{}_\sigma u_1^\sigma
\qquad
a_2^{\nu\mu}
=\bar{v}_{2\alpha}\gamma^{\alpha\nu}{}_\beta(\slashed{q}_2+m)^\beta{}_\rho\gamma^{\rho\mu}{}_\sigma u_1^\sigma
\end{equation*}

\noindent
Convert transposed $\gamma$ to Eigenmath code.
\begin{equation*}
\gamma^{\alpha\mu}{}_\beta
\quad\rightarrow\quad
\text{\tt gammaT = transpose(gamma)}
\end{equation*}

\noindent
Then to compute $a_1$ we have
\begin{multline*}
a_1=\bar{v}_{2\alpha}\gamma^{\alpha\mu}{}_\beta(\slashed{q}_1+m)^\beta{}_\rho\gamma^{\rho\nu}{}_\sigma u_1^\sigma
\\
\rightarrow\quad
\text{\tt a1 = dot(v2bar[s2],gammaT,qslash1 + m I,gammaT,u1[s1])}
\end{multline*}

\noindent
where $s_1$ and $s_2$ are spin indices.
Similarly for $a_2$ we have
\begin{multline*}
a_2=\bar{v}_{2\alpha}\gamma^{\alpha\mu}{}_\beta(\slashed{q}_2+m)^\beta{}_\rho\gamma^{\rho\nu}{}_\sigma u_1^\sigma
\\
\rightarrow\quad
\text{\tt a2 = dot(v2bar[s2],gammaT,qslash2 + m I,gammaT,u1[s1])}
\end{multline*}

\noindent
In component notation the product $a_1a_1^*$ is
\begin{equation*}
a_1a_1^*=a_1^{\mu\nu}a_1^{*\mu\nu}
\end{equation*}

\noindent
To sum over $\mu$ and $\nu$ it is necessary to lower indices with the metric tensor.
Also, transpose $a_1^*$ to form an inner product with $\nu$.
\begin{equation*}
a_1a_1^*=a_1^{\mu\nu}a_{1\nu\mu}^*
\end{equation*}

\noindent
Convert to Eigenmath code.
The dot function sums over $\nu$ and the contract function sums over $\mu$.
\begin{equation*}
a_1a_1^*
\quad\rightarrow\quad
\text{\tt a11 = contract(dot(a1,gmunu,transpose(conj(a1)),gmunu))}
\end{equation*}

\noindent
Similarly for $a_2a_2^*$ we have
\begin{equation*}
a_2a_2^*
\quad\rightarrow\quad
\text{\tt a22 = contract(dot(a2,gmunu,transpose(conj(a2)),gmunu))}
\end{equation*}

\noindent
The product $a_1a_2^*$ does not require a transpose because $a_2=a_2^{\nu\mu}$.
\begin{equation*}
a_1^{\mu\nu}a_{2\nu\mu}^*
\quad\rightarrow\quad
\text{\tt a12 = contract(dot(a1,gmunu,conj(a2),gmunu))}
\end{equation*}

\noindent
In component notation, a trace operator becomes a sum over an index, in this case $\alpha$.
\begin{align*}
f_{11}
&=
\mathop{\rm Tr}
\left(
(\slashed{p}_1+m)\gamma^\mu(\slashed{q}_1+m)\gamma^\nu(\slashed{p}_2-m)\gamma_\nu(\slashed{q}_1+m)\gamma_\mu
\right)\\
&=
(\slashed{p}_1+m)^\alpha{}_\beta
\gamma^{\mu\beta}{}_\rho
(\slashed{q}_1+m)^\rho{}_\sigma
\gamma^{\nu\sigma}{}_\tau
(\slashed{p}_2-m)^\tau{}_\delta
\gamma_\nu{}^\delta{}_\eta
(\slashed{q}_1+m)^\eta{}_\xi
\gamma_\mu{}^\xi{}_\alpha
\end{align*}

\noindent
As before, transpose $\gamma$ tensors to form inner products.
\begin{equation*}
f_{11}=
(\slashed{p}_1+m)^\alpha{}_\beta
\gamma^{\beta\mu}{}_\rho
(\slashed{q}_1+m)^\rho{}_\sigma
\gamma^{\sigma\nu}{}_\tau
(\slashed{p}_2-m)^\tau{}_\delta
\gamma^\delta{}_{\nu\eta}
(\slashed{q}_1+m)^\eta{}_\xi
\gamma^\xi{}_{\mu\alpha}
\end{equation*}

\noindent
This is the code for transposing $\gamma$.
\begin{align*}
\gamma^{\beta\mu}{}_\beta
&\quad\rightarrow\quad
\text{\tt gammaT = transpose(gamma)}
\\
\gamma^\delta{}_{\nu\eta}
&\quad\rightarrow\quad
\text{\tt gammaL = transpose(dot(gmunu,gamma))}
\end{align*}

\noindent
To convert $f_{11}$ to Eigenmath code, use an intermediate variable $T$ for the inner product.
\begin{equation*}
T^{\alpha\mu\nu}{}_{\nu\mu\alpha}
\quad\rightarrow\quad
\text{\tt T = dot(P1,gammaT,Q1,gammaT,P2,gammaL,Q1,gammaL)}
\end{equation*}

\noindent
Now sum over the indices of $T$.
The innermost contract sums over $\nu$ then the next contract sums over $\mu$.
Finally the outermost contract sums over $\alpha$.
\begin{equation*}
f_{11}\quad\rightarrow\quad
\text{\tt f11 = contract(contract(contract(T,3,4),2,3))}
\end{equation*}

\noindent
Follow suit for $f_{22}$.
For $f_{12}$ the order of the rightmost $\mu$ and $\nu$ is reversed.
\begin{equation*}
f_{12}=\mathop{\rm Tr}
\left(
(\slashed{p}_1+m)\gamma^\mu(\slashed{q}_2+m)\gamma^\nu(\slashed{p}_2-m)\gamma_\mu(\slashed{q}_1+m)\gamma_\nu
\right)
\end{equation*}

\noindent
The resulting inner product is $T^{\alpha\mu\nu}{}_{\mu\nu\alpha}$
so the contraction is different.
\begin{equation*}
f_{12}
\quad\rightarrow\quad
\text{\tt f12 = contract(contract(contract(T,3,5),2,3))}
\end{equation*}

\noindent
The innermost contract sums over $\nu$ followed by sum over $\mu$ then sum over $\alpha$.

\end{document}


\subsection{Price preferences}

We start with a simple model, where the customer has price preference.

\(U_{ij}=-\beta_i p_{ij} +\epsilon_{ij}\)

\subsection{Product characteristics}

\(U_{ij}=\alpha_i x_j -\beta_i p_{ij} +\epsilon_{ij}\)

\subsection{Individual characteristics}

\(U_{ij}=\alpha_i x_j -\beta_i p_{ij} + \theta_j d_i +\epsilon_{ij}\)

\subsection{The general form}

We can convert this to the form:

\(U_{ij}=\Theta z_{ij} + \epsilon_{ij}\)


\subsubsection{Labeled Generic Time Series Model} \label{labeled_generic_time_series_model}
A generic time series model was created for the evaluating software. A generic time series over the domain set
$\mathbb{U}$ is a linked list of data points. Those data points are containing a generic data object and an
optional label. The generic object has to be an element of the domain set $\mathbb{U}$. In the case of the carried out
experiment a data point contains the acceleration data of the x-axis, the y-axis and z-axis. Therefore $\mathbb{U}$ is
similar to $\mathbb{Z}^3$ or better $\mathbb{R}^3$. $\mathbb{U}$ is the set of vectors containing three integer
values and the distance function $d$ on $\mathbb{U}$ is the euclidean distance
$\sqrt[2]{(x_1 - x_2)^2 + (y_1 - y_2)^2 + (z_1 - z_2)^2}$. The generic approach for the implemented time series model
and the time series measures should make it easier to evaluate similar experiments on other domains. A label of a data
point is used to mark a data point as part of a gesture.