\documentclass[11pt,reqno]{amsart}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Math packages
\usepackage{amscd} %for diagrams
\usepackage{amsfonts} %extra math fonts
\usepackage{amsmath} %miscellaneous enhancements for math formulas
%\usepackage{amsrefs} %pack­age for bib­li­ogra­phies
%for alpha style while using amsart/amsrefs, use the option 
%\usepackage[shortalphabetic]{amsrefs} or [alphabetic], see
%https://tex.stackexchange.com/questions/381082/bibtex-style-alpha-is-not-working
\usepackage{amssymb} %extra math symbols
\usepackage{amsthm} %theorems set-up
\usepackage{latexsym} %extra math symbols
\usepackage{mathrsfs} %\math­scr sommand
\usepackage{mathtools} %pro­vides a se­ries of pack­ages de­signed to en­hance 
\usepackage{systeme}
\usepackage{wrapfig}
%the ap­pear­ance of doc­u­ments con­tain­ing a lot of math­e­mat­ics
%\mathtoolsset{showonlyrefs} %This numbers only equations that are labeled and referred to
       %Use \mathtoolsset{showonlyrefs=true,showmanualtags=true} to show also manual tags
       %For issues with subequations, use \noeqref to silently reference the equations, see:
       %https://tex.stackexchange.com/questions/62037/mathtools-showonlyrefs-fails-with-subequations
\usepackage{slashed}  %Use­ful for the Physi­cist’s ‘Feyn­man slashed char­ac­ter’ no­ta­tion.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Basic general latex packages
\usepackage{verbatim}
\usepackage{cases}
\usepackage[dvips]{epsfig}
\usepackage{epsf} %The orig­i­nal (and now ob­so­les­cent) graph­ics in­clu­sion 
%macros for use with dvips, still widely used by Plain TEX users (in par­tic­u­lar).
%\usepackage{hyperref}
\usepackage[bookmarksnumbered,pdfpagelabels=true,plainpages=false,colorlinks=true,
            linkcolor=black,citecolor=black,urlcolor=black]{hyperref}
\usepackage{url}
\usepackage{color}
\usepackage{xcolor}
\usepackage{graphicx}
\usepackage{enumitem} %for breaks in enumeration:
%http://tex.stackexchange.com/questions/135726/intertext-like-command-in-enumerate-environment
\usepackage{cite} %automatically order references in multiple cites

%More general latex packages
\usepackage{pifont} %com­mands for Pi fonts
\usepackage{upgreek} %up­right Greek let­ters
\usepackage{fancyhdr} %ex­ten­sive fa­cil­i­ties, both for con­struct­ing head­ers and foot­ers, 
%and for con­trol­ling their use
\usepackage{calligra} %cal­li­graphic font in the hand­writ­ing style
\usepackage{marvosym} %Euro cur­rency sym­bol as de­fined by the Euro­pean com­mis­sion, 
%along with sym­bols for struc­tural en­gi­neer­ing; sym­bols for steel cross-sec­tions; 
%as­tron­omy signs (sun, moon, plan­ets); the 12 signs of the zo­diac; scis­sor sym­bols; 
%CE sign and oth­ers.
\usepackage[percent]{overpic} %a cross be­tween the LATEX pic­ture en­vi­ron­ment and 
%the \in­clude­graph­ics com­mand
\usepackage{pict2e} %ex­tends the ex­ist­ing LATEX pic­ture en­vi­ron­ment
\usepackage[hypcap=false]{caption} %option false to avoid warning when hyperref is loaded
\usepackage{wasysym} %The WASY2 (Waldi Sym­bol) font by Roland Waldi pro­vides many 
%glyphs like male and fe­male sym­bols and as­tro­nom­i­cal sym­bols, as well as the 
%com­plete lasy font set and other odds and ends
\usepackage{accents}
\usepackage{float} % used to place images in exact locations 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Margins, spacing, etc.

%EXACT 1in MARGINS with geometry package                         
%geometry package:
%ftp://ftp.fu-berlin.de/tex/CTAN/macros/latex/contrib/geometry/geometry.pdf
\usepackage[papersize={8.5in,11in}, margin=1in,footskip=0.4in,vmarginratio={1:1},hmarginratio={1:1}]{geometry} 
%nohead option from:
%see the documentaion and:
%https://tex.stackexchange.com/questions/318696/1-inch-all-around
%Uselful: option showframe prints the frames on the page for actual visualization
%marginratio is important when using amsart, see:
%https://tex.stackexchange.com/questions/133860/problem-with-margins-using-amsart-and-geometry-packages

%EXACT 1in MARGINS by hand       
%\setlength{\textwidth}{6.5in}     
%\setlength{\oddsidemargin}{0in} 
%\setlength{\evensidemargin}{0in}  
%\setlength{\textheight}{8.8in}   
%\setlength{\topmargin}{0in}      
%\setlength{\headheight}{0in}     
%\setlength{\headsep}{0in}        
%\setlength{\footskip}{.2in}      

%These give wider space on the page
%\setlength{\textwidth}{6.75in} \setlength{\textheight}{8.6in}
%\hoffset=-0.9truein \voffset=-0.1truein
%\baselineskip=7.0mm
%\setlength{\baselineskip}{1.09\baselineskip}
%These are all to reduce blank space between paragraphs, sections etc
%http://www.terminally-incoherent.com/blog/2007/09/19/latex-squeezing-the-vertical-white-space/
%see also
%http://tex.stackexchange.com/questions/108684/spacing-before-and-after-section-titles
%\usepackage[compact]{titlesec}
%\setlength{\parskip}{0pt}
%\setlength{\parsep}{0pt}
% \setlength{\headsep}{0pt}
%\setlength{\topskip}{0pt}
% \setlength{\topmargin}{0pt}
%\setlength{\topsep}{5pt}
%\setlength{\partopsep}{0pt}
%\linespread{0.95}
%\titlespacing{\section}{0pt}{3pt}{1pt}
%\titlespacing{\subsection}{0pt}{3pt}{1pt}
%\titlespacing{\subsubsection}{0pt}{*0}{*0}

%Changing margins in parts of the text:
%http://tex.stackexchange.com/questions/68855/changing-top-bottom-left-right-margins-on-the-fly
%\begin{adjustwidth}{2cm}{2cm}
%text here
%\end{adjustwidth}
%\usepackage{changepage}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Counting, table of contents, etc.
\setcounter{secnumdepth}{4} %depth to which section numbering occurs
\setcounter{tocdepth}{4}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Header, running title
%Comment these to eliminate the running title and authors in the header
\pagestyle{fancy}
\headheight 27pt
\rhead[]{\thepage}
\chead[\textsf{Diff Eq - direction fields}]{\textsf{Disconzi}}
\lhead[\thepage]{}
\rfoot[]{}
\cfoot{}
\lfoot{}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Theorems, definitions, equations, etc.
\theoremstyle{plain}
\newtheorem{theorem}{Theorem}[section]
\newtheorem{claim}[theorem]{Claim}
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{conjecture}[theorem]{Conjecture}
\newtheorem{assumption}[theorem]{Assumption}

\theoremstyle{definition}
\newtheorem{remark}[theorem]{Remark}
\newtheorem{notation}[theorem]{Notation}
\newtheorem{definition}[theorem]{Definition}
\newtheorem{convention}[theorem]{Convention}
\newtheorem{example}[theorem]{Example}

\newenvironment{dem}{{\noindent \bf Proof: }}{\hfill $\qed$\\ \medskip}
\newenvironment{sketch}{{\noindent \bf Proof sketch: }}{\hfill $\qed$\\ \medskip}

\numberwithin{equation}{section}
\allowdisplaybreaks
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%General commands

%%%%%%%%%%%%%%%%
\newcommand{\norm}[1]{\Vert#1\Vert}
\newcommand{\abs}[1]{\vert#1\vert}
\newcommand{\nnorm}[1]{\left\Vert#1\right\Vert}
\newcommand{\aabs}[1]{\left\vert#1\right\vert}
\newcommand{\generalfunction}{\mathrm{f}}
\newcommand{\td}{t} %use for the time variable, and if one wants to change it for x^0, adjust here

\newcommand{\dive}{\mbox{\upshape div}\mkern 1mu}
\newcommand{\curl}{\mbox{\upshape curl}\mkern 1mu}
\newcommand{\tr}{\operatorname{tr}}
\newcommand{\vol}{\operatorname{vol}}
\newcommand{\id}{\operatorname{id}}


%to create space among tensor indices
\newcommand{\mss}{\hspace{0.2cm}}
\newcommand{\ms}{\hspace{0.25cm}}
\newcommand{\msm}{\hspace{0.3cm}}
\newcommand{\msb}{\hspace{0.35cm}}
%alternatively, using tensor package, e.g., $M\indices{^\alpha_\beta}$.
\usepackage{tensor}

%Variables and operators in text form: choose between using 
%\mbox, \operatorname, etc.:
%\newcommand{\uperpvort}{\mbox{\upshape vort}}
%\newcommand{\uperpvort}{\operatorname{vort}}
%See:
%https://tex.stackexchange.com/questions/70632/difference-between-various-methods-for-producing-text-in-math-mode
%https://tex.stackexchange.com/questions/48459/whats-the-difference-between-mathrm-and-operatorname/48463
%for differences


%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Enumerating etc.
%https://tex.stackexchange.com/questions/116101/add-bold-enumerate-items
%https://tex.stackexchange.com/questions/23723/latex-enumerate-bold-item-with-non-bold-text
\newenvironment{myenumeratealpha}
{ 
	\begin{enumerate}[label=\textbf{(\alph*)},ref=(\alph*), itemsep=1pt,parsep=0pt,topsep=2pt,labelsep=2pt,wide]
}
{ \end{enumerate}                  } 

\newenvironment{myenumerateroman}
{ 
	\begin{enumerate}[label=\textbf{(\roman*)},ref=(\roman*), itemsep=1pt,parsep=0pt,topsep=2pt,labelsep=2pt,wide]
}
{ \end{enumerate}                  } 

\newenvironment{myenumerateRoman}
{ 
	\begin{enumerate}[label=\textbf{(\Roman*)},ref=(\Roman*), itemsep=1pt,parsep=0pt,topsep=2pt,labelsep=2pt,wide]
}
{ \end{enumerate}                  } 

\newenvironment{myitemize}
{ 
	\begin{itemize}[itemsep=1pt,parsep=0pt,topsep=2pt,labelsep=2pt,wide=6pt]
}
{ \end{itemize}                  } 
%%%%%%%%%%%%%%%%


%%%%%%%%%%%%%%%%
%File specific
\newcommand{\RR}{\mathbb R}
\newcommand{\de}{\delta}

\begin{document}
%The [Short title] and [Disconzi] will be overriden by the Header, running title commands
\title[MATH 2420]{MATH 2420 - Ordinary Differential Equations: direction fields and related topics}
\author[Disconzi]{Marcelo M. Disconzi$^{*}$ 
%and Second author$^{** \dagger}$
}
	

%\thanks{$^{\dagger}$ Second author gratefully acknowledges 
%}

\thanks{$^{*}$Vanderbilt University, Nashville, TN, USA.
\texttt{marcelo.disconzi@vanderbilt.edu}}

%\thanks{$^{**}$Second author affiliation 
%\texttt{second.author@}}

\maketitle
\tableofcontents


\section{Existence and uniqueness of solutions}

We have seen in class simple examples of how to solve a differential
equation (D.E.).
We have also seen that, while finding a solution to D.E.
may be a hard task, it is relatively easy to \emph{verify}
whether a given function is a solution. Similar statements 
hold for an initial value problem (I.V.P).

From a more general point of view, a natural question is whether
there always exists a solution to a given D.E. or I.V.P.
We can also ask if a solution, once known to exist, is unique.
Notice that uniqueness
is a non-trivial question only for 
 an I.V.P. in that, as seen in class, a general D.E. will
typically have infinitely many solutions due to the presence of arbitrary constants.

Consider the initial value problem:
\begin{gather}
\begin{cases}
F(t,x(t),x^\prime(t),\dots,x^{(n)}(t)) = 0,\\
x(t_0) = x_0, \\
x(t_0) = x_1, \\
\hskip 0.75cm \vdots \\
x^{(n-1)}(t_0) = x_{n-1}.
\end{cases}
\label{ivp_gen}
\end{gather}
The two fundamental questions about (\ref{ivp_gen}) are:

I. Does (\ref{ivp_gen})  have a solution? This is the problem of
\emph{existence} of solutions.

II. If one knows that (\ref{ivp_gen}) has a solution, is such a solution unique?
This is the problem of \emph{uniqueness} of solutions. 

Question I can be rephrased as follows. Given  $F$, and 
$n$ numbers $x_0,\dots,x_{n-1}$, 
does there exist a function $x_{\text{sol}}$,
 defined
on a neighborhood of the point $t_0 \in \RR$, such that 
\begin{gather}
F(t,x_{\text{sol}}(t),x_{\text{sol}}^\prime(t),\dots,x_{\text{sol}}^{(n)}(t)) = 0,
\nonumber
\end{gather}
and the values of $x_{\text{sol}}$,
and its derivatives up to order $n-1$, evaluated at $t_0$, satisfy
$x_{\text{sol}}(t_0) = x_0,\dots,x^{(n-1)}_{\text{sol}}(t_0) = x_{n-1}$?
Question II can be rephrased as follows. Suppose that $x_{\text{sol}}$
and $y_{\text{sol}}$ are two functions that answer question I affirmatively, i.e.,
$x_{\text{sol}}$
and $y_{\text{sol}}$ are both solutions of the I.V.P. (\ref{ivp_gen}).
Is it the case that $x_{\text{sol}}=y_{\text{sol}}$?

Some students may be puzzled by these questions, as one may initially think that 
they are trivial. ``How can an I.V.P not have a solution?" and ``How can we have
two, or more, different solutions to a problem?" a student might ask. But if we
think a little, we quickly realize that even for basic algebraic equations
it is not always the case that we can find solutions or that solutions are unique.
For instance, the equation for the variable $z$, $z^2 + 1 = 0$, does not have 
a solution over the real numbers (it will have a solution if we allow complex numbers, but if we insist that solutions ought to be real, then the equation
has no solution). And $z^2 - 3z + 2 = 0$ has two different solutions, namely,
$z=1$ and $z=2$. Thus, we should not be surprised that, in the more sophisticated
setting of D.E., where solutions are functions, there will be cases where
solutions do not exist or are not unique. In fact, the D.E. $(x^\prime)^2 + 1 = 0$
has no (real) solution.  As another example,  students
are encouraged to show that the I.V.P.
\begin{gather}
\begin{cases}
t x^\prime = 2x, \\
x(a) = b,
\end{cases}
\nonumber
\end{gather}
has no solution if $a=0$ and $b\neq 0$; infinitely many solutions if
$a=b=0$; and a unique solution (defined in a neighborhood of $a$)
if $a\neq 0$.
%Example from Edwards and Penny, 4th edition, page 26.

It is useful to have a criterion that guarantees that a given I.V.P. has a
solution, and that such a solution is unique. For first order equations, 
the following theorem is available (page 11 of the textbook).

\begin{theorem}
Consider the following I.V.P.
\begin{gather}
\begin{cases}
x^\prime = f(t,x), \\
x(t_0) = x_0.
\end{cases}
\label{ivp_first}
\end{gather}
If $f$ and $\partial_x f$ are continuous functions on some rectangle 
\begin{gather}
R = \{ (t,x): a < t < b, c < x < d \},
\nonumber
\end{gather}
containing the point $(t_0, x_0)$, then (\ref{ivp_first}) has a 
unique solution $x_{\text{sol}}$ defined on some interval
$(t_0 - \de, t_0 + \de)$, where $\de$ is some positive number.
\label{theo_exis_uniq}
\end{theorem}

As an example, consider 
\begin{gather}
\begin{cases}
x^\prime = \sin t - \cos x, \\
x(\pi) = 0.
\end{cases}
\nonumber
\end{gather}
In this case, $f(t,x) = \sin t - \cos x$, so that $\partial_x f(t,x) =
\sin x$. Since both $\sin$ and $\cos$ are continuous functions, we conclude
that theorem \ref{theo_exis_uniq} can be applied, and therefore
the problem has a solution, which is unique, defined on some interval about
$t=\pi$.

Notice that theorem \ref{theo_exis_uniq} is ``abstract," in the sense
that it does not give any idea of how the solution looks, nor does
it say how such a solution can be explicitly found. In the above example,
even though we know that there exists a unique function such that 
$x^\prime = \sin t - \cos x$ and $x(\pi) = 0$, the form of this function
remains unknown.

It is important to stress that theorem \ref{theo_exis_uniq} does 
\emph{not}
say that a solution does not exist when its hypotheses are not fulfilled.
For instance, take
\begin{gather}
\begin{cases}
x^\prime = 2\sqrt{|x|}, \\
x(0) = 0.
\end{cases}
\label{ivp_counter_ex}
\end{gather}
In this case, $f(t,x) = 2\sqrt{|x|}$, which is continuous, but
\begin{gather}
\partial_x f(t,x) = 
\begin{cases}
\frac{1}{\sqrt{x}}, & \text{ if } x > 0,\\
-\frac{1}{\sqrt{-x}}, & \text{ if } x < 0.
\end{cases}
\nonumber
\end{gather}
is not continuous at $x=0$. Thus, theorem \ref{theo_exis_uniq} cannot
be applied, but this does not mean that the problem does not have a solution.
In fact, for any $a\geq 0$, the function
\begin{gather}
x_a(t)  = 
\begin{cases}
0, & \text{ if } t \leq a,\\
(t-a)^2, & \text{ if } t \geq a.
\end{cases}
\nonumber
\end{gather}
is a solution to the  I.V.P. (\ref{ivp_counter_ex}). Notice, however, that such a solution
 is not unique,
since we can pick any $a \geq 0$.

\section{Direction fields}

From the previous section, we see that there are instances where we can 
ensure
that a given I.V.P. has a unique solution, but an explicit formula 
for the solution may not be available. As another example, consider
\begin{gather}
\begin{cases}
x^\prime = e^{-t^2}, \\
x(0) = 1.
\end{cases}
\nonumber
\end{gather}
Theorem \ref{theo_exis_uniq} can be applied to guarantee
the existence and uniqueness of a solution. Furthermore, we can 
write a formula for the solution, namely,
\begin{gather}
x(t) = 1 + \int_0^t e^{-s^2} \, ds.
\nonumber
\end{gather}
Unfortunately, as students probably learned in calculus, 
it is impossible to compute the integral
$\int_0^t e^{-s^2} \, ds$ in terms of elementary functions.
In light of situations like this, it is important to develop a method
that allows us to grasp the behavior of solutions when an explicit
formula is not available. One such tool is based on \emph{direction fields,}
which we now explain.

Consider $x^\prime = \cos(x t)$. Students can check that theorem
 \ref{theo_exis_uniq} can always be applied, regardless of the initial condition.
Hence, we know that given $(t_0,x_0)$, there exists a unique solution
with initial condition $x(t_0) = x_0$. What do solutions look like?

To answer that question, let us recall the geometric interpretation of the derivative: it is the slope of the tangent line to the graph.
 Thus, $x^\prime = \cos( t x)$
mans that, at the point $(t,x)$, the solution has slope equal to $\cos(tx)$.
As a consequence, although we do not know an expression for the curve
$x(t)$ which is the solution passing through a given point, we do have a formula
for its slope. This is enough to determine the graph of solutions,
as follows. Construct a table with the values of $t$, $x$, and 
$x^\prime = \cos(tx)$.
\begin{center}
\begin{tabular}{c|c|c}
$t$-value & $x$-value & slope $x^\prime = \cos(tx)$ \\
\hline
0.50 & 0.50  & 0.968912 \\
0.75 & 0.50 & 0.930508 \\
1.00 & 0.50 & 0.877583 \\
0.50 & 0.75  & 0.930508 \\
0.75 & 0.75 & 0.845924 \\
1.00 & 0.75 & 0.731689 \\
0.50 & 1.00  & 0.877583 \\
0.75 & 1.00 & 0.731689 \\
1.00 & 1.00 & 0.540302 
\end{tabular}
\end{center}
Next, at each point $(t,x)$ on the $tx$-plane, we draw a vector whose
slope is the value $x^\prime$ computed in the third column. \emph{By construction,
solutions have to always be tangent to these vectors.} If we use
enough points, the result is shown in figure \ref{fig1}. The plot in figure
\ref{fig1} is called a \emph{direction field.}
\begin{figure}
\includegraphics[scale=0.7]{Fig1.pdf}
\caption{Direction field for $x^\prime = \cos(tx)$.} 
\label{fig1}
\end{figure}
From the direction field, we can now read off the behavior of solutions.
For example, suppose we are interested in the solution with initial
condition $x(0) = 0$. The graph of this solution has to cross the origin, and
from the picture we see that its slope is $45^\circ$ (in fact, for $t=0=x$,
$x^\prime = \cos( 0 ) = 1$). Since the curve $x(t)$ has to be tangent to the
vectors we drew, it is seen that, as $t$ increases, $x(t)$ also increases, but 
with the vectors representing $x^\prime$ ``rotating" clock-wise, until a point
at approximately $t=1.5$ when the slope becomes horizontal. Then, the curve
starts descending toward the $t$-axis. Drawing the curve in detail yields
the plot in figure \ref{fig2}.
\begin{figure}
\includegraphics[scale=0.7]{Fig2.pdf}
\caption{Direction field for $x^\prime = \cos(tx)$, along with the solution
with initial condition $x(0)=0$.} 
\label{fig2}
\end{figure}

Naturally, figures \ref{fig1} and \ref{fig2} are computer generated.
Some of the homework problems may require the use of computers 
to build similar plots. Here, we have used the software
Mathematica. Students can use Mathematica or any other application
of their choice. Those not interested in purchasing one of these tools
may find many free applications for plotting direction fields on the web.
One package, which is suggested in the textbook, is available at:

\url{http://alamos.math.arizona.edu/~rychlik/index.php}

\noindent under ``Software."


\section{The Euler method}

The use of direction fields, illustrated in the previous section, provides
a way of analyzing solutions to a D.E. in the absence of an explicit formula.
While this is useful, in many real life applications one needs a more
precise and quantitative assessment of solutions to a given problem. 
The \emph{Euler\footnote{From Wikipedia: ``Leonhard Euler (15 April 1707 - 18 September 1783) was a pioneering Swiss mathematician and physicist. He made important discoveries in fields as diverse as infinitesimal calculus and graph theory. He also introduced much of the modern mathematical terminology and notation, particularly for mathematical analysis, such as the notion of a mathematical function. (...) 
Euler is considered to be the pre-eminent mathematician of the 18th century and one of the greatest mathematicians to have ever lived. He is also one of the most prolific mathematicians; his collected works fill 60-80 quarto volumes."} method,} which we shall now present, fulfills this
requirement, providing a systematic way of constructing
an explicit \emph{approximation} to the solution of an I.V.P.

The basic idea of the Euler method is, once again, to rely on the geometric
meaning of the derivative. Suppose we want to solve
\begin{gather}
\begin{cases}
x^\prime = f(t,x), \\
x(t_0) = x_0.
\end{cases}
\nonumber
\end{gather}
Assume that theorem \ref{theo_exis_uniq} can be applied, so that we know
that a solution satisfying the given initial condition exists and is unique.
Denote the solution by $x_{\text{sol}}$.
Since  $t_0$, $x_{\text{sol}}(t_0) = x_0$, and $f$ are given, we can compute 
the slope of the tangent line to $x_{\text{sol}}$ at the
point $(t_0,x_0)$, namely, $x_{\text{sol}}^\prime(t_0) = f(t_0,x_0)$. 
From this information,
we would like to determine the value of the solution $x_{\text{sol}}$ at another \emph{chosen} point $t_1$
different than $t_0$. If $t_1$ is very close to $t_0$ then, from basic
 calculus,
we know that the graph of $x_{\text{sol}}(t)$ is very close to the graph of the tangent 
line to the point $(t_0,x_0)$. But the latter can be found; it is given by
\begin{gather}
x = x_0 + (t-t_0) f(t_0,x_0).
\label{Euler_1}
\end{gather}
Thus, the value we are seeking to determine, $x_{\text{sol}}(t_1)$, which we call $x_1$,
 can be approximated
with the help of (\ref{Euler_1}), and we find
\begin{gather}
x_1 = x_{\text{sol}}(t_1) \approx x_0 + (t_1-t_0) f(t_0,x_0).
\nonumber
\end{gather}
Now that we know the (approximate) value of $x_{\text{sol}}(t_1)$, we can
compute the value of the slope at the point $(t_1,x_1)$, namely,
$f(t_1,x_1)$. The graph of $x_{\text{sol}}$ in neighborhood
of $(t_1,x_1)$ is close to the graph of the tangent line at that point, given
by
\begin{gather}
x = x_1 + (t-t_1) f(t_1,x_1).
\nonumber
\end{gather}
The reader has probably realized that we can now repeat the argument: if
we want the value $x_{\text{sol}}(t_2)$ at a point $t_2$ that is close to
$t_1$, we can use the approximation
\begin{gather}
x_2 = x_{\text{sol}}(t_2) \approx x_1 + (t_2-t_1) f(t_1,x_1).
\nonumber
\end{gather}
Proceeding in this way, one finds a sequence of points 
\begin{gather}
\{ (t_0,x_0), (t_1, x_1), (t_2, x_2),\dots \}
\nonumber
\end{gather}
that provides an approximation to the solution $x_{\text{sol}}$. In other words,
plotting the points $(t_n, x_n)$, $n=0,1,2,\dots$, and joining them by a straight
line, provides an approximation to the graph of $x_{\text{sol}}$. This
idea is illustrated in figure \ref{fig3}, except that in this figure
the variables have been labeled $(x,y)$ instead of $(t,x)$.

\begin{figure}
\includegraphics[scale=0.7]{Fig3.pdf}
\caption{Illustration of the Euler method. This is figure 1.15 from page
24 of the textbook.} 
\label{fig3}
\end{figure}

It should be emphasized that this procedure relies crucially on the fact
that
 the  points $t_1, t_2,\dots$  are always close to their predecessors, i.e. 
the difference $t_{n+1} - t_n$, $n=0,1,2,\dots$ has to be very small.
The difference
$t_{n+1} - t_n$ is called the \emph{step size,} henceforth denoted by $h$:
\begin{gather}
h = t_{n+1} - t_n.
\nonumber
\end{gather}
$h$ is a value that is conveniently chosen. Naturally, the smaller the $h$,
the better the approximation. On the other hand, the smaller the $h$, the larger
the number of steps that have to be computed to go from $t_0$ to a desired value
$t$. Once $h$ is chosen, we have the following recursive formula for $t_n$:
\begin{gather}
t_{n+1} = t_n + h,
\nonumber
\end{gather}
or, equivalently,
\begin{gather}
t_{n+1} =  (n+1)h + t_0.
\nonumber
\end{gather}
Summarizing, the Euler method is encoded in the following recursive
relations,
\begin{gather}
\begin{cases}
t_{n+1} = t_n + h, \\
x_{n+1} = x_n + h f(t_n,x_n),
\end{cases}
\label{Euler_rec}
\end{gather}
where $t_0$, $x_0$, and $f$ are given, and $h$ is chosen.

As an illustration, consider again $x^\prime = \cos(t x)$ with initial
condition $x(0) = 0$. Suppose we want to find $x(1.5)$.
Choosing $h = 0.5$ and applying (\ref{Euler_rec}), we
find the following sequence of values $\{(t_n,x_n)\}$:
\begin{gather}
\{ (0, 0), (0.5, 0.498814), (1., 0.939901), (1.5, 1.10945) \}.
\nonumber
\end{gather}
The desired approximation, $x(1.5)$, is the last entry in the list,
$x(1.5) \approx 1.10945$.

Using a better step size, $h=0.1$, we find
\begin{gather}
\{
(0, 0), (0.1, 0.1), (0.2, 0.199995), (0.3, 0.299915), (0.4, 
  0.399511), (0.5, 0.498236), (0.6, 0.595149),
  \nonumber \\
  (0.7, 0.688841), (0.8, 
  0.777439), (0.9, 0.858714), (1., 0.930307), (1.1, 0.990065),
  \nonumber \\
   (1.2, 
  1.0364), (1.3, 1.06853), (1.4, 1.0866), (1.5, 1.09155) \}.
\nonumber
\end{gather}
Thus, with $h=0.1$, $x(1.5) \approx 1.09155$.
If we insist on an even smaller $h$, $h = 0.01$, the list is
\begin{gather}
\{ 
(0., 0.), (0.01, 0.01), (0.02, 0.02), (0.03, 0.03), (0.04, 
  0.04), 
  \nonumber \\
  (0.05, 0.05), (0.06, 0.06), (0.07, 0.0699999), 
  \nonumber \\
\dots , \nonumber \\
  (1.46, 1.06089), (1.47, 1.06111), (1.48, 1.06122), (1.49, 
  1.06122), (1.5, 1.06111)
\},
\nonumber
\end{gather}
and in this case
$x(1.5) \approx 1.06111$. Notice how the values of $x(1.5)$
change with different choices of $h$. Since smaller $h$'s provide 
better approximations, we see that the last value, 
$x(1.5) \approx 1.06111$ is a more accurate approximation of the 
actual value of $x(1.5)$ (which we do not know) than the previous
two estimates, i.e., $1.09155$ and 
$1.10945$.

But how small does $h$ have to be? If the value we want changes every time 
we change $h$, how can we be confident that what we obtained 
is a good approximation to the actual solution? This is a very important
question, whose answer is beyond the scope of our course\footnote{The 
student interested in these type of questions should consider taking a course
in numerical analysis.}. Here, it suffices to say that, in many 
practical situations,
one keeps decreasing the value of $h$ until the point where our solution
``stabilizes," i.e., the values we compute no longer change very much with decreasing $h$. For instance, if we go ahead and use $h=0.001$, we find 
again $x(1.5) \approx 1.06111$, i.e., the difference to the case
$h=0.01$ happens only after the fifth decimal place. Thus, if we are interested
in, say, solutions up to three or four decimal digits, $h=0.01$ is enough.

We remark that the above values were obtained with the help of a computer.
Here, once more, we have employed Mathematica, but students are free
to use whatever software they find appealing (again, there are many free
tools on the web). In fact, for the homework problems, students will
not be asked to use many steps, and the computations, albeit tedious, can be done
by hand with the help of a four-function calculator.



\bibliographystyle{plain}
\bibliography{References.bib}

\end{document}
