\documentclass[11pt]{amsart}
\usepackage{amssymb, amsmath, amsfonts, amsthm, booktabs,graphicx}
\usepackage[abbrev]{amsrefs}
%\usepackage[notref]{showkeys}
\usepackage[margin=0.8 in]{geometry}
\usepackage[colorlinks=true, linkcolor=blue]{hyperref}
\usepackage[shortlabels]{enumitem}
        
\def \k {K\"ahler }
\def \s {Szeg\H{o} }
\def \d {\partial}
\def \y {{\tilde{y}}}
\def \dbar {\oo\partial}
\def \dd {\partial}
\def \dt {\frac{\partial}{\partial t}}
\def \eps {\varepsilon}
\def \v {\vec{\mathbf{v}}}
\def \u {\vec{\mathbf{u}}}
\def \w {\vec{\mathbf{w}}}
\def \Erf{\mathcal{E}\text{rf}}
\DeclareMathOperator{\Tr}{Tr} 
\DeclareMathOperator{\Ric}{Ric}
\DeclareMathOperator{\Real}{Re}
\DeclareMathOperator{\Sym}{Sym}
\DeclareMathOperator{\vol}{vol}
\DeclareMathOperator{\Hess}{Hess}
\DeclareMathOperator{\Rm}{Rm}
\DeclareMathOperator{\osc}{osc}
\DeclareMathOperator{\id}{id}
\DeclareMathOperator{\sn}{sn}
\DeclareMathOperator{\cs}{cs}
\DeclareMathOperator{\tn}{tn}
\DeclareMathOperator{\dist}{dist}
\DeclareMathOperator{\Dom}{Dom}
\DeclareMathOperator{\Rng}{Rng}
\DeclareMathOperator{\diver}{div}
\DeclareMathOperator{\rot}{rot}
\DeclareMathOperator{\curl}{curl}
\DeclareMathOperator{\grad}{grad}

\newcommand{\oo}[1]{\overline{#1}}
\newcommand{\f}[2]{\frac{#1}{#2}}
\newtheorem{claim}{Claim}
\newtheorem{aside}{Aside}
%\newtheorem{example}{Example}

\title{Lecture Notes for Math 124A\\ Partial Differential Equations}
\author{S. Seto}
\date{}


\theoremstyle{definition} 
\newtheorem{definition}{Definition}[section]
\newtheorem{conjecture}{Conjecture}[section]
\newtheorem{example}{Example}[section]
\newtheorem{lemma}{Lemma}[section]
\newtheorem{remark}{Remark}[section]
\newtheorem{question}{Question}[section]
\newtheorem{proposition}{Proposition}[section]
\newtheorem{theorem}{Theorem}[section]
\newtheorem{corollary}{Corollary}[section]
\newtheorem*{notation}{Notation}

\begin{document}
\maketitle

\section{Motivation for PDEs}
\subsection{What are PDEs?}
An algebraic equation is an equation which only involves algebraic operations, e.g. $x^2-1 = 0$. One can easily solve for this equation, with solutions $x = 1$ and $x=-1$.  Note here that a solution is not necessarily unique.  Sometimes, there may not even exist a solution in the domain of definition, say the real numbers and the equation $x^2+1=0$.   Now if we allow the operation of taking a derivative, we obtain a \textbf{differential equation}, e.g. $\frac{dy}{dx} = 2y$.   One can again solve for this equation, that is, find an explicit function $y = f(x)$ such that the equation is satisfied.  In this case, $y = e^{2x}$ is one such solution.  Another possibility is $y=2e^{2x}$.  We see again that a solution may not be unique.  Establishing existence to differential equations is quite difficult and we study certain cases separately.   In this class, we will focus on \textbf{partial differential equations (PDE)} and within them, a very particular class of them.  A key defining property of PDEs is that there is more than one independent variable (compared to \textbf{ordinary differential equation (ODE)} which only has one).  We will use the subscript notation for derivatives: for example let $u(x,y)$ be function of two variables
\begin{align*}
u_x &:= \frac{\dd u}{\dd x}, \quad
u_y := \frac{\dd u}{\dd y},\\
u_{xy} &:= \frac{\dd^2 u}{\dd x\dd y},\quad 
u_{xxx} := \frac{\dd^3 u}{(\dd x)^3}.
\end{align*}
\begin{example}
Some examples of PDEs with their names
\begin{enumerate}
\item $u_x+u_y=0$ \quad Transport equation,
\item $u_x+yu_y = 0$ \quad Transport equation,
\item $u_x+uu_y=0$ \quad Shock wave equation,
\item $u_{xx}+u_{yy}=0$ \quad Laplace equation,
\item $u_t-u_{xx}=0$ \quad Heat equation,
\item $u_{tt}-u_{xx}=0$ \quad Wave equation,
\item $u_{tt}-u_{xx}+u^3=0$ \quad Wave with interaction.
\end{enumerate}
\end{example}
We now begin categorizing them.   We say a PDE has \textbf{order $n$} if the maximum number of derivatives we take on a function is $n$ times.  Therefore, equations 1 through 3 are \textbf{order 1 (first order)} and equations 4 through 7 are \textbf{order 2 (second order)}.  Next we introduce the concept of \textbf{linearity}.  Recall from linear algebra that a \textbf{linear operator} $\mathcal{L}:V\to V$ is a mapping from a vector space to a vector such that
\begin{equation}\label{linear}
\mathcal{L}(cu+v) = c\mathcal{L}(u)+\mathcal{L}(v)
\end{equation}
for all vectors $u,v \in V$ and scalars $c$.  If we consider $V$ as the vector space of sufficiently differentiable functions, then we can view some PDEs as solutions to the linear equation $\mathcal{L}(u)=0$.  For instance, let
\begin{equation*}
\mathcal{L}= \frac{\dd}{\dd x} + y\frac{\dd}{\dd y}.
\end{equation*}
Then equation 2 can be rewritten as
\begin{equation*}
u_x+yu_y = \mathcal{L}(u) = 0.
\end{equation*}
One can verify that the linearity property \eqref{linear} is satisfied. 
\begin{example}[Not linear]
Equation 3 is not linear since 
\begin{align*}
\mathcal{L}[u+v] &= (u+v)_x+(u+v)(u+v)_y \\
&=u_x+v_x+uu_y+uv_y+vu_y+vv_y \\
&=\mathcal{L}(u)+\mathcal{L}(v)+uv_y+vu_y.
\end{align*}
\end{example}
PDEs come in two types: \textbf{homogenenous} and \textbf{nonhomogeneous}.  When the right hand side of the equality is 0, we say the equation is \textbf{homogenous}, otherwise it is \textbf{nonhomogenenous}, i.e.
\begin{equation*}
\begin{cases}
\mathcal{L}(u) = 0 & \text{ homogeneous}\\
\mathcal{L}(u) = f(x) \neq 0 & \text{ nonhomogeneous}.
\end{cases}
\end{equation*}
The advantage of a \textbf{homogeneous linear equation} is that if $u$ and $v$ are both solutions to the linear equation $\mathcal{L}(u)=0$, then $u+v$ is also a solution and so are any linear combination of the solutions (\textbf{superposition principle}).

\begin{example}
Find all $u(x,y)$ satisfying the equation $u_{xx}=0$.  It is tempting to simply integrate twice with respect to $x$ to arrive at $u = ax+b$ for some scalar $a,b$.  However, we need to keep in mind that there are two variables $x$ and $y$ so let us integrate more carefully.  If we integrate $u_{xx}$ once with respect to $x$, we get
\begin{equation*}
u_x = ``\text{ constant with respect to }x\text{''}
\end{equation*}
so it could still be function with respect to $y$.  So
\begin{equation*}
u_x = f(y)
\end{equation*}
for some function $y$.  Integrating once more, we have
\begin{equation*}
u(x,y) = f(y)x+g(y)
\end{equation*}
for some function $g$. 
\end{example}

\begin{example}
Find all solution $u(x,y)$ to the PDE $u_{xx}+u=0$.  At first glance, it looks like the ODE $u''+u=0$, which has the solution $u= c_1\cos(x) + c_2\sin(x)$, however the constants again are only constants with respect to $x$ so they could be functions with respect to $y$.  Hence the general solution is
\begin{equation*}
u(x,y) = f(y)\cos(x) + g(y)\sin(x).
\end{equation*}
for some function $f$ and $g$.
\end{example}

\subsection{First order linear equations}
\subsubsection{Constant coefficient}
Consider the PDE
\begin{equation*}
au_x + bu_y = 0,
\end{equation*}
for constants $a,b$ both not zero. We can rewrite this as a directional derivative
\begin{equation*}
\nabla u\cdot \langle a,b\rangle = 0,
\end{equation*}
so that $u$ is \textit{constant} in the direction $\langle a,b\rangle$.  Given a point $(x_0,y_0) \in \mathbb{R}^2$, the equation of a line parallel to the vector $\langle a,b\rangle$ is given by the vectors orthogonal to $\langle a,-b\rangle$ so that
\begin{equation*}
\langle b,-a\rangle \cdot \langle x-x_0,y-y_0\rangle = bx-ay -(bx_0-ay_0)=0,
\end{equation*}
so that $bx-ay = \text{constant}$.  Since the solution $u(x,y)$ is constant along the lines and the different lines are given by the different constant in the equation $bx-ay= \textbf{constant}$, the solution is of the form
\begin{equation*}
u(x,y) = f(bx-ay)
\end{equation*}
for some single variable function $f$. 

Alternatively, we can approach the problem in the following way.  Changing coordinates so that
\begin{equation*}
s= ax+by, \quad t=bx-ay.
\end{equation*}
Then by chain rule
\begin{align*}
\frac{\dd u}{\dd x} &= \frac{\dd u}{\dd s}\frac{\dd s}{\dd x} + \frac{\dd u}{\dd t}\frac{\dd t}{\dd x} = au_s +bu_t \\
\frac{\dd u}{\dd y} &= \frac{\dd u}{\dd s}\frac{\dd s}{\dd y} + \frac{\dd u}{\dd t}\frac{\dd t}{\dd y} = bu_s-au_t.
\end{align*}
Plugging this back in to the equation $au_x+bu_y=0$, we get
\begin{equation*}
a(au_s +bu_t) + b(bu_s-au_t) = (a^2+b^2)u_s=0.
\end{equation*}
Since $a^2+b^2 \neq 0$, we have $u_s=0$ so that by integrating with respect to $s$, we get 
\begin{equation*}
u(x,y) = f(t) = f(bx-ay).
\end{equation*}
\begin{example}
Solve the PDE with auxiliary condition
\begin{equation*}
\begin{cases}
4u_x-3u_y=0\\
u(0,y) = y^3.
\end{cases}
\end{equation*}
The auxiliary condition makes this a \textbf{well-posed problem} (more on this later).  From the discussion above, PDEs of this form have the solution
\begin{equation*}
u(x,y) = f(-3x-4y).
\end{equation*}
Applying the auxiliary condition when $x=0$, we have
\begin{align*}
u(0,y) = f(-4y) = y^3.
\end{align*}
Let $y=-\frac{w}{4}$, then $f(w) = -\frac{w^3}{64}$. Therefore,
\begin{equation*}
u(x,y) = \frac{(3x+4y)^3}{64}.
\end{equation*}
\end{example}

\subsubsection{Variable coefficient}
Next consider the PDE
\begin{equation*}
u_x+yu_y = 0.
\end{equation*}
We can check that the PDE is homogeneous and linear.  As before, we can rewrite this as directional derivative so that
\begin{equation*}
\nabla u\cdot \langle 1, y\rangle = 0.
\end{equation*}
By following how we solved the constant coefficient case, we know that the solution $u(x,y)$ is constant along some curve, whose direction (tangent vector) is given by $\langle 1, y\rangle$.  Suppose for a moment that we can parametrize such a curve by $x$, so that the curve is given by
\begin{equation*}
\gamma(x) = \langle x, y(x)\rangle.
\end{equation*}
Then the tangent vector is given by $\gamma'(x) = \langle 1, y'(x)\rangle$.  On the other hand, we are looking for curves whose tangent vector is $\langle 1, y\rangle$.  This leads us to the equation
\begin{equation*}
\langle 1, y'(x)\rangle = \langle 1, y\rangle,
\end{equation*}
or the ODE
\begin{equation*}
\frac{d y}{d x}= y.
\end{equation*}
The solution is given by $y=Ce^x$, hence the \textbf{characteristic curve} is given by
\begin{equation*}
\gamma(x) = \langle x, Ce^x\rangle.
\end{equation*}
Note that for different constants $C$, the curve $\gamma(x)$ do not intersect.  Now we check that along this curve, the solution is constant: 
\begin{align*}
\frac{\dd}{\dd x}u(x,Ce^x)= u_x+\frac{\dd y}{\dd x}u_y = u_x+Ce^xu_y = u_x+yu_y = 0.
\end{align*}
This shows that the solution along the curve $u(x,Ce^x)$ is \textit{independent of $x$} hence we have
\begin{equation*}
u(x,Ce^x) = u(0,C) = f(C).
\end{equation*}
For different values of $C$, the curves fill out all of $\mathbb{R}^2$ hence, given any $(x,y) \in \mathbb{R}^2$, there exist some $C$ such that $(x,y) = (x,Ce^x)$.  Solving for $C$, we have $C = e^{-x}y$ hence the solution to the PDE is of the form
\begin{equation*}
u(x,y) = f(e^{-x}y).
\end{equation*}

Generalizing this method to PDEs of the form
\begin{align*}
a(x,y)u_x+b(x,y)u_y = 0,
\end{align*}
suppose that $a(x,y) \neq 0$, then the PDE is equivalent to
\begin{equation*}
u_x + \frac{b(x,y)}{a(x,y)}u_y = 0.
\end{equation*}
Consider the curve $\gamma(x) = (x,y(x))$ such that 
\begin{equation*}
\frac{dy}{dx} = \frac{b(x,y)}{a(x,y)}.
\end{equation*}
Then the chain rule gives
\begin{equation*}
\frac{\dd}{\dd x}u(x,y(x)) = u_x + y_xu_y = u_x+\frac{b}{a}u_y=0,
\end{equation*}
so that $u(x,y)$ is constant along the given curve. Hence one can solve transport equations by solving ODEs. 
\begin{example}
Solve the PDE
\begin{equation*}
u_x+2xy^2u_y=0.
\end{equation*}
From the discussion above, we need to solve the ODE
\begin{equation*}
\frac{dy}{dx} = 2xy^2.
\end{equation*}
The solution to the ODE is given by
\begin{equation*}
y=\frac{1}{C-x^2}.
\end{equation*}
Solving for $C$, we get $C=x^2+\frac{1}{y}$ so that the solution is given by
\begin{equation*}
u(x,y) = f\left( x^2 + \frac{1}{y}\right).
\end{equation*}
One can check that the solution satisfies the PDE, however there are some ``bad points'', for instance, what is the value of the solution at $u(x,0)$?  Of course, we would need some auxiliary condition(s) to say anything meaningful and we will discuss more on these potential singular points later.
\end{example}

\subsubsection{General linear first-order}
Now we consider the linear first order problem

\begin{equation*}
a(x,y)u_x+b(x,y)u_y+c(x,y)u=f(x,y).
\end{equation*}
Let us try to find a change of coordinates $(x,y) \to (s,t)$ such that $w(s,t) = u(x(s,t),y(s,t))$ and
\begin{equation*}
w_s+h(s,t)w=F(s,t).
\end{equation*}
Such a transformation would be nice because this amounts to solving a first order ODE in the $s$-variable.

We want to find a transformation such that 
\begin{equation*}
s=s(x,y), \quad t=t(x,y)
\end{equation*}
and we also want to require that this transformation be invertible, at least locally.  A criterion is given by the nonvanishing of the Jacobian of the transformation, i.e.
\begin{equation*}
\det\begin{pmatrix}
s_x & s_y\\
t_x & t_y
\end{pmatrix} \neq 0
\end{equation*}
First we use the chain rule to compute for $u(x,y) = w(s,t)$
\begin{align*}
\frac{\dd u}{\dd x} &= \frac{\dd w}{\dd s}\frac{\dd s}{\dd x} + \frac{\dd w}{\dd t}\frac{\dd t}{\dd x} = w_ss_x+w_tt_x\\
\frac{\dd u}{\dd y} &= \frac{\dd w}{\dd s}\frac{\dd s}{\dd y} + \frac{\dd w}{\dd t}\frac{\dd t}{\dd y} = w_ss_y+w_tt_y.
\end{align*}
Plugging this into the first order PDe, we have
\begin{equation*}
a(w_ss_x+w_tt_x) + b(w_ss_y+w_tt_y) + cw = f.
\end{equation*}
Rearranging terms, we have
\begin{equation*}
(as_x+bs_y)w_s + (at_x+bt_y)w_t+cw=f.
\end{equation*}
So now we want to choose $t$ such that
\begin{equation*}
at_x+bt_y=0.
\end{equation*}
Assuming that $a\neq 0$, this is equivalent to
\begin{equation*}
t_x+\frac{b}{a}t_y=0.
\end{equation*}
Suppose we are on a curve parametrized by $x$ so that $\langle x,y(x)\rangle$ and that
\begin{equation*}
\frac{dy}{dx} = \frac{b(x,y)}{a(x,y)}.
\end{equation*}
Then 
\begin{equation*}
\frac{d}{dx}t(x,y(x)) = t_x+\frac{dy}{dx}t_y = 0,
\end{equation*}
hence $t$ is constant along this characteristic curve.  So using the change of variable $s=x$ and $t=y(x)$, we get
\begin{equation*}
a(s,t)w_s + c(s,t)w=f
\end{equation*}
This can be solved using integrating factors.
\begin{example}
To solve 
\begin{equation*}
u_x + \cos(x)u_y + u = xy.
\end{equation*}
We want to solve the ODE
\begin{equation*}
y' = \cos(x)
\end{equation*}
which has a general solution
\begin{equation*}
y=\sin(x)+C.
\end{equation*}
we use the coordinates $s=x$ and $t=y-\sin(x)$.  With these coordinates, we have
\begin{align*}
u_x &= u_s-\cos(x)u_t\\
u_y &= u_t,
\end{align*}
plugging this back we get
\begin{equation*}
u_s-\cos(x)u_t+\cos(x)u_t+u=xy
\end{equation*}
or
\begin{equation*}
u_s+u = s(t+\sin(s)).
\end{equation*}
Solving this as a linear first-order ODE, we multiply through by the integrating factor to obtain
\begin{equation*}
\frac{\dd}{\dd s}(e^su) = s(t+\sin(s))e^s.
\end{equation*}
Integrating with respect to $s$, we arrive at
\begin{equation*}
e^su = te^s(s-1)+\frac{1}{2}se^s(\sin(s)-\cos(s))+\frac{1}{2}e^s\cos(s)+g(t)
\end{equation*}
Substituting back $x$ and $y$, we have
\begin{equation*}
u(x,y) = (y-\sin(x))(x-1)+\frac{1}{2}x(\sin(x)-\cos(x))+\frac{1}{2}\cos(x)+e^{-x}g(y-\sin(x)).
\end{equation*}
\end{example}

\subsection{Flows, vibrations, and diffusions}
As hinted from the names of the PDE, the equations arise from physical phenomenon.  Here we discuss some of them.  
\begin{example}[Simple transport]
Consider a fluid flowing at a constant rate $c$ along a horizontal pipe of fixed cross section in the positive $x$ direction.  A substance, say a pollutant, is suspended in the water. Let $u(x,t)$ be its concentration in grams/centimeter at time $t$.  The amount of pollutant in the interval $[0,b]$ at time $t$ is given by
\begin{equation*}
M= \int_0^b u(x,t)dx.
\end{equation*}
At a later time, say $t+h$, the same amount moved into the interval $ch,b+ch$ (since the water is flowing at speed $c$. So by conservation of amount, we have
\begin{equation*}
M= \int_0^b u(x,t)dx = \int_{ch}^{b+ch}u(x,t+h)dx.
\end{equation*}
Differentiating with respect to $b$, we have
\begin{equation*}
u(b,t) = u(b+ch,t+h).
\end{equation*}
Differentiating with respect to $h$ and evaluating at $h=0$, we obtain the transport equation
\begin{equation*}
0 = cu_x(b,t) + u_t(b,t).
\end{equation*}
\end{example}

\begin{example}[Vibrating String]
Consider a flexible, elastic homogeneous string or thread of length $L$.  The string is flexible and hence has small vibrations.  Assume that the vibration stays in a plane. Let $u(x,t)$ be its displacement from equilibrium position at time $t$ and position $x$.  Further assume that tension is directed tangentially along the string.  Let $T(x,t)$ be the magnitude of this tension vector.  Let $\rho$ be the density of the string.  The assumption that the vibration is small means that the $|u_x|$ is small.  The force that is exerted on the interval $[x_0,x_1]$ is only the vertical component.  The tension vector is given by $\vec{T} = \langle T\cos(\theta),T\sin(\theta)\rangle$, where $\theta$ is the angle from the equilibrium.  The slope of the tangent vector, and hence the tension vector, is given by $u_x$.  Using Newton's law that force = mass times acceleration, this leads to
\begin{equation*}
\frac{Tu_x}{\sqrt{1+u^2_x}}\biggr|^{x_1}_{x_0} = \int_{x_0}^{x_1}\rho u_{tt}dx
\end{equation*}
and using the face that $u_x$ is small so that $\sqrt{1+u^2_{x}} \approx 1$ and taking $x_1 \to x_0$ gives us the wave equation
\begin{equation*}
u_{tt} = c^2u_{xx}
\end{equation*}
where $c= \sqrt{\frac{T}{\rho}}$.

An alternative way to derive the equation will be given during lecture.
\end{example}

\begin{example}[Diffusion]
Imagine a motionless liquid filling a straight tube or pipe and a dye is diffusing through the liquid.  According to Fick's law of diffusion, the rate of motion is proportional to the concentration gradient.  Let $u(x,t)$ be the concentration of the dye at position $x$ of the pipe at time $t$. The mass of the dye in the section from $x_0$ to $x_1$ is given by
\begin{equation*}
M(t) = \int_{x_0}^{x_1}u(x,t)dx
\end{equation*}
hence the rate of motion is given by
\begin{equation*}
\frac{dM}{dt} = \int_{x_0}^{x_1}u_t(x,t)dx.
\end{equation*}
By Fick's law, 
\begin{equation*}
\frac{dM}{dt} = ku_x(x_1,t)-ku_x(x_0,t) = k\int_{x_0}^{x_1}u_{xx}dx,
\end{equation*}
where $k$ is the proportionality constant. Since this holds for any choice of $x_0$ and $x_1$, we have the \textbf{diffusion equation}
\begin{equation*}
u_t = ku_{xx}.
\end{equation*}
\end{example}



\subsection{Initial and boundary conditions}
To get unique solutions for PDEs, we need to impose auxiliary conditions.  There are two types: initial conditions and boundary conditions.

An \textbf{initial condition} specifies the physical state at a particular time $t_0$.

A \textbf{boundary condition} specifies the state at the boundary of the domain where the PDE should be valid.  There are various types of boundary conditions, the three most common being
\begin{enumerate}
\item Dirichlet: the value of $u$ is specified,
\item Neumann: the normal derivative $\nabla u\cdot \vec{\mathbf{n}}$ is specified,
\item Robin: $\nabla u \cdot \vec{\mathbf{n}} + au$ is specified.  
\end{enumerate}

\subsection{Well-posed problems}
A \textbf{well-posed} problem is a PDE in a domain with auxiliary conditions that satisfy
\begin{enumerate}[(i)]
\item Existence: There exists at least one solution.
\item Uniqueness: There is at most one solution.
\item Stability: The unique solution depends continuously on the initial/boundary data.
\end{enumerate}

\begin{example}[Not well-posed]
Consider Laplace's equation $u_{xx}+u_{yy}=0$ on the half-plane $D=\mathbb{R}\times (0,\infty)$ given by
\begin{equation*}
\begin{cases}
u_{xx}+u_{yy}=0 & \text{ on } \mathbb{R}\times (0,\infty)\\
u(x,0) = 0\\
u_y(x,0) = \eps \sin(\tfrac{x}{\eps}).
\end{cases}
\end{equation*}
A solution is given by 
\begin{equation*}
u(x,y) = \eps^2\sin(\tfrac{x}{\eps})\sinh(\frac{y}{\eps}).
\end{equation*}
Compare this to the PDE
\begin{equation*}
\begin{cases}
v_{xx}+v_{yy}=0 & \text{ on } \mathbb{R}\times (0,\infty)\\
v(x,0) = 0\\
v_y(x,0) = 0.
\end{cases}
\end{equation*}
A solution is given by
\begin{equation*}
v(x,y) = 0.
\end{equation*}
Notice that
\begin{equation*}
|u(x,y)| = \eps^2|\sin(\tfrac{x}{\eps})||\sinh(\tfrac{y}{\eps})|.
\end{equation*}
As $\eps \to 0$ for $y> 0$, the term $\eps^2|\sinh(\tfrac{y}{\eps})| \to \infty$
\end{example}

\begin{example}[Well-posed]
Consider the wave equation
\begin{equation*}
\begin{cases}
u_{tt}-u_{xx} = 0, & \text{ for } \mathbb{R}\times (0,\infty)\\
u(x,0) = 0,\\
u_t(x,0) = 0,
\end{cases}
\end{equation*}
which has a solution $u(x,t) = 0$ and
\begin{equation*}
\begin{cases}
v_{tt}-v_{xx} = 0, & \text{ for } \mathbb{R}\times (0,\infty)\\
v(x,0) = 0,\\
v_t(x,0) = \eps\sin(\tfrac{x}{\eps}),
\end{cases}
\end{equation*}
which has a solution
\begin{equation*}
v(x,t) = \eps^2\sin(\tfrac{x}{\eps})\sin(\tfrac{t}{\eps}).
\end{equation*}
Note that
\begin{equation*}
|v(x,t)-u(x,t)| \leq \eps^2 
\end{equation*}
\end{example}

\subsection{Second-order equations}
A general second-order equation has the form
\begin{equation*}
a_{11}u_{xx}+2a_{12}u_{xy}+a_{22}u_{yy}+a_1u_x+a_2u_y+a_0u=0.
\end{equation*}
There are three types of second order linear equations
\begin{theorem}
By a linear transformation of the independent variables, the equation can be reduced to
\begin{enumerate}
\item \textbf{Elliptic}: If $a_{12}^2 < a_{11}a_{22}$, it is reducible to
\begin{equation*}
u_{xx}+u_{yy} + \text{lower order terms} = 0
\end{equation*}
\item \textbf{Hyperbolic}: If $a_{12}^2 > a_{11}a_{22}$, it is reducible to 
\begin{equation*}
u_{xx}-u_{yy}+\text{lower order terms} = 0.
\end{equation*}
\item \textbf{Parabolic}: If $a_{12}^2=a_{11}a_{22}$, it is reducible to
\begin{equation*}
u_{xx}+\text{lower order terms} = 0.
\end{equation*}
\end{enumerate}
\end{theorem}
\begin{proof}
Assume that $a_{11} > 0$.  By ``completing the square'' of the differential operator $\frac{\dd}{\dd x}$, we can rewrite the general second order equation as
\begin{equation*}
\left(\frac{\dd}{\dd x} + \frac{a_{12}}{a_{11}}\frac{\dd}{\dd y}\right)^2u -\left(\frac{a_{12}}{a_{11}}\frac{\dd}{\dd y}\right)^2u + \frac{a_{22}}{a_{11}}u_{yy} + \frac{a_1}{a_{11}}u_x+\frac{a_2}{a_{11}}u_y+\frac{a_0}{a_{11}}u = 0
\end{equation*}
The second order term in $y$ can be combined so that 
\begin{equation*}
\left(\frac{\dd}{\dd x} + \frac{a_{12}}{a_{11}}\frac{\dd}{\dd y}\right)^2u + \left(\frac{a_{11}a_{22}-a_{12}^2}{a^2_{11}} \right)u_{yy} + \frac{a_1}{a_{11}}u_x+\frac{a_2}{a_{11}}u_y+\frac{a_0}{a_{11}}u = 0
\end{equation*}
\end{proof}

\section{Waves and Diffusions}
\subsection{The Wave Equation}
The wave equation on the real line is given by
\begin{equation*}
u_{tt} - c^2u_{xx} =0.
\end{equation*}
One can do a ``difference of squares'' factorization so that the equation is equivalent to
\begin{equation*}
\left(\frac{\dd}{\dd t}-c\frac{\dd}{\dd x}\right)\left(\frac{\dd}{\dd t}+c\frac{\dd}{\dd x}\right)u = 0.
\end{equation*}
With this decomposition, we can solve it by solving two transport equations.  Let
\begin{equation*}
v= u_t+cu_x.
\end{equation*}
Then $v$ satisfies
\begin{equation*}
v_t-cv_x = 0.
\end{equation*}
Solving the tranport equation of $v$, the solution is of the form
\begin{equation*}
v(x,t) = h(x+ct).
\end{equation*}
Next solve the transport equation
\begin{equation*}
u_t+cu_x = h(x+ct).
\end{equation*}
By computing the characteristic lines, we get that a solution 
\begin{equation*}
u(x,t) = f(x+ct)+g(x-ct),
\end{equation*}
where $f'(s) = \frac{h(s)}{2c}$.

\subsubsection{Initial value problem}
The initial value problem for the wave equation is given by
\begin{equation*}
\begin{cases}
u_{tt}-c^2u_{xx} & \text{ for }-\infty < x < \infty\\
u(x,0) = \phi(x)\\
u_t(x,0) = \psi(x).
\end{cases}
\end{equation*}
The initial value problem has a unique solution.  To find such a solution, we solve by plugging in the auxiliary conditions so that
\begin{equation*}
\phi(x) = f(x)+g(x)
\end{equation*}
or
\begin{equation*}
\phi'(x) = f'(x)+g'(x)
\end{equation*}
and
\begin{equation*}
\psi(x) = cf'(x)-cg'(x).
\end{equation*}
Adding and subtracting the pairs of equations gives us
\begin{equation*}
f' = \frac{1}{2}\left(\phi' + \frac{\psi}{c}\right)
\end{equation*}
and
\begin{equation*}
g' = \frac{1}{2}\left(\phi'-\frac{\psi}{c}\right).
\end{equation*}
Integrating, we have
\begin{equation*}
f(s) = \frac{1}{2}\phi(s) + \frac{1}{2c}\int_0^s\psi + A
\end{equation*}
and
\begin{equation*}
g(r) = \frac{1}{2}\phi(r) - \frac{1}{2c}\int_0^r\psi + B.
\end{equation*}
Plugging this back into the solution, we get
\begin{equation*}
u(x,t) = \frac{1}{2}(\phi(x+ct) + \phi(x-ct)) + \frac{1}{2c}\int_{x-ct}^{x+ct}\psi(s)ds.
\end{equation*}
This solution is due to d'Alembert in 1746.  If in the initial condition, $\phi$ has continuous second derivative and $\psi$ has continuous first derivative, then $u$ will be a \textbf{classical solution} of the wave equation.

\begin{example}[no initial velocity]
Consider the Cauchy problem
\begin{equation*}
u_{tt}-u_{xx}=0 
\end{equation*}
for $-\infty < x < \infty$ and $t>0$, with initial conditions
\begin{equation*}
u(x,0) = \phi(x) =
\begin{cases}
x+1 & -1 \leq x \leq 0,\\
1-x & 0 \leq x \leq 1,\\
0 & |x|>1,
\end{cases}
\end{equation*}
and 
\begin{equation*}
u_t(x,0) = 0.
\end{equation*}
By d'Alembert's formula, the solution is given by
\begin{equation*}
u(x,t) = \frac{1}{2}(\phi(x+t) + \phi(x-t)).
\end{equation*}
Note that the solution is not a \textit{classical solution} since $\phi$ is not continuously second differentiable at two points.  We can still make sense out of the solution by introducing a notion called \textbf{weak solutions}.

We can analyze the behavior for different times $t$ and different position $x$.  One thing to notice is that the wave is traveling in two different directions.

This can be physically interpreted as a string being lifted at $x=0$ and let go.
\end{example}

\begin{example}[no initial position]
Consider the same Cauchy problem as before but with initial conditions
\begin{equation*}
u(x,0) = 0
\end{equation*}
and
\begin{equation*}
u_t(x,0) = \psi(x) = 
\begin{cases}
1 & \text{ if } |x|\leq 1\\
0 & \text{ if } |x| >1.
\end{cases}
\end{equation*}
We can use d'Alembert's formula again to obtain the (weak) solution
\begin{equation*}
u(x,t) = \frac{1}{2}\int_{x-t}^{x+t}\psi(s)ds.
\end{equation*}
Notice that unlike the previous case, the point $x=0$ will not return to the initial position $u=0$, even when $t\to \infty$.  This initial condition can be physically interpreted as a hammer hitting the string, which permanently deformed the string.
\end{example}

\subsection{Causality and Energy}
\subsubsection{Causality}
Analyzing d'Alembert's formula, we can see that the effects of the initial condition affect the points at the speed of the wave $c$, and the initial velocity also spreads out at the speed $c$, hence \textbf{no parts go faster than speed $c$}.  This is called the \textbf{principle of causality} or \textbf{finite speed propagation}.

\subsubsection{Energy}
Suppose an infinite string has constant density $\rho$ and constant tension magnitude $T$.  Then $\rho u_{tt} = Tu_{xx}$.  The \textbf{kinetic energy} is given by $\frac{1}{2}mv^2$.  Hence the kinetic energy of the wave at time $t$ is given by \begin{equation*}
K = \frac{\rho}{2}\int_{-\infty}^\infty (u_t)^2.
\end{equation*}
We need to assume that the initial conditions $\phi$ and $\psi$ are finitely supported (0 outside some interval $[-R,R]$) so that according to the principle of causality, this region spreads at finite speed, hence the integral will be finite. Taking the derivative of the kinetic energy, we have
\begin{equation*}
\frac{\dd K}{\dd t}  = \rho\int_{-\infty}^\infty u_tu_{tt}dx.
\end{equation*}
Substituting in the PDE, we get
\begin{align*}
\frac{\dd K}{\dd t} = T\int_{-\infty}^\infty u_tu_{xx}dx = -T\int_{-\infty}^\infty u_{tx}u_xdx = -\frac{T}{2}\int_{-\infty}^\infty \frac{\dd}{\dd t}(u_x^2)dx.
\end{align*}
Let $P= \frac{T}{2}\int_{-\infty}^\infty u_x^2dx$ and call it \textbf{potential energy}.  The above computation shows that 
\begin{equation*}
\frac{\dd K}{\dd t} + \frac{\dd P}{\dd t} = 0
\end{equation*}
So if we define the \textbf{total energy} as $E= K+P$, then we see that $\frac{\dd E}{\dd t}= 0$, or in other words, total energy is independent of $t$. This is the \textbf{law of conservation of energy}.

The energy method can be used to prove the uniqueness of the solution to the Cauchy problem of the wave equation.  Consider the following
\begin{equation*}
\begin{cases}
u_{tt}-c^2u_{xx}= f(x,t) & \text{ on } -\infty < x <\infty\\
u(x,0) = \phi(x)\\
u_t(x,0) = \psi(x),
\end{cases}
\end{equation*}
where $\phi$ and $\psi$ have finite support.  Let $u$ and $v$ be two solutions.  Then consider the function $w=u-v$.  This function satisfies the following equation
\begin{equation*}
\begin{cases}
w_{tt}-c^2w_{xx} = 0 & \text{ on }-\infty < x < \infty\\
w(x,0) = 0\\
w_t(x,0) = 0.
\end{cases}
\end{equation*}
The energy $E[w](t)$ of $w$ is given by
\begin{equation*}
E[w](t) = \int_{-\infty}^\infty  \frac{\rho}{2}(w_t)^2 + \frac{T}{2}(w_x)^2dx
\end{equation*}
Noting that the wave speed is given by $c=\sqrt\frac{T}{\rho}$, we see that the energy is conserved for all $t$.  Using the initial condition at $t=0$, we have
\begin{equation*}
E[w](0) = 0
\end{equation*}
and hence $E[w](t) = 0$ for all $t$.  This implies that
\begin{equation*}
w_t = 0, \quad w_x = 0,
\end{equation*}
so that $w(x,t) = c$ for some constant.  Using the initial condition again, we see that this constant should be $w=0$, i.e. $u=v$.

d'Alembert's formula will allow us to show that the solution depends on its initial data continuously.  Hence we get existence, uniqueness, and stability so that the Cauchy problem for the wave equation is well-posed.
\begin{theorem}[Continuous dependence on initial data]
Let $u_1$ be the solution of the wave equation with initial conditions
\begin{equation*}
u(x,0) = \phi_1(x), \quad u_t(x,0) = \psi_1(x).
\end{equation*}
Let $u_2$ be the solution satisfying the initial condition
\begin{equation*}
u(x,0) = \phi_2(x), \quad u_t(x,0) = \psi_2(x).
\end{equation*}
Let $\eps > 0$ and $T>0$ be fixed.  Then there exists a positive number $\delta$ such that, if
\begin{equation*}
|\phi_1(x)-\phi_2(x)| < \delta, \quad \text{ and }|\psi_1(x)-\psi_2(x)|<\delta,
\end{equation*}
for all $x$, then
\begin{equation*}
|u_1(x,t)-u_2(x,t)| < \eps
\end{equation*}
for all $x$ and for $0 \leq t \leq T$.
\end{theorem}

\begin{proof}
By d'Alembert's formula, our solutions are given by
\begin{align*}
u_1(x,t) &= \frac{1}{2}(\phi_1(x-ct)+\phi_1(x+ct)) + \frac{1}{2c}\int_{x-ct}^{x+ct}\psi_1(s)ds\\
u_2(x,t) &= \frac{1}{2}(\phi_2(x-ct)+\phi_2(x+ct)) + \frac{1}{2c}\int_{x-ct}^{x+ct}\psi_2(s)ds.
\end{align*}
Then
\begin{align*}
|u_1(x,t)-u_2(x,t)| &\leq \frac{1}{2}|\phi_1(x-ct)-\phi_2(x-ct)|+\frac{1}{2}|\phi_1(x+ct)-\phi_2(x+ct)|\\
&\hspace{0.2 in} + \frac{1}{2c}\int_{x-ct}^{x+ct}|\psi_1(s)-\psi_2(s)|ds\\
&\leq (1+T)\delta.
\end{align*}
Choose $\delta$ such that
\begin{equation*}
0 < \delta < \frac{\eps}{1+T}.
\end{equation*}
\end{proof}


\subsection{The diffusion equation}
We will study the diffusion (or heat) equation:
\begin{equation*}
u_{t} = ku_{xx}.
\end{equation*}
Unlike the first-order linear and wave equation, the heat equation is hard to solve so we will begin by discussing its properties.  A key property that gets used very often in the analysis of parabolic (and elliptic) equations is the maximum principle.
\begin{theorem}[weak maximum principle]
If $u(x,t)$ satisfies the heat equation in a rectangle (say, $0\leq x \leq L$, $0\leq t \leq T$) in space time, then the maximum value of $u(x,t)$ is assumed either initially $t=0$ or on the lateral sides ($x=0$ or $x=L$).
\end{theorem}

\begin{proof}
Let $M$ be the maximum value of $u(x,t)$ on the three sides $t=0$, $x=0$ and $x=L$.  Our goal is to show that $u(x,t) \leq M$ inside the rectangle.  Let $\eps>0$ and define 
\begin{equation*}
v_\eps(x,t) := u(x,t)+\eps x^2.
\end{equation*}
Then $v(x,t) \leq M+\eps L^2$ on the three sides.
Taking the derivative, the function $v_\eps$ satisfies
\begin{equation*}
v_t-kv_{xx} = -2\eps k <0.
\end{equation*}
Suppose the function $v$ attains its maximum at an interior point $(x_0,t_0)$.  Then at this point, $v_t=0$ and $v_{xx} \leq 0$, hence
\begin{equation*}
0\leq v_t-kv_{xx}|_{(x_0,t_0)} < 0,
\end{equation*}
which is a contradiction, hence the maximum cannot be attained at an interior point.  Suppose that the maximum is attained at some $0<x_0<L$ and $t_0=T$.  Hence $u_{xx}\leq 0$ at this point.  Since $v(x_0,T) \geq v(x_0,T-\delta)$ for any $\delta >0$ (since $v(x_0,T)$ is a maximum, we have
\begin{equation*}
v_t(x_0,T) = \lim_{\delta \to 0^+}\frac{v(x_0,T)-v(x_0,T-\delta)}{\delta} \geq 0.
\end{equation*}
Note that it could be that $v_t(x_0,T) \neq 0$ since $T$ is at the time ``boundary''.  Hence the maximum of $v_\eps$ is attained at the boundary region.  Letting $\eps \to 0$ gives us our result.
\end{proof}

\subsubsection{Uniqueness}

We use the maximum principle to prove uniqueness for the \textbf{Dirichlet problem}, i.e. 
\begin{equation*}
\begin{cases}
u_t - ku_{xx} = f(x,t) & \text{ for }0 < x <L \text{ and } t >0\\
u(x,0) = \phi(x) \\
u(0,t) = g(t)\\
u(L,t) = h(t).
\end{cases}
\end{equation*}
Let $u_1$ and $u_2$ be two solutions and let $w:= u_1-u_2$.  Then by linearity, $w$ satisfies the equation
\begin{equation*}
\begin{cases}
w_t-kw_{xx}=0 & \text{ for }0 < x <L \text{ and } t>0\\
w(x,0) = 0\\
w(0,t) = 0\\
w(L,t) = 0.
\end{cases}
\end{equation*}
By the maximum principle, $w(x,t) \leq 0$.  Applying the same argument to $\tilde w = u_2-u_1$, we have $w(x,t) \geq 0$, hence $w(x,t) = 0$ so that $u_1 = u_2$.

\textbf{Alternatively}: We can also consider the energy of $w$, i.e.
\begin{equation*}
E[w](t) := \int_{0}^L w^2(x,t)dx.
\end{equation*}

\subsubsection{Stability}
We use the maximum principle to show that the diffusion equation has continuous dependence on the initial condition.  Suppose $u_1$ and $u_2$ solve the diffusion equation with initial condition $u_1(x,0)=\phi_1(x)$ and $u_2(x,0) = \phi_2(x)$, respectively, and with the same boundary conditions.  Let $w=u_2-u_1$ so that $w$ satisfies
\begin{equation*}
\begin{cases}
w_t - kw_{xx} = 0 & \text{ for } 0 < x < L, t>0\\
w(x,0) = \phi_2(x)-\phi(x)\\
w(0,t) = 0\\
w(L,t) = 0.
\end{cases}
\end{equation*}
By maximum principle and minimum principle, we have $|w(x,t)| \leq \max \{|\phi_2(x)-\phi_1(x)|\}$, so that if $\phi_1$ and $\phi_2$ are uniformly close to each other, then the solutions are also close.

\begin{example}
Consider the diffusion equation $u_t=u_{xx}$ in $\{0 < x < 1, 0 < t < \infty \}$.  with $u(0,t) = u(1,t) = 0$ and $u(x,0) = 4x(1-x)$.
\begin{enumerate}
\item Show that $0 < u(x,t) <1$ for all $t> 0$ and $0 < x < 1$.
\item Show that $u(x,t) = u(1-x,t)$ for all $t \geq 0$ and $0 \leq x \leq 1$.
\item Show that $\int_0^1 u^2dx$ is a strictly decreasing function of $t$.
\end{enumerate}
\end{example}

\subsection{Diffusion equation on the entire real line}
We now establish the existence of solutions to the diffusion equation.  We begin by considering the diffusion equation on the whole real line and for all positive time $t$:
\begin{equation*}
\begin{cases}
u_t - ku_{xx} = 0, & \text{ on } -\infty < x <\infty, t>0\\
u(x,0) = \phi(x).
\end{cases}
\end{equation*}
To produce a solution, we first start by solving the diffusion equation with the particular initial condition
\begin{equation*}
u(x,0) = Q(x,0) = \begin{cases}
1 & x>0 \\
0 & x < 0.
\end{cases}
\end{equation*}
Note that if $u(x,t)$ is a solution to $u_t = ku_{xx}$, then so is its dilation $u(\sqrt{a}x,at)$ for $a>0$.  The particular initial condition is compatible with the dilation property.  So, we now look for solutions $Q(x,t)$ which are dilation invariant.  If we consider the scaling factors, a scale invariant quantity is $p=\frac{x}{\sqrt{4kt}}$ so we look for solutions of the form
\begin{equation*}
Q(x,t) = g(p).
\end{equation*}
Computing out the terms, we have
\begin{align*}
Q_t &= -\frac{1}{2t}\frac{x}{\sqrt{4kt}}g'(p), \\
Q_x &= \frac{1}{\sqrt{4kt}}g'(p),\\
Q_{xx} &= \frac{1}{4kt}g''(p)
\end{align*}
so that
\begin{equation*}
0 = Q_t - kQ_{xx} = \frac{1}{t}\left(-\frac{1}{2}pg'(p)-\frac{1}{4}g''(p)\right)
\end{equation*}
Solving the ODE $g''+2pg' = 0$, we get
\begin{equation*}
Q(x,t) = g(p) = c_1\int_0^{p} e^{-s^2}ds+ c_2.
\end{equation*}
To find the coefficients, we use the initial condition so that
\begin{align*}
1=\lim_{t\to 0^+}Q(x,t) &= c_1\int_0^\infty e^{-s^2}ds + c_2 = c_1\frac{\sqrt{pi}}{2}+c_2, \quad \text{ for } x>0, \\
0=\lim_{t\to 0^+}Q(x,t) &= c_1\int_0^{-\infty} e^{-s^2}ds + c_2 = -c_1\frac{\sqrt{pi}}{2}+c_2, \quad \text{ for } x<0.
\end{align*}
Solving for the coefficients, we get $c_1 = \frac{1}{\sqrt{\pi}}$ and $c_2 = \frac{1}{2}$.  Therefore,
\begin{equation*}
Q(x,t) = \frac{1}{2}+\frac{1}{\sqrt{\pi}}\int_0^{\frac{x}{\sqrt{4kt}}}e^{-s^2}ds.
\end{equation*}
Next we define the \textbf{heat kernel}
\begin{equation*}
H(x,t) = \frac{\dd Q}{\dd x}(x,t).
\end{equation*}
Using the heat kernel, we define
\begin{equation*}
u(x,t) = \int_{-\infty}^\infty H(x-y,t)\phi(y)dy = \frac{1}{\sqrt{4\pi kt}}\int_{-\infty}^\infty e^{-\frac{(x-y)^2}{4kt}}\phi(y)dy, \text{ for } t>0.
\end{equation*}
Since $H(x,t)$ is the derivative of a solution to the heat equation, it will also satisfy the heat equation.  Furthermore, since $u(x,t)$ is the integral of a solution, this will again satisfy the heat equation.  We claim that $u(x,t)$ is the unique solution to the \textbf{heat equation on the whole real line} provided that $\phi(x)$ vanishes for large $|x|$ (in fact, a weaker assumption can be made).  To check that the initial condition is satisfied, we compute
\begin{align*}
u(x,t) &= \int_{-\infty}^\infty \frac{\dd Q}{\dd x}(x-y,t)\phi(y)dy\\
&=-\int_{-\infty}^\infty \frac{\dd Q}{\dd y}(x-y,t)\phi(y)dy \\
&=\int_{-\infty}^\infty Q(x-y,t)\phi'(y)dy.
\end{align*}
By the particular choice of $Q$, 
\begin{align*}
u(x,0) &= \int_{\infty}^\infty Q(x-y,0)\phi'(y)dy \\
&= \int_{-\infty}^x \phi'(y)dy = \phi(x).
\end{align*}

The Gaussian integral comes up commonly enough to give it a special name called the \textbf{error function}:
\begin{equation*}
\mathcal{E}\text{rf}(x) = \frac{2}{\sqrt{\pi}}\int_0^xe^{-s^2}ds. 
\end{equation*}

Now we analyze the possible initial conditions.  In our derivation, we needed some decay at infinity.  However, we can weaken this assumption to the following:
\begin{proposition}
Let $\phi(x)$ be a continuous function such that $|\phi(x)| \leq Ce^{ax^2}$.  Then the heat kernel solution to the heat equation is defined for $0<t<\frac{1}{4ak}$.
\end{proposition}
\begin{proof}
We need to show that
\begin{equation*}
u(x,t) = \frac{1}{\sqrt{4\pi k t}}\int_{-\infty}^\infty e^{-\frac{(x-y)^2}{4kt}}\phi(y)dy
\end{equation*}
is bounded.  We have
\begin{align*}
|u(x,t)| &\leq \frac{1}{\sqrt{4\pi k t}}\int_{-\infty}^\infty e^{-\frac{(x-y)^2}{4kt}}|\phi(y)|dy \\
&\leq \frac{C}{\sqrt{4\pi k t}}\int_{-\infty}^\infty e^{-\frac{(x-y)^2}{4kt}}e^{ay^2}dy \\
&= \frac{C}{\sqrt{4\pi k t}}\int_{-\infty}^\infty e^{\frac{-x^2+2xy+(4kta-1)y^2}{4kt}}dy.
\end{align*}
The coefficient of the $y^2$ term in the exponent needs to be negative so that the integral is convergent, hence we require $0<t<\frac{1}{4ak}$.
\end{proof}

\begin{theorem}
Let $\phi(x)$ be a bounded continuous function on $\mathbb{R}$.  Then the heat equation solution satisfies the heat equation with initial condition.  Furthermore, the solution is infinitely differentiable, regardless of the regularity of the initial function.
\end{theorem}

\begin{proof}
First we need to show that the initial condition is met (in a limiting sense).  Using the identity
\begin{equation*}
\phi(x) = \frac{1}{\sqrt{\pi}}\int_{-\infty}^\infty  e^{-s^2}\phi(x)ds,
\end{equation*}
and changing variables $s=\frac{x-y}{\sqrt{4kt}}$, we have
\begin{align*}
|u(x,t) - \phi(x)| &\leq \frac{1}{\sqrt{\pi}}\int_{-\infty}^\infty e^{-s^2}|\phi(x-s\sqrt{4kt})-\phi(x)|ds.
\end{align*}
Let $\eps > 0$ be fixed.  Then there is some $\delta>0$ such that $|\phi(x) - \phi(y)| < \frac{\eps}{2}$ whenever $|x-y| < \delta$.  Furthermore, since the improper integral converges, there exists some $N>0$ such that 
\begin{equation*}
\frac{1}{\sqrt{\pi}}\int_{|s|>N} e^{-s^2}ds \leq \frac{\eps}{4M},
\end{equation*}
where $M=\max\phi$.  Now we split the integral so that
\begin{align*}
\frac{1}{\sqrt{\pi}}&\int_{-\infty}^\infty e^{-s^2}|\phi(x-s\sqrt{4kt})-\phi(x)|ds\\
&= \frac{1}{\sqrt{\pi}}\int_{|s|\leq \frac{\delta}{\sqrt{4kt}}}e^{-s^2}|\phi(x-s\sqrt{4kt})-\phi(x)|ds + \frac{1}{\sqrt{\pi}}\int_{|s| > \frac{\delta}{\sqrt{4kt}}}e^{-s^2}|\phi(x-s\sqrt{4kt})-\phi(x)|ds
\end{align*}
The first term is $\leq \frac{\eps}{2}$ by the continuity of $\phi$ and for the second term, choose $t\to 0$ so that $\frac{\delta}{\sqrt{4kt}} \geq N$ to bound by $\frac{\eps}{2}$. 

To show regularity, we see that the derivative has been moved to the $x$ variable, and the heat kernel is smooth.  One needs to still show that the integral is convergent, which holds by the exponential decay of the heat kernel.
\end{proof}

\section{Reflections and sources}
\subsection{Diffusion on the half-line}
We solved the heat equation on the whole real line.  Next we attempt to solve the PDE on the half line $(0,\infty)$.  We first introduce \textbf{odd extensions} of a function defined on the half line as
\begin{equation*}
\phi_{\text{odd}}(x) = 
\begin{cases}
\phi(x) & \text{ for }x > 0\\
-\phi(-x) & \text{ for }x< 0\\
0 & \text{ for } x=0.
\end{cases}
\end{equation*}
When posed with a PDE on the half-line
\begin{equation*}
\begin{cases}
u_t - ku_{xx} = 0 & \text{ on } 0<x<\infty, t> 0\\
u(x,0) = \phi(x),\\
u(0,t)= 0
\end{cases}
\end{equation*}
one can first consider the PDE on the whole-line
\begin{equation*}
\begin{cases}
u_t - ku_{xx} = 0 & \text{ on } -\infty<x<\infty, t> 0\\
u(x,0) = \phi_{\text{odd}}(x),
\end{cases}
\end{equation*}
so that the heat kernel solution is given by
\begin{align*}
u(x,t) = \int_{-\infty}^\infty H(x-y,t)\phi_{\text{odd}}(y)dy.
\end{align*}
By uniqueness, its restriction to $x>0$ is the solution for the half-line.  To write this more explicitly, we have
\begin{align*}
u(x,t) = \int_0^\infty H(x-y,t)\phi(y)dy - \int_{-\infty}^0H(x-y,t)\phi(-y)dy.
\end{align*}
By changing variables, we get
\begin{align*}
u(x,t) = \int_0^\infty(H(x-y,t)-H(x+y,t))\phi(y)dy.
\end{align*}

\subsection{Wave equation on half-line}
The problem is
\begin{equation*}
\begin{cases}
v_{tt}-c^2v_{xx} = 0 & \text{ for } 0 < x < \infty, t \in \mathbb{R}\\
v(x,0) = \phi(x) \\
v_t(x,0) = \psi(x) \\
v(0,t) = 0.
\end{cases}
\end{equation*}
By considering the odd extensions of the initial functions, we can again solve the wave equation on the whole interval, the solution being given by d'Alembert's solution so that
\begin{equation*}
v(x,t) = \frac{1}{2}(\phi_{\text{odd}}(x+ct) + \phi_{\text{odd}}(x-ct)) + \frac{1}{2c}\int_{x-ct}^{x+ct}\psi_{\text{odd}}(y)dy.
\end{equation*}
We can rewrite in terms of the original $\phi$ and $\psi$ by considering different domains for $x$.  First consider when $x > c|t|$.  Then
\begin{equation*}
v(x,t) = \frac{1}{2}(\phi(x+ct) + \phi(x-ct)) + \frac{1}{2c}\int_{x-ct}^{x+ct}\psi(y)dy, \quad \text{ for }x > c|t|.
\end{equation*}
In the region $0<x < c|t|$, we have $\phi_{\text{odd}}(x-ct) = -\phi(ct-x)$ so that by changing variables, we get
\begin{equation*}
v(x,t) = \frac{1}{2}(\phi(x+ct)-\phi(ct-x))+\frac{1}{2c}\int_{ct-x}^{x+ct}\psi(y)dy, \quad \text{ for } 0< x < c|t|.
\end{equation*}


\subsection{Inhomogeneous diffusion equations}
We now deal with the inhomogenous problems.  First consider
\begin{equation*}
\begin{cases}
u_t-ku_{xx}=f(x,t) & \text{ on }-\infty < x < \infty, t>0\\
u(x,0) = \phi(x),
\end{cases}
\end{equation*}
where $f(x,t)$ and $\phi(x)$ are arbitrary given functions.  The solution is given by
\begin{equation*}
u(x,t) = \int_{-\infty}^\infty H(x-y,t)\phi(y)dy + \int_{0}^t\int_{-\infty}^\infty H(x-y,t-s)f(y,s)dyds.
\end{equation*}

We verify now that this is indeed a solution.  We know that the first term is a solution to the homogeneous problem so now we show that the second term satisfies the PDE.  Computing, we have
\begin{align*}
\frac{\dd u}{\dd t} &= \frac{\dd}{\dd t} \lim_{\eps \to 0}\int_0^{t-\eps}\int_{-\infty}^\infty H(x-y,t-s)f(y,s)dyds\\
&= \int_0^{t}\int_{-\infty}^\infty H_t(x-y,t-s)f(y,s)dyds + \lim_{\eps \to 0}\int_{-\infty}^\infty H(x-y,\eps)f(y,t-\eps)dy \\
&= \int_0^t \int_{-\infty}^\infty kH_{xx}(x-y,t-s)dyds +  \lim_{\eps \to 0}\int_{-\infty}^\infty H(x-y,\eps)f(y,t-\eps)dy  \\
&= k\frac{\dd^2 u}{\dd x^2} + f(x,t).
\end{align*}
To show that the solution satisfies the initial condition, simply take the limit to show that the second term vanishes.  Here to make each step valid, we need some conditions on $f$, say bounded.

\subsection{Inhomogeneous wave equations}

Now we solve the inhomogeneous wave equation on the whole line
\begin{equation*}
\begin{cases}
u_{tt}-c^2u_{xx}=f(x,t) & \text{ on } (x,t) \in \mathbb{R}^2 \\
u(x,0) = \phi(x) \\
u_t(x,0) = \psi(x).
\end{cases}
\end{equation*}

We will show that the solution is given by
\begin{equation*}
u(x,t) = \frac{1}{2}(\phi(x+ct) + \phi(x-ct))+\frac{1}{2c}\int_{x-ct}^{x+ct}\psi(y)dy + \frac{1}{2c}\iint_{T} f(x,t)dxdt.
\end{equation*}
where $T$ is the characteristic triangle (with corner points $(x_0,t_0)$:
\begin{center}
\includegraphics[scale=0.7]{triangle.png}
\end{center}
First we justify our guess by the following computation.  Since the wave equation exhibits the finite speed propagation behavior, we integrate over the characteristic triangle, since this is presumably the region where the point $u(x,t)$ will be affected by the initial conditions.  Now
\begin{align*}
\iint_T f(x,t)dxdt &= \iint_T u_{tt}-c^2u_{xx}dxdt \\
&= \iint_T \diver\langle -c^2u_x,u_t\rangle dA \\
&= \int_{\dd T}\langle -c^2u_x,u_t\rangle \cdot \langle dt,-dx\rangle \\
&= \int_{\dd T}-c^2u_xdt- u_tdx
\end{align*}
The boundary consists of three straight line segments, hence we compute each one separately.  The line on the $t=0$ implies that $dt = 0$ and $u_t(x,0) = \psi$ hence 
\begin{equation*}
\int_{t=0} -c^2u_xdt-u_tdx = -\int_{x_0-ct_0}^{x_0+ct_0}\psi dx.
\end{equation*}
For the line on the right, we use the fact that $dx=-cdt$ there to compute that
\begin{align*}
\int_{x+ct=x_0+ct_0} cu_xdx+cu_tdt = c\int_{x+ct=x_0+ct_0} du = cu(x_0,t_0) - c\phi(x_0+ct_0).
\end{align*}
and likewise, 
\begin{align*}
\int_{x-ct=x_0-ct_0}cdu = -c\phi(x_0-ct_0)+cu(x_0,t_0).
\end{align*}
Adding these together yields
\begin{align*}
u(x_0,t_0) = \frac{1}{2c}\iint_T fdxdt + \frac{1}{2}(\phi(x_0+ct_0) + \phi(x_0-ct_0)) + \frac{1}{2c}\int_{x_0-ct_0}^{x_0+ct_0}\psi(x)dx.
\end{align*}

\section{Harmonic Functions}
If we were to generalize the analysis we have done for the wave and heat equation to higher dimensions, we would consider adding more dimensions to the \textbf{spatial} component.  In other words,
\begin{align*}
u_t - k(u_{xx}+u_{yy})&=0\\
u_{tt}-k(u_{xx}+u_{yy}) &=0.
\end{align*}
We define the \textbf{2-dimensional Laplacian} $\Delta$ by
\begin{equation*}
\Delta u = u_{xx}+u_{yy}
\end{equation*}
and we say a function is \textbf{harmonic} if
\begin{equation*}
\Delta u(x,y) = 0.
\end{equation*}
\begin{example}
A function $f:\mathbb{C} \to \mathbb{C}$ from the complex numbers to the complex number can be split into its real and imaginary parts as 
\begin{equation*}
f(x,y) = u(x,y)+\sqrt{-1}v(x,y),
\end{equation*}
where $u,v:\mathbb{R}^2 \to \mathbb{R}$.  Such a function is \textbf{complex differentiable} if they satisfy the equations
\begin{equation*}
\begin{cases}
\frac{\dd u}{\dd x} = \frac{\dd v}{\dd y}\\
\frac{\dd u}{\dd y} = -\frac{\dd v}{\dd x}.
\end{cases}
\end{equation*}
Then taking the derivative once more, we have
\begin{align*}
\frac{\dd}{\dd x}\frac{\dd u}{\dd x} = \frac{\dd^2 v}{\dd x\dd y} = -\frac{\dd}{\dd y}\frac{\dd u}{\dd y}
\end{align*}
so that
\begin{equation*}
u_{xx}+u_{yy} = 0.
\end{equation*}
By the same reasoning, we see that the real and imaginary parts of a complex differentiable function are harmonic functions.
\end{example}
Harmonic functions share similar properties to solutions to the heat equation.  One property they share is the maximum principle.
\begin{theorem}[Maximum principle]
Let $D\subset \mathbb{R}^2$ be a connected bounded open set.  Let $u(x,y)$ be a harmonic function in $D$ and continuous up to the boundary.  Then the maximum and minimum values of $u$ are attained on the boundary of $D$ and nowhere inside unless $u$ is a constant.
\end{theorem}

\begin{proof}
Let $\eps > 0$ and define $v(x,y) = u(x,y) + \eps(x^2+y^2)$.  Then
\begin{align*}
\Delta v = \Delta u + 4\eps = 4\eps > 0.
\end{align*}
Suppose there is some interior maximum point $(x_0,y_0)$.  Then by the second derivative test, $\Delta v \leq 0 $, which is a contradiction.  Hence there cannot be an interior maximum for $v$.  Since $u$ and thus $v$ is continuous up to the boundary in $D$, there must be a maximum, which would occur at some boundary point $(x_0,y_0) \in \dd D $.  Then
\begin{align*}
u(x,y) \leq v(x,y) \leq v(x_0,y_0) = u(x_0,y_0) + \eps(x_0^2 +y_0^2) \leq \max_{\dd D}u + \eps L^2
\end{align*}
where $L$ is the diameter of the domain $D$.   Let $\eps \to 0$ gives us 
\begin{equation*}
u(x,y) \leq \max_{\dd D}u.
\end{equation*}
\end{proof}
To solve for harmonic equations in certain domains, we will develop a method called separation of variables, which we first use to solve the heat and wave equation on bounded domains.

\section{Separation of Variable}
First recall the solution to constant coefficient second order ODEs of the form
\begin{equation*}
y''+ay'+by=0. 
\end{equation*}
The solution can be obtained by finding the roots of the auxiliary polynomial
\begin{equation*}
m^2+am+b=0
\end{equation*}
Depending on whether the roots are real or complex and the multiplicity, we get different types of solutions.  The ones we will mainly be concerned are of the type
\begin{equation*}
y''+\lambda y = 0.
\end{equation*}
for $\lambda > 0$.  Then the auxiliary polynomial $m^2 + \lambda =0$ has the two complex roots $m=\pm \sqrt{-\lambda}$.  This leads to the solution
\begin{equation*}
y(x) = c_1\sin(\sqrt{\lambda}x) + c_2\cos(\sqrt{\lambda}x).
\end{equation*}
Without any auxiliary conditions, there are no restrictions on $\lambda$. 
\subsection{Wave equation on bounded interval}
We now solve the wave equation on a bounded interval.  Consider the Dirichlet problem
\begin{equation*}
\begin{cases}
u_{tt}-c^2u_{xx}=0 & \text{on }0 < x < L, \ \  t\in\mathbb{R}\\
u(0,t) = 0\\
u(L,t) = 0\\
u(x,0) = \phi(x) \\
u_t(x,0) = \psi(x).
\end{cases}
\end{equation*}
\textbf{Assume now that the solution of the form}
\begin{equation*}
u(x,t) = F(x)G(t).
\end{equation*}
Computing, we get
\begin{align*}
u_{tt} &= F(x)G''(t)\\
u_{xx} &= F''(x)G(t),
\end{align*}
hence
\begin{align*}
u_{tt}-c^2u_{xx} &= F(x)G''(t) - c^2F''(x)G(t) = 0.
\end{align*}
Separating the variables, we get
\begin{equation*}
\frac{G''(t)}{G(t)} = c^2\frac{F''(x)}{F(x)}.
\end{equation*}
Since one side is a function in the $t$ variable and the other is a function in the $x$ variable and they are independent variables, the one way the two expressions can be equal is if they are constants, say $-\lambda$, so we get a pair of ODEs
\begin{align*}
G''(t)+c^2\lambda G(t)&=0\\
F''(x)+\lambda F(x) &= 0.
\end{align*}
For now, there is no reason why $\lambda$ should be positive or negative.  We will first solve these equations assuming $\lambda >0$ then we will show later that in fact, this is the only choice we need to consider.  Solving these out, we get
\begin{align*}
F(x) &= c_1\cos(\sqrt{\lambda}x) + c_2\sin(\sqrt{\lambda}x) \\ 
G(t) &= c_3\cos(c\sqrt{\lambda}t)+c_4\sin(c\sqrt{\lambda}t).
\end{align*}
Now we use the boundary conditions to get a more precise solution. The Dirichlet condition states that $u(0,t)=F(0)G(t) = 0$ and $u(L,t)=F(L)G(t) = 0$.  Since $G(t)\neq 0$ we must have that $F(0) = F(L) = 0$.  So
\begin{align*}
F(0) &= c_1 = 0
\end{align*}
and
\begin{align*}
F(L) &= c_2\sin(\sqrt{\lambda}L)= 0.
\end{align*}
If $c_2 =0$, then $F=0$, which we want to avoid, so it must be that
\begin{align*}
\sqrt{\lambda}L = n\pi, \quad n \in \mathbb{Z}.
\end{align*}
Therefore,
\begin{equation*}
\lambda = \frac{n^2\pi^2}{L^2}, \quad n \in \mathbb{Z}.
\end{equation*}
Since the equation is linear, we can add together all possible solutions so that we get
\begin{equation*}
u(x,t) = \sum_{n}\left(A_n\cos\left(\frac{n\pi ct}{L}\right) + B_n\sin\left(\frac{n\pi c t}{L}\right)\right)\sin\left(\frac{n\pi x}{L}\right),
\end{equation*}
where $A_n$ and $B_n$ are constants.  If we can find constants so that
\begin{align*}
\phi(x) &= \sum_{n}A_n\sin\left(\frac{n\pi x}{L}\right)\\
\psi(x) &= \sum_n \frac{n\pi c}{L}B_n\sin\left(\frac{n\pi x}{L}\right),
\end{align*}
then this gives us a solution to the Cauchy problem.  This is called the \textbf{Fourier series solution} of the wave equation.  Note that the difference between the Fourier series solution and d'Alembert's solution is that d'Alembert's solution is a solution for the problem posed on an infinitely long string, where in this case, we are considering a finitely long string.

\subsection{Heat equation on finite interval}
We can use the same technique to find the solution to
\begin{equation*}
\begin{cases}
u_t - ku_{xx} & \text{on }0< x < L,\ \ t>0\\
u(0,t) = u(L,t) = 0\\
u(x,0) = \phi(x).
\end{cases}
\end{equation*}

If we assume that $u(x,t) = F(x)G(t)$, then this leads to
\begin{equation*}
\frac{G'(t)}{kG(t)} = \frac{F''(x)}{F(x)} = -\lambda.
\end{equation*}
We get the same equation for $F$.  For $G$, we get
\begin{equation*}
G'(t)+\lambda kG(t)=0,
\end{equation*}
whose solution is given by
\begin{equation*}
G(t) = Ae^{-\lambda k t}
\end{equation*}
where $A$ is some constant.  Combining as before, we get
\begin{equation*}
u(x,t) = \sum_{n=1}^\infty A_ne^{-\frac{n^2\pi^2}{L^2}kt}\sin\left(\frac{n\pi x}{L}\right).
\end{equation*}
This will solve the initial value problem if we an find coefficients $A_n$ such that
\begin{equation*}
\phi(x) = \sum_{n=1}^\infty A_n\sin\left(\frac{n\pi x}{L}\right).
\end{equation*}
The numbers $\lambda$ are referred to as the \textbf{eigenvalue} or \textbf{spectrum} of the differential operator $-\frac{d^2}{dx^2}$.

To show that we only need to check when $\lambda >0$, suppose $\lambda < 0$.  Then the solution to the ODE $F''+\lambda F=0$ is given by
\begin{equation*}
F(x) = c_1e^{\sqrt{-\lambda} x}+c_2e^{-\sqrt{-\lambda} x}
\end{equation*}
however, when we apply our boundary conditions, we get
\begin{align*}
F(0) = 0 = c_1+c_2
\end{align*}
so that $F(x) = c_1 e^{\sqrt{-\lambda}x}-c_1e^{-\sqrt{-\lambda}x}$.  Plugging in the second boundary condition, we get
\begin{align*}
F(L) = 0 = c_1 e^{\sqrt{-\lambda}L}-c_1e^{-\sqrt{-\lambda}L}
\end{align*}
or 
\begin{equation*}
e^{\sqrt{-\lambda}L}=e^{-\sqrt{-\lambda}L}
\end{equation*}
and this is only obtained when $\lambda = 0$.

\subsection{Neumann boundary condition}
In the previous section, we had the Dirichlet boundary condition, where we assign the value of the function at the boundary.  Now the \textbf{Neumann condition} prescribes the value of the derivative of the function, i.e., 
\begin{equation*}
\begin{cases}
u_x(0,t) = 0\\
u_x(L,t) = 0.
\end{cases}
\end{equation*}
This changes the one-dimensional eigenvalue problem to
\begin{equation*}
\begin{cases}
-F'' = \lambda F \\
F'(0) = 0\\
F'(L) = 0.
\end{cases}
\end{equation*}
Up to this point, there is no difference in how to obtain the solutions, however the allowable eigenvalues change.  Note that we do not want the function $F=0$ to be a solution, since this is the trivial solution.  The constant function $F=c \neq 0$ is allowed.  In this case,  $F$ satisfies the boundary condition and also the ODE when $\lambda = 0$.  So the \textbf{key difference between the Neumann and the Dirichlet boundary condition} is that $\lambda=0$ is an eigenvalue for the Neumann boundary but not for the Dirichlet boundary.  Secondly, when we apply the boundary condition, the constant that will vanish will be the one multiplying $\sin(x)$, hence the eigenfunctions become
\begin{equation*}
F_n(x) = \cos\left( \frac{n\pi x}{L}\right), \quad n \in \mathbb{N}.
\end{equation*}
Therefore, the heat equation solution becomes
\begin{equation*}
u(x,t) = \frac{1}{2}A_0 + \sum_{n=1}^\infty A_n e^{-\frac{n^2\pi^2}{L^2}kt}\cos\left(\frac{n\pi x}{L}\right).
\end{equation*}

\subsection{2 dimensional Laplacian in polar coordinates}
By doing a change of variables to polar coordinates, $x= r\cos\theta$, $y=r\sin\theta$, one obtains the Laplacian in polar coordinates:
\begin{equation*}
\Delta u = u_{rr}+\frac{1}{r}u_r + \frac{1}{r^2}u_{\theta\theta}.
\end{equation*}
Suppose we were to solve the Laplace equation on a disk.  Then it would be natural to impose the condition that the solution is rotationally symmetric, hence $u_\theta = 0$.  This leads to solving the ODE
\begin{equation*}
u_{rr}+\frac{1}{r}u_r = 0.
\end{equation*}
This leads to $u = c_1\log r + c_2$.  Notice however that the solution here is singular at the origin.  In 124B, you will go through a more rigorous investigation into harmonic functions.

\appendix
\section{Vector Space}
\begin{definition}[(real) vector space]
A \textbf{(real) vector space} is a set $V$ equipped with two operations:
\begin{enumerate}
\item Addition: adding any pair of elements $\v,\w \in V$ produces another vector $\v+\w \in V$.
\item Scalar Multiplication: multiplying an element $\v \in V$ by a scalar $c\in \mathbb{R}$ produces a vector $c\v \in V$.
\end{enumerate}
There are subject to the following axioms: for all $\u,\v,\w \in V$ and all scalars $c,d\in \mathbb{R}$,
\begin{enumerate}[(a)]
\item commutativity of addition: $\v+\w = \w + \v$
\item associativity of addition: $\u+(\v+\w) = (\u+\v)+\w$.
\item additive identity: There is a zero element $\vec{\mathbf{0}} \in V$ satisfying $\v + \vec{\mathbf{0}} = \vec{\mathbf{0}} + \v = \v$.
\item additive inverse: For each $\v \in V$, there is an element $-\v \in V$ such that $\v+(-\v) = (-\v)+\v = \vec{\mathbf{0}}$.
\item distributivity: $(c+d)\v = (c\v)+(d\v)$ and $c(\v + \w) = (c\v)+(c\w)$.
\item associativity of scalar multiplication $c(d\v) = (cd)\v$.
\item unit for scalar multiplication: the scalar $1 \in \mathbb{R}$ satisfies $1\v=\v$.
\end{enumerate}
\end{definition}

\section{Interchanging limits, derivatives, and integrals}
\begin{theorem}
Suppose $\{f_n\}$ is a sequence of functions, differentiable on $[a,b]$ and such that $\{f_n(x_0)\}$ converges for some point $x_0$ on $[a,b]$.  If $\{f'_n\}$ converges uniformly on $[a,b]$, then $\{f_n\}$ converges uniformly on $[a,b]$ to a function $f$, and
\begin{equation*}
f'(x) = \lim_{n\to \infty}f'_n(x).
\end{equation*}
\end{theorem}

\begin{theorem}
Let $I(t)$ be defined by $\displaystyle I(t) = \int_{a(t)}^{b(t)}f(x,t)dx,$ where $f(x,t)$ and $\displaystyle \frac{\dd f}{\dd t}$ are continuous on the rectangle $[A,B]\times [c,d]$, where $[A,B]$ contains the union of all intervals $[a(t),b(t)]$ and $a(t)$ and $b(t)$ are differentiable functions on $[c,d]$.  Then
\begin{equation*}
\frac{dI}{dt} = \int_{a(t)}^{b(t)}\frac{\dd f}{\dd t}(x,t)dx + f(b(t),t)b'(t) - f(a(t),t)a'(t).
\end{equation*}
\end{theorem}


\section{Vector Calculus in $\mathbb{R}^3$}
Let $f:\mathbb{R}^3\to \mathbb{R}$ be a (sufficiently differentiable) function in three variables, $f(x,y,z)$.
\begin{definition}
We define the \textbf{gradient} $\nabla = \langle \frac{\dd}{\dd x},\frac{\dd}{\dd y},\frac{\dd}{\dd z}\rangle$. The \textbf{gradient of $f$} is the vector
\begin{equation*}
\nabla f = \grad(f) = \langle f_x,f_y,f_z\rangle.
\end{equation*}
The \textbf{directional derivative} of $f$ in the direction $\v = \langle a,b,c\rangle$ is the scalar function given by
\begin{equation*}
\nabla_{\v}f = \nabla f\cdot \v = af_x+bf_y+cf_z.
\end{equation*}
The \textbf{divergence of $f$} is the scalar function given by
\begin{equation*}
\diver(f) = \nabla \cdot f = f_x+f_y+f_z.
\end{equation*}
\end{definition}
\noindent Let $F:\mathbb{R}^3 \to \mathbb{R}^3$ be a (sufficiently differentiable) vector valued function, that is, 
\begin{equation*}
F(x,y,z) = \langle p(x,y,z),q(x,y,z),r(x,y,z)\rangle
\end{equation*}
for scalar functions $p,q,r$.
\begin{definition}
The \textbf{curl of $F$} (sometimes called \textbf{rotation}) is given by
\begin{align*}
\curl(F) = \rot(F)= \nabla \times F = \langle (r_y-q_z), (p_z-r_x),(q_x-p_y)\rangle.
\end{align*}
\end{definition}
With the notations set up, we review some differentiation rules
\begin{proposition}[Chain rule]
Let $f(x,y,z):\mathbb{R}^3\to \mathbb{R}$ and $\vec{\mathbf{x}}: \mathbb{R}^3\to\mathbb{R}^3$ be given by
\begin{equation*}
\vec{\mathbf{x}}=\langle x(r,s,t),y(r,s,t),z(r,s,t)\rangle 
\end{equation*}
Then
\begin{equation*}
\frac{\dd}{\dd r}f(\vec{\mathbf{x}}) = \nabla f\cdot \frac{\dd \vec{\mathbf{x}}}{\dd r} = \frac{\dd f}{\dd x}\frac{\dd x}{\dd r} + \frac{\dd f}{\dd y}\frac{\dd y}{\dd r}+\frac{\dd f}{\dd z}\frac{\dd z}{\dd r}
\end{equation*}
\end{proposition}
Note that the chain rule using vector notation looks more closer to the one in single variable: ``derivative of outside times derivative of inside''.

\begin{theorem}[Divergence Theorem]
Let $D$ be a bounded domain with piecewise $C^1$ boundary surface $S$.  Let $\vec{\mathbf{n}}$ be the unit outward normal vector on $S$.  Let $F$ be any $C^1$ vector field on $\bar{D} = D\cup S$.  Then
\begin{equation*}
\iiint_{D}\diver F dV = \iint F\cdot \vec{\mathbf{n}}dS
\end{equation*}
where $dS$ is the surface area element on $S$.
\end{theorem}

\section{Ordinary Differential Equations}
\subsection{First order linear}
First order linear equations are given by
\begin{equation*}
y'+p(x)y=q(x).
\end{equation*}
One can take advantage of the fundamental theorem of calculus and the product to convert this into a nice form to find a solution.  The \textbf{integrating factor} is given by
\begin{equation*}
e^{\int p(x)}.
\end{equation*}
Multiplying through by the integrating factor allows one to consider the left hand side as a term which will come out using product rule, that is
\begin{equation*}
(e^{\int p(x)}y)' = e^{\int p(x)}y'+e^{\int p(x)}p(x)y = e^{\int p(x)}q(x)
\end{equation*}
Integrating both sides, we get the solution
\begin{equation*}
y(x) = e^{-\int p(x)}\int e^{\int p(x)}q(x) + Ce^{-\int p(x)}
\end{equation*}
\end{document}


