\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 Monday, Week 2}
\bigskip

{III.~A. First-order linear.}  
\bigskip

A first-order linear equation has the form
\[
  \frac{dy}{dt}+p(t)y=q(t).
\]
It is solved using the integrating factor~$\displaystyle e^{\int\! p(t)\,dt}$:
multiplying the equation through by this factor gives
\begin{equation}
  e^{\int\! p(t)\,dt)}\left(\frac{dy}{dt}+p(t)y\right)=e^{\int\! p(t)\,dt}q(t).
  \label{eqn1}
\end{equation}
By the chain rule and the fundamental theorem of calculus, the left-hand side of this equation is
\[
  \frac{d}{dt}\left( e^{\int\! p(t)\,dt}y \right).
\]
So we can integrate equation~\eqref{eqn1} to get
\[
e^{\int\! p(t)\,dt}y = \int e^{\int\! p(t)\,dt}q(t)\,dt,
\]
and then solve for~$y$.
\medskip

{\bf Example.} Consider the following equation
\[
  \cos(t)\,y'+y=\sin(t)
\]
with initial condition~$y(0)=1$.
Dividing by~$\cos(t)$ puts the equation into standard form (note
that~$\cos(t)\neq 0$ near~$t=0$):
\[
  y'+\sec(t)\,y=\tan(t).
\]
The integrating factor is
\[
  e^{\int\! \sec(t)\,dt }= e^{\ln(\sec(t)+\tan(t))}=\sec(t)+\tan(t).
\]
(Near~$t=0$, we have~$\sec(t)+\tan(t)>0$.
Multiplying the equation through by the integrating factor gives
\[
  (\sec(t)+\tan(t))\,y'+(\sec^2(t)+\sec(t)\tan(t))\,y=(\sec(t)+\tan(t))\tan(t).
\]
Integrate both sides:
\begin{align*}
  (\sec(t)+\tan(t))y 
  &=  \int(\sec(t)+\tan(t))\tan(t)\,dt\\
  &=  \int(\sec(t)\tan(t)+\tan^2(t))\,dt\\
  &=  \int\sec(t)\tan(t)\,dt+\int\tan^2(t))\,dt\\
&=  \sec(t)+\int\tan^2(t))\,dt\\
&=  \sec(t)+\int\left( \sec^2(t)-1 \right)\,dt\\
&=  \sec(t)+\tan(t)-t+c
\end{align*}
Therefore,
\[
  y=\frac{\sec(t)+\tan(t)-t+c}{\sec(t)+\tan(t)}.
\]
Let's write this in terms of the initial condition:
\[
  1=y(0)=\frac{\sec(0)+\tan(0)+c}{\sec(0)+\tan(0)}=1+c.
\]
So~$c=0$, and the solution is
\[
  y=\frac{\sec(t)+\tan(t)-t}{\sec(t)+\tan(t)}=1-\frac{t}{\sec(t)+\tan(t)}.
\]
Here is a plot of the slope field and our solution:
\begin{center}
  \begin{tikzpicture}
    \node at (0,0) {\includegraphics[height=2in]{02monfig1.png}};
    \node at (0,-2.8) {$t$};
    \node at (-2.8,0) {$y$};
  \end{tikzpicture}
\end{center}
Note the weirdness around~$t=\pi/2$, where~$\cos(t)$ is~$0$.  It's exactly where
we divide by zero in our calculations where the interesting stuff happens.
\bigskip

{III.~B. Bernoulli-type first-order linear.}  
\bigskip

We are now interested in solving an equation of the form
\[
  \frac{dy}{dt}+p(t)y=q(t)y^m,
\]
where~$m\neq 1$.  The trick here is to reduce the equation to a standard first-order linear
equation with the substitution~$u=y^{1-m}$.  In that case, we have
\[
  u'=(1-m)y^{-m}y'.
\]
Multiply the original equation through by~$(1-m)y^{-m}$
\[
  (1-m) y^{-m}y'+(1-m)p(t)y^{1-m}=(1-m)q(t)
\]
and substitute:
\[
  u'+(1-m)p(t)u=(1-m)q(t).
\]
\medskip

{\bf Example.}  Consider the equation
\[
  y'=\frac{2y}{t}-t^2y^2
\]
with initial condition~$y(1)=-2$.  This is Bernoulli-type with~$m=2$, so we make
the substitution~$u=y^{-1}$.  This transforms the equation into the first-order
linear equation
\[
  u'+\frac{2u}{t}=t^2.
\]
The integrating factor is
\[
  e^{\int(2/t)\,dt} = t^2.
\]
Multiply through by it and integrate:
\begin{align*}
  t^2u'+2tu=t^4
  &\quad\Rightarrow\quad \frac{d}{dt}(t^2u)=t^4\\[8pt]
  &\quad\Rightarrow\quad t^2u=\int t^4\,dt=\frac{1}{5}t^5+c\\[8pt]
  &\quad\Rightarrow\quad \frac{t^2}{y}=\frac{1}{5}t^5+c\\[8pt]
\end{align*}
The initial condition gives us:
\[
  -\frac{1}{2}=\frac{1}{5}+c\quad\Rightarrow\quad c = -\frac{7}{10}.
\]
The solution is
\[
  \frac{t^2}{y}=\frac{1}{5}t^5-\frac{7}{10}
  \quad\Rightarrow\quad
  y = \frac{10t^2}{2t^5-7}.
\]
The slope field and our solution:
\begin{center}
  \begin{tikzpicture}
    \node at (0,0) {\includegraphics[height=2in]{02monfig2.png}};
    \node at (0,-2.8) {$t$};
    \node at (-2.8,0) {$y$};
  \end{tikzpicture}
\end{center}
\bigskip

{IV.~A. Linear homogeneous constant coefficients (LHCC).}  
\bigskip

We are now interested
in solving a differential equation of the form
\[
  y^{(n)}+a_{n-1}y^{(n-1)}+\cdots+a_1y'+a_0y=0
\]
where~$y^{(i)}$ denotes the~$i$-th derivative of~$y$ with respect to~$t$.
The~$a_i$ are constants.  The word ``homogeneous'' refers to the fact that
a~$0$ appears to the right of the equals sign. Letting~$D:=d/dt$, we can write
the above equation as
\[
  (D^n+a_{n-1}D^{n-1}+\cdots+a_1D+a_0)y=0
\]
or just
\[
  P(D)y=0
\]
where~$P$ is the polynomial~$P(x)=\sum_{i=0}^na_ix^i$.  

\Needspace{3\baselineskip}
\textbf{Main theory.}
\begin{enumerate}
  \item The solution space is linear: suppose that~$y_1$ and~$y_2$ are
    solutions, i.e.,~$P(D)y_1=P(D)y_2=0$.  Let~$\alpha$ be a constant.
    Then
    \[
      P(D)(y_1+\alpha y_2)=P(D)y_1+\alpha\,P(D)y_2=0
    \]
    by linearity of differentiation.
  \item The ``basic'' solutions have the form~$e^{rt}$ (more on this later). 
  \item When determining which values for~$r$ are suitable, something nice
    happens: 
    \[
      P(D)e^{rt}=\sum_{i=0}^na_iD^{i}e^{rt}=\sum_{i=0}^na_ir^ie^{rt}=P(r)e^{rt}.
    \]
    Since~$e^{rt}>0$, we get a solution~$P(D)e^{rt}=0$ if and only if~$P(r)=0$.
    So the values for~$r$ that give solutions are exactly the zeros of the polynomial~$P$.
    The polynomial~$P(r)$ is called {\em characteristic polynomial} for the
    equation.
  \item For uniqueness, we specify~$y(t_0),\dots,y^{(n-1)}(t_0)$.
\end{enumerate}

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

    {\sc solution:} Find the zeros of the characteristic polynomial:
    \[
      P(r)=r^2-r-6=(r+2)(r-3)=0\quad\Leftrightarrow\quad r=-2,3.
    \]
    The general solution is
    \[
      y=ae^{-2t}+be^{3t}.
    \]
    To satisfy the initial conditions, we need
    \begin{align*}
      a+b&= 0\\
      -2a+3b&= 1.
    \end{align*}
    Solving this system gives~$a=-1/5$ and~$b=1/5$.  So the solution is
    \[
      y = -\frac{1}{5}\,e^{-2t}+\frac{1}{5}\,e^{3t}.
    \]
    A graph of the 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=-1:1,thick, samples=100,blue] {-exp(-2*x)/5+exp(3*x)/5};
  \end{axis}
\end{tikzpicture}
\end{center}
\end{document}


