\documentclass[12pt]{article}

\usepackage{amsmath}
\usepackage{amssymb}

\usepackage{color}

%\usepackage[textheight=8.5in, margin=1.6in]{geometry}
\usepackage[total={6in,8in}]{geometry}

\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
%\tikzstyle{ball} = [circle,shading=ball, ball color=black,
%    minimum size=1mm,inner sep=1.3pt]
%\usetikzlibrary{arrows.meta}
%\tikzset{>={Latex[length=2mm,width=1.5mm]}}

%\usepackage{graphicx}

\usepackage{enumitem}
\setlist[enumerate]{leftmargin=*}

\usepackage{needspace}  % <-- to prevent bad pagebreak over environment titles
% Use:  \Needspace{3\baselineskip} before opening an environment

\usepackage[colorlinks=true,citecolor=black,linkcolor=black,urlcolor=blue]{hyperref}

\newcommand{\N}{\mathbb{N}}
\newcommand{\Z}{\mathbb{Z}}
\newcommand{\Q}{\mathbb{Q}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\C}{\mathbb{C}}
\newcommand{\sn}{\mathfrak{S}}
\newcommand{\ve}{\varepsilon}
\newcommand{\ips}[2]{\langle{#1}, {#2}\rangle}
\DeclareMathOperator{\tr}{tr}
\DeclareMathOperator{\Span}{\mathrm{Span}}
\DeclareMathOperator{\rk}{\mathrm{rank}}
\DeclareMathOperator{\trace}{\mathrm{tr}}
\DeclareMathOperator{\im}{\mathrm{im}}
\DeclareMathOperator{\Sym}{\mathrm{Sym}}
\DeclareMathOperator{\Hom}{\mathrm{Hom}}
\DeclareMathOperator{\diag}{\mathrm{diag}}
\DeclareMathOperator{\glb}{\mathrm{glb}}
\DeclareMathOperator{\lub}{\mathrm{lub}}

\parskip = 0.05in
\parindent = 0.0in

%\pagestyle{empty}

\begin{document}
\centerline{Math 322 lecture for Wednesday, Week 2}
\bigskip

{\bf Aside on Bernoulli-type equations.}  Imagine a moving particle with
velocity~$v$ and a force~$F=F(v)$ acting on the particle against its direction of motion---a
frictional force.  It is reasonable to assume~$F(-v)=-F(v)$.  Now suppose
that~$F$ has a power series expansion
\[
  F(v)= a_0+a_1v+a_2v^2+\dots.
\]
The fact that~$F(-v)=-F(v)$ implies that the even terms vanish:
\[
  F(v) = a_1v+a_3v^3+a_5v^5+\dots
\]
As a first approximation, we could take
\[
  F(v) =a_1 v
\]
Since force is proportional to acceleration, i.e.,~$F(v)=\text{constant}\cdot
v'$, we can write this model of friction as
\[
  v'=\alpha v.
\]
The solution is~$v=e^{\alpha t}$, and for our purposes, we take~$\alpha<0$.  The next best
approximation is to use the first two terms of the series:
\[
  v'=\alpha v+\beta v^3,
\]
which is a Bernoulli-type equation.  Question: what is the behavior of a
particle whose motion is governed by this equation?
\medskip

{\bf LHCC.} We now continue our discussion of linear homogeneous constant
coefficients equations.  These have the form
\[
  y^{(n)}+a_{n-1}y^{(n-1)}+\cdots+a_1y'+a_0y=0,
\]
or, more succinctly,
\[
P(D)y=0
\]
where~$D=d/dt$ and~$P(x)=\sum_{i=0}^na_ix^i$.  The trick is to look for
solutions of the form~$y=e^{rt}$.  We have~$P(D)e^{rt}=P(r)e^{rt}$.  So we have
a solution of that form exactly for the zeros of~$P$.
\medskip

{\bf Example.} Solve
\[
y''-4y'+13y=0
\]
with initial conditions~$y(0)=0$ and~$y'(0)=1$.
\medskip

{\sc solution:} Find the zeroes of the characteristic polynomial (quadratic
  equation to the rescue!):
\[
  r^2-4r+13=0\quad\Rightarrow\quad r=2\pm3i.
\]
So the general solution is
\[
  y = Ae^{(2+3i)t}+Be^{(2-3i)t}.
\]
We would like to express the solution in terms of real numbers:
\begin{align*}
  y &=  Ae^{(2+3i)t}+Be^{(2-3i)t}\\
&= Ae^{2t}(\cos(3t)+i\sin(3t))+Be^{2t}(\cos(3t)-i\sin(3t))\\
&= (A+B)e^{2t}\cos(3t)+(A-B)ie^{2t}\sin(3t))\\
&= ae^{2t}\cos(3t)+be^{2t}\sin(3t).
\end{align*}
The general real solution is
\[
  y = ae^{2t}\cos(3t)+be^{2t}\sin(3t).
\]
Now we handle the initial conditions:
\[
  0=y(0)=ae^{0}\cos(0)+be^{0}\sin(0)=a.
\]
So~$y=be^{2t}\sin(3t)$.  Then
\[
  1=y'=3be^{0}\cos(0)+2be^0\sin(0)=3b.
\]
So the solution is
\[
  y=\frac{1}{3}e^{2t}\sin(3t)
\]
Graph of solution:
\begin{center}
\begin{tikzpicture}
  \begin{axis}[
      scale=0.8,
      %title style={at={(0.5,0)},anchor=north,yshift=-30},
      %title={\mbox{\parbox{\textwidth}{Graph of~$P(t)$ with~$K=1000$ and~$P(0)=10$ and two different
      %growth rates:~$r=0.5$ in red and~$r=0.2$ in blue.}}},
      axis lines = middle,
      axis line style={->},
      %axis equal image,
      %xmin=-0.2,
      %xmax=5,
      %ymin=-0.2,
      %ymax=1100,
    ]
    %\fill[blue] (axis cs: 1,1) circle (2pt);  
    %\fill[draw=black,fill=white] (axis cs:1,0) circle (2pt);  
    \addplot[domain=-2:2,thick, samples=100,blue] {exp(2*x)*sin(deg(3*x))/3};
  \end{axis}
\end{tikzpicture}
\end{center}

There is one final wrinkle in the story: what if~$P(r)$ has a repeated root?
Say~$P(r)$ has a factor of the form~$(r-\lambda)^k$.  In that case, the general
solution will include~$a_0e^{\lambda t}+a_1te^{\lambda t}+\dots+a_kt^{k-1}e^{\lambda t}$.
We will be able to understand why this is the case once we move to the
higher-dimensional linear theory.  For now, you're invited to check
that~$(D-\lambda)^kt^{\ell}e^{\lambda t}=0$ for $0\leq\ell\leq k-1$ by hand.
That way, you'll at least see these are solutions.
\medskip

{\bf Examples.}
\begin{enumerate}
  \item Consider the equation
    \[
      y'''+6y''+12y'+8y=0.
    \]
    Its characteristic polynomial is
    \[
      P(r)=r^3+6r^2+12r+8=(r+2)^3.
    \]
    So~$P(r)$ as the root~$r=-2$ of multiplicity~$3$.  The general solution to
    the equation is therefore
  \[
    y = ae^{-2t}+bte^{-2t}+ct^2e^{-2t}=(a+bt+ct^2)e^{-2t}.
  \]
\item  Consider the equation
  \[
    y^{(5)}+3y^{(4)}+3y^{(3)}+y^{(2)}=0.
  \]
  Its characteristic polynomial is
  \[
    P(r) = r^5+3r^4+3r^3+r^2=r^2(r+1)^3.
  \]
  The roots are~$r=0$ with multiplicity~$2$ and~$r=-1$ with
  multiplicity~$3$.  Notice that the root~$r=0$ will correspond to solutions
  involving~$e^{0\cdot t}=1$.  The general solution is
  \[
    a_1+a_2t+a_3e^{-t}+a_4te^{-t}+a_5t^2e^{-t}.
  \]
\item Say we are considering a LHCC differential equation with characteristic
  polynomial
  \[
    P(r)=r^3(r-2)^2(r^2+9)^2=0.
  \]
  The roots are ~$r=0,2,\pm 3i$ with multiplicities~$3,2,2$, respectively.  The
  general solution is
  \begin{align*}
    y&=a_1+a_2t+a_3t^2+b_1e^{2t}+b_2te^{2t}+c_1\cos(3t)+c_2\sin(3t)+c_3t\cos(3t)+c_4t\sin(3t).
  \end{align*}
\end{enumerate}
\bigskip

\textbf{V. Method of undetermined coefficients.} 
\bigskip

We now consider inhomogeneous linear equations with constant coefficients.
These have the form
\[
  P(D)y = f(t).
\]
Where~$P$ is a polynomial and~$D=d/dt$, as before.  To solve this equation, we
first try to find a particular solution~$y_p$.  We then find a general
solution~$y_h$
to~$P(D)y=0$, the associated homogeneous system.  The general solution 
to the inhomogeneous system is then~$y_h+y_p$.  The new challenge here is to
find the particular solution,~$y_p$.  The idea we will use is to guess the form
of~$y_p$ and adjust parameters.  Here is a table that may be of help (``poly'' means ``polynomial''):
\begin{center}
  \begin{tabular}{l|l}
    $f(t)$&guess\\\hline
polynomial& general polynomial of some degree\\
    \rule[5pt]{0pt}{10pt} $e^{rt}$&$ae^{rt}$\\
$(\text{poly})e^{rt}$&$(\text{general poly})e^{rt}$\\
    $\cos(\omega t)$ or~$\sin(\omega t)$&$a\cos(\omega t)+b\sin(\omega t)$\\
    $(\text{poly})e^{rt}\cos(\omega t)$ or~$(\text{poly})e^{rt}\sin(\omega
    t)$&$(\text{gen poly})e^{rt}\cos(\omega t)+(\text{gen poly})e^{rt}\sin(\omega t)$\\
  \end{tabular}
\end{center}
\medskip

{\bf Example.} Consider the equation
\[
  y''-2y'+y=t^2.
\]
We guess a particular equation of the form
\[
  y=a_0+a_1t+a_2t^2.
\]
In that case, we have
\begin{align*}
  y''-2y'+y
  &= 2a_2-2(a_1+2a_2t)+(a_0+a_1t+a_2t^2)\\
  &= (2a_2-2a_1+a_0)+(-4a_2+a_1)t+a_2t^2.
\end{align*}
Set this equal to~$t^2$ and compare coefficients:
\begin{align*}
  0&= 2a_2-2a_1+a_0\\
  0&= -4a_2+a_1\\
  1&= a_2.
\end{align*}
Solving the system gives
\[
 a_0=6 ,\ a_1=4,\ a_2=1.
\]
So a particular solution is
\[
  y_p=6+4t+t^2.
\]
(Check!)
We now solve the associated homogeneous equation
\[
  y''-2y+y=0.
\]
The characteristic polynomial is
\[
r^2-2r+1=(r-1)^2,
\]
which has the zero~$r=1$ with multiplicity~$2$.  So the general solution to the
homogeneous system is
\[
y_h = ae^{t}+bte^{t}.
\]
The most general solution to the original equation is then
\[
y = y_h+y_p=ae^{t}+bte^{t}+6+4t+t^2.
\]
Suppose we are given initial conditions~$y(0)=1$ and~$y'(0)=-2$.  Then
\begin{align*}
1&= y(0)=a+6\\
-2&= y'(0)=a+b+4.
\end{align*}
Therefore,~$a=-5$ and~$b=-1$.  The solution is
\[
y= -5e^{t}-te^{t}+6+4t+t^2.
\]
Graph of solution:
\begin{center}
\begin{tikzpicture}
  \begin{axis}[
      scale=0.8,
      %title style={at={(0.5,0)},anchor=north,yshift=-30},
      %title={\mbox{\parbox{\textwidth}{Graph of~$P(t)$ with~$K=1000$ and~$P(0)=10$ and two different
      %growth rates:~$r=0.5$ in red and~$r=0.2$ in blue.}}},
      axis lines = middle,
      axis line style={->},
      %axis equal image,
      %xmin=-0.2,
      %xmax=5,
      ymin=-3,
      %ymax=1100,
    ]
    %\fill[blue] (axis cs: 1,1) circle (2pt);  
    %\fill[draw=black,fill=white] (axis cs:1,0) circle (2pt);  
    \addplot[domain=-3:1.1,thick, samples=100,blue]
    {-5*exp(x)-x*exp(x)+6+4*x+x*x};
  \end{axis}
\end{tikzpicture}
\end{center}
\end{document}
