\documentclass[11pt,reqno]{amsart}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Math packages
\usepackage{amscd} %for diagrams
\usepackage{amsfonts} %extra math fonts
\usepackage{amsmath} %miscellaneous enhancements for math formulas
%\usepackage{amsrefs} %package for bibliographies
%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} %\mathscr sommand
\usepackage{mathtools} %provides a series of packages designed to enhance 
\usepackage{systeme}
\usepackage{wrapfig}
%the apppearance of documents containing a lot of mathematics
%\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}  %Useful for the Physicist’s ‘Feynman slashed character’ notation.
%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Basic general latex packages
\usepackage{verbatim}
\usepackage{cases}
\usepackage[dvips]{epsfig}
\usepackage{epsf} %The original (and now obsolescent) graphics inclusion 
%macros for use with dvips, still widely used by Plain TEX users (in particular).
%\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{tikz}
\usetikzlibrary{decorations.pathreplacing}
\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} %commands for Pi fonts
\usepackage{upgreek} %upright Greek letters
\usepackage{fancyhdr} %extensive facilities, both for constructing headers and footers, 
%and for controlling their use
\usepackage{calligra} %calligraphic font in the handwriting style
\usepackage{marvosym} %Euro currency symbol as defined by the European commission, 
%along with symbols for structural engineering; symbols for steel cross-sections; 
%astronomy signs (sun, moon, planets); the 12 signs of the zodiac; scissor symbols; 
%CE sign and others.
\usepackage[percent]{overpic} %a cross between the LATEX picture environment and 
%the \includegraphics command
\usepackage{pict2e} %extends the existing LATEX picture environment
\usepackage[hypcap=false]{caption} %option false to avoid warning when hyperref is loaded
\usepackage{wasysym} %The WASY2 (Waldi Symbol) font by Roland Waldi provides many 
%glyphs like male and female symbols and astronomical symbols, as well as the 
%complete 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}]{\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}                  } 
%%%%%%%%%%%%%%%%


\begin{document}
%The [Short title] and [Disconzi] will be overriden by the Header, running title commands
\title[MATH 2420]{MATH 2420 - Methods of Ordinary Differential Equations}
\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*{About these notes} These notes have been typeset almost verbatim from my handwritten class notes. The latter have been written for my own use in class and are not intended as a primary source for the course. Thus, the presentation that follows is rough and schematic at some points. Nevertheless, students might find useful to have direct access to my class notes. We warn the reader that these notes have not (yet) been carefully checked for typos, mistakes, etc. Please do let me know if you find inconsistencies, wrong signs, missing factors, or other errors. In particular, if you are confident that  your calculation is correct but it does not match what is given here, it is likely that there is a typo in the notes.

\section*{Abbreviations used throughout}
The following abbreviations are used in the text and/or in class:
\begin{itemize}
	\item DE = differential equation(s).
	\item ODE = ordinary differential equation(s).
	\item PDE = partial differential equation(s).
	\item IVP = initial value problem.
	\item IC = initial conditions.
	\item iff = if and only if.
	\item EX = example.
	\item Def = definition.
	\item Theo = theorem.
	\item Prop = proposition.
	\item LHS = left hand side.
	\item RHS = right hand side.
	\item $\Rightarrow$ means ``implies," e.g., $A \Rightarrow B$ reads ``$A$ implies $B$."
	\item \qedsymbol \space = indicates the end of a proof.
	\item We write $f=f(x)$ to mean ``$f$ is a function of $x$" and similarly, e.g., $z = z(t)$ for ``$z$ is a function of $t$," etc.
\end{itemize}

\section{Introduction\label{S:Introduction}}

%To bold citations
%https://tex.stackexchange.com/questions/251613/can-cite-use-bold-font
%https://tex.stackexchange.com/questions/8351/what-do-makeatletter-and-makeatother-do
%Need to do it only once, after that can use \textbf{\cite{ }}.
%\makeatletter
%\def\@cite#1#2{[\textbf{#1\if@tempswa , #2\fi}]}
%\makeatother
%\cite{DisconziSpeckRelEulerNull}.%
%\makeatletter
%\def\@cite#1#2{[#1\if@tempswa , #2\fi]}
%\makeatother

\subsection{What is a differential equation?}
We are all familiar with algebraic equations, 
e.g.,
\begin{align*}
	x^2 + 2x + 3 = 0.
\end{align*}
Here, the unknown is the variable $x$, and the solution of this equation is a number that satisfies it. In this case, $x = 1$ and $x = -3$ are solutions because
\begin{align*}
	1^2 + 2 \cdot 1 - 3 = 0 \text{ and } (-3)^2 + 2 \cdot (-3) - 3 = 0,
\end{align*}
whereas $ x = 2$ is not a solution since
\begin{align*}
	2^2 + 2 \cdot 2 - 3 \neq 0.
\end{align*}
We can consider similar situations where the unknown is a function:
\begin{align*}
	x f(x) - 2 + 3 x^2 = 0.
\end{align*}
Solving for $f(x)$ gives
\begin{align*}
	f(x) = \frac{2-3x^2}{x} \ \  (x \neq 0).   
\end{align*}
More generally, we can have an equation for an unknown function $f$ where derivatives of $f$ also appear, e.g.,
\begin{align*}
	\frac{df}{dx}  - 3 \cos x = 0.
\end{align*}
Here, we want to find a function $f(x)$ whose derivative equals $3 \cos x$. We know from calculus how to find such a function:
\begin{align*}
	\frac{df}{dx}  - 3 \cos x = 0 &\Rightarrow \int \frac{df}{dx} dx = 3 \int \cos x \ dx \\
	&\Rightarrow f(x) = 3 \sin x + C, \text{ where } C \text{ is a constant of integration. }
\end{align*}

\begin{center}
	\fbox{
		\begin{minipage}{10cm}
			\centering
			\strut An equation relating an unknown function and one or more \\
			\strut of its derivatives is called a \textbf{differential equation (DE)}.
		\end{minipage}
	}
\end{center}

\begin{example}
	These are DE:
	\begin{align*}
		\frac{dy}{dx} + y^2 x &= 0 \indent \text{variable: } x,\text{ function } y = y(x), \\
		\frac{dx}{dt} + e^{-t^2} &= 0 \indent \text{variable: } t,\text{ function } x = x(t).
	\end{align*}
	These are \textbf{not} DE:
	\begin{align*}
		x^2 - 4 &= 0, \\
		\int \cos (x(t)) \ dt &= e^t + x(t), \\
		\int 
        \big(y(x)\big)^2 \ dx &= \frac{dy}{dx} + 5x.
	\end{align*}
	(The second equation is called an \textbf{integral equation} and the third one an \textbf{integral-differential equation}.)
\end{example}

\subsection{Why do we study DE?\nopunct}
Let's investigate the following example.
Consider a spring that has length $1 \text{ m}$ when it is not subject to any force. One end of the spring is attached to a wall, and the other end to a body of mass $2 \text{ kg}$, as in the figure below:

\begin{figure}[H]
	\centering
	\includegraphics[scale=.9]{./pic/p6.pdf}
    \caption{Mass attached to a spring Before and After stretching}
\end{figure}

Suppose that you pull the body horizontally, stretching the spring $20 \text{ cm}$, and then release it. The body is going to oscillate back and forth. What is its position after $10 \text{ seconds}$? (Disregard friction between the body and floor. Consider that the spring has constant $k = 50 \text{ N/m}$.)\\\\
From Hooke's Law, we know that the force acting on the body due to the spring is $F = - k x$, where $x$ is the displacement with respect to the equilibrium position, which we identify with $x=0$.\\\\
Since $-kx$ is the only force acting on the body, it equals $ma$, where $m$ is the mass of the block and $a$ its acceleration: 
\begin{align*}
ma = -kx \  \Rightarrow \ a = -25 x \, \text{, since }m = 2 \text{ kg and } k = 50  \text{ N/m}.
\end{align*}
The position $x$ is a function of time, $x = x(t)$. We want to know $x(10)$ (position at $t = 10 $s). Since the acceleration is the second time derivative of the position, 
\begin{align*}
	a = \frac{d^2x}{dt^2} \text{, thus }\ \frac{d^2x}{dt^2} + 25x = 0.
\end{align*}
This is a DE for the unknown function $x$. We'll learn later on how to find $x$. For now, we can verify that $x(t) = 0.2  \cos(5t)$ is the desired solution to the above DE since:
\begin{align*}
	\frac{d^2}{dt^2} \big(0.2 \cos(5t)\big) + 25 \cdot 0.2\cos(5t) ) &= -0.2 \cdot 25 \cdot \cos(5t) + 0.2 \cdot 25 \cdot \cos(5t)  \\
	&= 0.
\end{align*}
The factor $0.2$ stems from the fact that at time zero the position of the block is $20 \text{ cm} = 0.2 \text{ m}$, so that $x(0) = 0.2 \cos(5 \cdot 0) = 0.2$. We can now calculate
\begin{align*}
	x(10) = 0.2 \cos(5 \cdot 10) \approx 0.19 \text{ m}.
\end{align*}

\subsection{Some terminology and notation} 
We will use $\frac{d}{dt}, \frac{d}{dx}, {}^\prime$ etc. to denote the derivative. Hence, particular names given to variables and functions can change, and the same equation might be written in different forms. E.g.,
\begin{align*}
	x^{\prime\prime} - 5x^\prime = e^x \text{ and } \frac{d^2y}{dt^2} - 5 \frac{dy}{dt} = e^y \text{ both represent the same DE.}
\end{align*}

\begin{definition}
	The \textbf{order} of a DE is the order of the highest derivative that it contains. For example, $y^{\prime\prime\prime} + xy^2 = 0$ is a DE of $3^{rd}$ order. 
\end{definition}

\begin{definition}
A \textbf{solution} to a DE is a function that satisfies the equation. E.g., the function $y = 2x^3$ is a solution of the DE. $y^\prime - 6 x^2 = 0$, but $y = x^2$ is not. 
\end{definition}

Notice that even though it might be difficult to find a solution of a DE, it is easy to \textbf{verify} whether or not a given function is a solution: simply plug it into the DE and see if equality is satisfied.   

%%Next Time Start here (page 9)
\begin{definition}
	A DE of order n is said to be \textbf{linear} if it has the form:
	\begin{align*}
		a_n(t) \frac{d^n x(t)}{dt^n} +a_{n-1}(t) \frac{d^{n-1} x(t)}{dt^{n-1}}+\dots+a_1(t)\frac{dx}{dt} + a_0(t)x(t) = g(t),
		\end{align*}
where $a_n(t), \, \dots, \, a_0(t), \,g(t)$ are given functions and $a_n(t) \neq 0$. Otherwise, the equation is called \textbf{non-linear}. Observe that $x=x(t)$ is the \textbf{unknown.} In the linear case, the functions $a_n(t), \dots, a_0(t)$ are called the \textbf{coefficients} of the equation.
\end{definition}

\begin{example}
	$\frac{d^2y}{dt^2} + e^t \frac{dy}{dt} - \cos t y = 0$ and $x^{\prime\prime\prime} - x^\prime = \log t$ are linear, while $(y^\prime)^2 = y e^y $ and $e^{y^{\prime\prime}} + xy = 0$ are non-linear.
\end{example}

\begin{remark}
	Because $a_n(t) \neq 0$ in the definition of a linear DE, we can always divide the equation by $a_n(t)$. Thus, without loss of generality, we can say that a linear DE has the form:
	\begin{align*}
		\frac{d^nx(t) }{dt^n} + a_{n-1}(t) \frac{d^{n-1} x(t)}{d t^{n-1}} + \dots + a_0 x(t) = g(t).
	\end{align*}
\end{remark}
\noindent The distinction between linear and non-linear DE is \emph{extremely important}.

\begin{example}
    The following are linear DE
    \begin{align*}
    \text{(a)}\quad & \frac{d^2x}{dt^2} + 25x = 0 \\
    \text{(b)}\quad & \frac{d^2x}{dt^2} + \cos(t)\frac{dx}{dt} + tx = \sin(t) \\
    \text{(c)}\quad & t\frac{dx}{dt} + x = e^t \qquad (t \neq 0)
    \end{align*}

    \noindent
(a) fits the definition of linear equations with
\[
a_2(t)=1,\qquad a_1(t)=0,\qquad a_0(t)=25,\qquad g(t)=0;
\]
(b) with
\[
a_2(t)=1,\qquad a_1(t)=\cos(t),\qquad a_0(t)=t,\qquad g(t)=\sin(t);
\]
(c) with
\[
a_1(t)=t,\qquad a_0(t)=1,\qquad g(t)=e^t.
\]
Note that in (c) we have the condition $t\neq 0$ because we want $a_n(t)\neq 0$ according to the definition. This means that we exclude $t=0$ from the domain of $x(t)$.
\end{example}


\begin{example}
The following are non-linear DE:
\begin{align*}
\text{(A)}\quad & \frac{d^2x}{dt^2} + 25x^2 = 0 \\
\text{(B)}\quad & \frac{d^2x}{dt^2} + \cos(t)\frac{dx}{dt} + tx = \sin(x) \\
\text{(C)}\quad & t\frac{dx}{dt} + \frac{1}{x} = e^t \\
\text{(D)}\quad & x\frac{d^3x}{dt^3} + \frac{dx}{dt} = 0
\end{align*}

\begin{itemize}
    \item[(A)] is not linear because the term with no derivatives of $x$ is not of the form $a_0(t)x$ for a given function of $t$. We can write $25x^2$ as a function times $x$, namely,
\[
25x^2 = (25x)x,
\]
but the function multiplying $x$, namely, $25x$, is not a given function that is known independently of $x$ since it involves the unknown.
\smallskip
\item[(B)] is not linear because it involves a function of the unknown, namely, $\sin(x)$. For a function to be linear, the unknown and its derivatives cannot be arguments of a function. I.e., if in the DE we have
\[
f(x),\quad f\!\left(\frac{dx}{dt}\right),\quad \ldots,\quad
f\!\left(\frac{d^n x}{dt^n}\right)
\]
for some function $f$, then the equation is non-linear. (The only exception is when $f$ is of the form $f(z)=z$, since then $f(x)=x$, $f\!\left(\frac{dx}{dt}\right)=\frac{dx}{dt}$, etc.) In particular, equations involving sine, cosine, exponential, powers, etc., of the unknown or its derivatives are always non-linear.
\smallskip
\item[(C)] is not linear because of the term $\frac{1}{x}$. Notice that this is a function of the unknown, i.e.,
\[
f(x)\quad \text{for} \quad f(z)=\frac{1}{z}.
\]
Thus, as discussed in (B), this is not allowed for linear equations.
\smallskip
\item[(D)] This is not linear because of the term
\[
x\frac{d^3x}{dt^3}.
\]
The term multiplying $\frac{d^3x}{dt^3}$ is not of the form $a_3(t)$ for a given function $a_3(t)$. Whenever we have products of the unknown and/or its derivatives, the DE will be non-linear.
\end{itemize}
\end{example}

\begin{example}
Here are more examples of non-linear DE:
\begin{align*}
&x'' + \sqrt{x'} = 0 \\
&x\,x''' + x' + x = 0 \\
&e^{x'} + x = 0
\end{align*}
\end{example} 

It's important to notice that the unknown function of a DE can depend on more than one variable. For example, if $T$ is a function that describes the temperature inside a room, then $T$ is a function of space and time, so it depends on the three spatial coordinates $x, y, $ and $z$ and on the time $t$. Therefore, a DE governing the behavior of $T$ might involve derivatives with respect to $x, y, z, $ and $t$, and in this case we would seek to use \textbf{partial derivatives}, i.e., $\frac{\partial T}{\partial x}, \frac{\partial T}{\partial y}, \frac{\partial T}{\partial z}, \frac{\partial T}{\partial t}$ etc. Such types of DE are called \textbf{partial differential equations (PDEs),} while D.E. involving only one variable are called \textbf{ordinary differential equations (ODEs)}.
 
 \begin{example}
 	$\frac{\partial^2 T}{\partial x^2} + \frac{\partial^2 T}{\partial y^2}+\frac{\partial^2 T}{\partial z^2} = \frac{\partial T}{\partial t}$ is a PDE for $T$, while $\frac{d^2y}{dx^2} + y = 0$ is an ODE for $y$. 
\end{example}
In this course, we deal only with ODE, so the term DE will always mean ODE unless stated otherwise. 

\section{Initial Value Problem} 
Consider the DE $\frac{dy}{dx} = x^3$. We can find a solution by direct integration:
\begin{align*}
	\int \frac{dy}{dx} dx = \int x^3 dx \Rightarrow y = \frac{x^4}{4} + C \text{ where } C \text{ is a constant of integration.}
\end{align*}
So, instead of a unique solution to the DE, we have a family of solutions; that is, a different solution for each choice of $C$. In particular, we have infinitely many solutions. This family of solutions is called a \textbf{general solution} of the DE.\\\\
If we want to determine $C$, we need further information. For example, suppose that we want, among all solutions, a solution with the property $y(0) = 5$. Then, plugging $x = 0$ we have 
\[y(0) = \frac{0^4}{4} + C = 5  \ \Rightarrow C = 5.\] So $y = \frac{x^4}{4} + 5$ is the desired solution. In this case, we are not only solving the DE $\frac{dy}{dx} = x^3$, but rather the problem:
\begin{align*}
	\begin{cases}
		\frac{dy}{dx} = x^3, \\
		y(0) = 5.
	\end{cases}
\end{align*}
This kind of problem is called an \textbf{initial value problem (IVP)}. The extra conditions given to determine the constants appearing in the general solution are called \textbf{initial conditions (IC)} (in the above example, $y(0)=5$ is the initial condition).\\\\
The terms IVP and IC are used because the variable is usually  time. In our first example, we investigated not only the DE $x^{\prime\prime}+25x=0$, but rather the IVP:
\begin{align*}
\begin{cases}
	x^{\prime\prime} + 25x = 0, \ \rightarrow \ \text{DE}\\
	\left.
	\begin{array}{rl}
		x(0) &= 0.2 \\
		x^{\prime}(0) &= 0
	\end{array}
	\right\} \text{ initial conditions } 
\end{cases}
\end{align*}
(The initial condition $x^\prime(0) = 0$ was implicit in the statement of the problem in that we pulled the string and released it, so its velocity $v = \frac{dx}{dt}$ at time zero was zero.)\\

As we are going to see in detail later on, to solve an IVP we need as many ICs as the order of the equation. To have an idea of why this is the case, consider the following simple example:
\begin{align*}
y^{\prime\prime} = e^{2x}
\end{align*}
Since $\int \frac{d^2y}{dx^2} dx = \frac{dy}{dx} + \text{constant}$, we have $\int y^{\prime\prime} dx = \int e^{2x} dx \ \Rightarrow \ y^\prime = \frac{e^{2x}}{2} + C$, where $C$ is a constant. Integrating again yields $y = \frac{e^{2x}}{4} + Cx + D$, where $D$ is another constant. Thus, we have two arbitrary constants. To determine them, we need two conditions. For example, we could have $y(0) = 2$ and $y^{\prime}(0) = 3$. Then $y(0) = \frac{1}{4} + 0 + D = 2  \ \Rightarrow \  D = \frac{7}{4}$. Next, compute $y^\prime(x) = \frac{e^{2x}}{2} + C$, so $y^\prime(0) = \frac{1}{2} + C = 3  \ \Rightarrow \  C = \frac{5}{2}$. Thus, $y(x) = \frac{e^{2x}}{4} + \frac{5}{2} x + \frac{7}{4}$ is a solution to the IVP:
\begin{align*}
	\begin{cases}
		y^{\prime\prime} = e^{2x}, \\
		y(0) = 2, \\
		y^\prime(0) = 3.
	\end{cases}
\end{align*}

\begin{notation}
	An arbitrary DE of order $n$ for the unknown function $x = x(t)$ will be denoted
	\begin{align*}
		F\big(t, x(t), x^\prime(t), \dots, x^{(n-1)}(t), x^{(n)}(t)\big) = 0.
	\end{align*}
\end{notation}

\begin{definition}
	By an \textbf{initial value problem (IVP)} for a DE of order n 
	\begin{align*}
		F\big(t, x(t), x^\prime(t), \dots, x^{(n-1)}(t),x^{(n)}(t)\big) = 0,
	\end{align*}
	we mean the following problem. Find a solution $x = x(t)$ to the DE defined on an interval $(a, b)$ containing the point $t_0$ such that $x(t_0) = X_0, \,x^{\prime}(t_0) = X_1,\, \dots,\, x^{(n-1)}(t_0) = X_{n-1}$ where $X_0, X_1, \dots, X_{n-1}$ are given numbers.
\end{definition}

\begin{example}
Solve the IVP
\[
\begin{cases}
\dfrac{dx}{dt}=x,\\
x(0)=5
\end{cases}
\]
So in this example $t_0=0$, $x_0=5$. We write
\[
\frac{dx}{x}=dt \qquad (x\neq 0),
\]
integrate to get
\[
\int \frac{dx}{x}=\int dt
\quad \Rightarrow \quad
\ln |x| = t + C,\qquad C=\text{constant}.
\]
Then
\[
|x| = e^{t+C} = \underbrace{e^C}_{=\tilde{C}} e^t = \tilde{C}e^t.
\]
Removing the absolute value,
\[
x=\underbrace{\pm \tilde{C}}_{=A}e^t.
\]
Thus we can write $x(t)=Ae^t$, where $A$ is an arbitrary constant. This gives a family of solutions to the DE, but we want a specific solution satisfying $x(0)=5$. \\\\
Thus, $x(0)=Ae^0=A=5$, so $x(t)=5e^t$ is the solution to the IVP.   
\end{example}

\begin{remark}
When we divided by $x$ in the above example, we assumed that $x\neq 0$. Note that $x(t)=0$ is a solution to the DE, but it does not satisfy the initial condition. Thus our assumption $x\neq 0$ was justified.
\end{remark}

Consider now $y^\prime = \frac{2x - e^y}{x e^y + 1}$. We can verify that the function $y$ satisfying the relation $x e^y + y = x^2$ is a solution to the DE. However, we cannot explicitly solve this relation for $y$. In this case,  we say we have an \textbf{implicit solution} to the DE.

\subsection{General and particular solutions}
Consider the DE $\frac{dy}{dx} = f(x)$, where $f$ is a known function of $x$. We can solve this by direct integration: $y(x) = \int f(x) dx + C$, where $C$ is an undetermined constant of integration. When a solution to a DE contains such undetermined constants we call it a \textbf{general solution}. When all undermined constants have been found using IC we call it a \textbf{particular solution}.
A general solution thus represents a family of solutions. 

\begin{example}
	$\frac{dy}{dx} = 2x  \ \Rightarrow \  y = x^2 + C$. Below we graph some of these solutions for different values of $C$: 
	\begin{figure}[H]
		\centering
		\includegraphics[scale=.75]{./pic/p15.pdf}
    \caption{Family of Solutions}
	\end{figure}
	\noindent If we want $y(0) = 0$, then we select one solution in the family of solutions.
\end{example}

\begin{remark}
	Notice that a general solution might not contain all solutions to a DE. For example, consider $\frac{dy}{dx} = y^2.$ If $y \neq 0$, then $\frac{dy}{y^2} = dx  \ \Rightarrow \  \frac{-1}{y} = x + C  \ \Rightarrow \  y = \frac{-1}{x + C}$. This is a general solution to the DE. But the function $y=0$ (i.e., $y(x) = 0$ for all $x$) is also a solution to the DE, which is not included in the formula $y = \frac{-1}{x + C}$. When a general solution includes all solutions then, we call it \textbf{the} general solution.
\end{remark}

\begin{notation}
	We will use the letter $C$ to denote arbitrary constants in general solutions. Sometimes we use the same letter $C$ to note a different arbitrary constant. E.g., consider the DE $3y^{\prime} = e^{3x}$, then 
	\begin{align*}
		3 \int \frac{dy}{dx} dx = \int e^{3x} dx \ \Rightarrow \ 3y = \frac{e^{3x}}{3} +C  \ \Rightarrow \  y = \frac{e^{3x}}{9} + \frac{C}{3}.
	\end{align*}
	Since $C$ is arbitrary, so is $\frac{C}{3}$. We can call it another constant $D  = \frac{C}{3}$. However, it is cumbersome to keep track of all the relabels of constants, so we denote $\frac{C}{3}$ by $C$ again and write $y =  \frac{e^{3x}}{9} +C$.
\end{notation}

\subsection{Existence and uniqueness theorem for first order equations}

\begin{theorem}
	Suppose that $f(x,y)$ and $\frac{\partial f (x,y)}{\partial y}$ are continuous on a rectangle $R \subseteq \mathbb{R}^2$ containing the point $(a,b)$. Then, the IVP 
\begin{align*}
\begin{cases}
		y^{\prime} = f(x,y), \\
		y(a) = b, 
	\end{cases}
\end{align*}
has a unique solution defined on some interval $I$ that contains $a$. 
\end{theorem}

\begin{figure}[H]
\centering
\begin{tikzpicture}[scale=0.8]

    % Axes
    \draw[->, thick] (-1,0.2) -- (8,0.2) node[below right] {$x$};
    \draw[->, thick] (0,-0.5) -- (0,5) node[above right] {$y$};

    % Orange rectangle R
    \draw[orange, dashed, thick] (2,1.3) rectangle (7.1,4.5);
    \node[orange] at (6.2,3.5) {$R$};

    % Blue dashed guides
    \draw[blue, dashed, thick] (0,3) -- (4.4,3);
    \draw[blue, dashed, thick] (4.4,0.2) -- (4.4,3);

    % Blue point
    \fill[blue] (4.4,3) circle (2.5pt);

    % Labels a and b
    \node[blue, below] at (4.4,0.2) {$a$};
    \node[blue, left] at (0,3) {$b$};

    % Red interval I on x-axis
    \draw[red, line width=5pt, line cap=round] (2.7,0.2) -- (5.7,0.2);
    \node[red, below] at (5.35,0.05) {$I$};

\end{tikzpicture}
\caption{A rectangular region $R$ in the first quadrant.}
\end{figure}

This theorem allows us to say when an IVP admits a unique solution, even though finding a formula for the solution might be very difficult. 

\begin{remark}
    To apply the theorem, the coefficient of $y^{\prime}$ must be one. So if we are given, e.g., $xy^{\prime} = \cos(xy)$, we have to write $y^{\prime} = \frac{\cos(xy)}{x}$ and then $f(x,y) =\frac{\cos(xy)}{x}$.
\end{remark}

\begin{example} 
Consider the problem:
	\begin{align*}
	\begin{cases}
		y^\prime = x^2 e^{\sin [(x-y)^2]}, \\
		y(0) = 1.
	\end{cases}
\end{align*}
Here $f(x,y) = x^2 e^{\sin [(x-y)^2]}$. This function is continuous because it is the composition of continuous functions. Compute 
\begin{align*}
	\frac{\partial f}{\partial y} = x^2 e^{\sin [(x-y)^2]} \cos[(x-y)^2] \cdot (-2) (x-y), 
\end{align*}
which is again a continuous function. Hence, the IVP has a unique solution defined in a neighborhood of $x=0$. Note that it will be very hard to find a formula for such a solution.
\end{example}


\begin{example} 
Consider the problem:
	\begin{align*}
	\begin{cases}
		y^\prime = \sqrt{x-y}, \\
		y(2) = 2.
	\end{cases}
\end{align*}
In this case $\frac{\partial f}{\partial y}  = \frac{-1}{2 \sqrt{x-y}}$, which is not continuous (in fact, not even defined) at $(2,2)$. Therefore, the theorem cannot be applied and we cannot guarantee that a unique solution exists. 
\end{example}

In the previous example we are \textbf{not} saying that a solution does not exist, only that we cannot use the theorem.

\begin{remark}
	It is important to verify not only that $\frac{\partial f}{\partial y} $ exist but also that it is continuous. Recall that it is possible for a function to be differentiable but for its derivative not to be continuous. For example, the function $f(x) = \begin{cases}
		x^2 \sin(\frac{1}{x}) &, x \neq 0\\
		0&, x = 0
	\end{cases}$ is differentiable but its derivative at $x = 0$ is not continuous.
\end{remark}

\section{Separable equations of first order}
A first order DE  $\frac{dy}{dx}  = F(x,y)$ is called \textbf{separable} if $F(x,y) = g(x)  h(y)$, or equivalently, $F(x,y) = \frac{g(x)}{f(y)}$. In this case, we can find a solution by direct integration: 

\[
\frac{dy}{dx} = \frac{g(x)}{f(y)} \ \Rightarrow \ \int f(y) dy = \int g(x) dx.
\]

\begin{example}
	$\frac{dy}{dx}  = - 6xy \ \xRightarrow[y \neq 0]{} \frac{dy}{y} = -6x$. Integrating:
	\begin{align*}
		\ln |y| = -3x^2 + C \ \Rightarrow \ |y| = e^C e^{-3x^2} \ \Rightarrow \ y = \underbrace{\pm e^C}_{=A} e^{-3x^2} = A e^{-3x^2}.
	\end{align*}
	 When we divide by $y$, we had to assume $y \neq 0$. We see that $y = 0$ is also a solution to the DE.  However, the solution $y=0$ is included in the family $A e^{-3x^2}$ as it corresponds to $A = 0$.
\end{example}

Many times when solving separable equations, we have to divide by a function $h$ of $y$, $h(y)$. This excludes the values where $h$ vanishes. These must be analyzed separately.

\begin{example}
$\frac{dy}{dx}  = y^2$. If $y \neq 0$, then $\frac{dy}{y^2}  = dx \ \Rightarrow \  \frac{-1}{y} = x + C \ \Rightarrow \  y = \frac{-1}{x + C}$. This is a general solution to the DE. But the function $y=0$ (i.e. $y(x) = 0$ for all $x$) is also a solution to the DE, and it is not included in the formula $y = \frac{-1}{x + C}$. Therefore, the solutions to the DE consist of the family $y = \frac{-1}{x + C},$ together with the singular solution $\;y = 0$.
\end{example}

Note the values that are excluded when we divide need not to be zero. E.g., if $\frac{dy}{dx} = x(y-2)$ and we write $\frac{dy}{y-2} = dx$, then $y \neq 2.$ But $y(x) = 2$ is also a solution.

\section{Linear first order equations} 
Consider the DE 
\begin{align*}
	e^{-x} \frac{dy}{dx} - e^{-x} y = x^3 \text{ (linear, first order)}
\end{align*}
Noting that $e^{-x} \frac{dy}{dx} - e^{-x} y = \frac{d}{dx} (e^{-x} y)$ we have:
\begin{align*}
 \frac{d}{dx} (e^{-x} y) = x^3 \ \Rightarrow \  \int \frac{d}{dx} (e^{-x}y) dx = \int x^3 dx \ \Rightarrow \  e^{-x} y = \frac{x^4}{4} + C \ \Rightarrow \  y = \frac{x^4}{4}  e^x + C e^x.
\end{align*}
Consider now $\frac{dy}{dx} + y = \cos x$. In this case, it is not true that $\frac{dy}{dx} + y = \frac{d}{dx} (\dots). $ But if we multiply the equation by $e^x$, we have: 
\begin{align*}
	\underbrace{e^x \frac{dy}{dx} + e^x y}_\textrm{$\frac{d}{dx}(e^x y)$}  = e^x \cos x \Rightarrow \int \frac{d}{dx} (e^x y) dx = \int e^x \cos x dx.
\end{align*}
Therefore, 
\begin{align*}
e^x y = \frac{1}{2} e^x(\cos x + \sin x) + C \ \text{ or } \ y= \frac{1}{2}(\cos x + \sin x) + C e^{-x}. 
\end{align*}
The idea for solving linear first order DE will be similar to the above example: try to multiply the equation by a suitable function so that the terms in $y$ can be written as the derivative of a product.\\\\
A first order linear DE can always be written as 
\begin{align*}
	\frac{dy}{dx} + P(x) y = Q(x), \text{ where $P$ and $Q$ are known functions}.
\end{align*}
Multiply by $\mu(x)$, where $\mu(x)$ is a function to be determined. 
\begin{align*}
	\mu(x) \frac{dy}{dx} + \mu(x) P(x) y = \mu(x) Q(x)
\end{align*}
We want the LHS to be the derivative of a product:
\begin{align*}
\underbrace{\mu(x) \frac{dy}{dx}} + \mu(x) P(x) y &= \frac{d}{dx} \big(\mu(x) y\big) \\
&= \frac{d \mu}{dx} y + \underbrace{\mu(x) \frac{dy}{dx}}  \\
\Rightarrow \mu(x) P(x) y&= \frac{d \mu}{dx} y
\end{align*}
Thus, $\frac{d \mu}{dx} = \mu P(x)$. This is a separable equation:
\begin{align*}
	\frac{d \mu}{\mu} = P(x) dx \ \Rightarrow \ \int \frac{d \mu}{\mu} = \int P(x) dx \ \Rightarrow \  \ln|\mu| = \int P(x) dx + C \Rightarrow |\mu| = e^C e^{\int P(x) dx},
\end{align*}
removing the absolute value: 
\[
\mu(x) = \pm e^C e^{\int P(x) dx}.
\]
We found a family of functions $\mu$ that allow us to write $\mu \frac{dy}{dx} + \mu P y$ as the derivative of a product. But we just need one such function, so we can take $C=0$ and take the $+$ sign. Thus, 
\begin{align*}
	\frac{d}{dx} \big(\mu(x) y\big)=\mu(x) Q(x), \text{ where $\mu(x) = e^{\int P(x) dx}$}.
\end{align*}
Integrating: 
\begin{align*}
\int \frac{d}{dx} \big(\mu(x) y\big) dx = \int \mu(x) Q(x) dx \ \text{, so we get }  \mu(x) y(x) = \int \mu(x) Q(x) dx + C.
\end{align*}
Dividing by $\mu(x)$ (note that it never vanishes) and using its explicit form:
\begin{center}
\fbox{\begin{minipage}{7.5 cm}
	\begin{align*}
	y(x) = e^{-\int P(x) dx} \left(\int e^{\int P(x) dx} Q(x) dx + C\right)
	\end{align*}
\end{minipage}}
\end{center}
This is an explicit formula for the general solution of $\frac{dy}{dx} + P(x) y = Q(x)$.

\begin{remark}
	Note that the above formula is for the equation $y^\prime + P(x) y = Q(x)$, i.e., the coefficient of $y^\prime$ must be $1$. If we have $a(x) y^\prime + b(x) y = c(x)$, we must first divide by $a(x)$ to use the formula.  
\end{remark}

Students should not only memorize the above formula for $y(x)$, but also know how to derive it.

%%Next Time Start here type version page 9, written version page 23

\begin{example}
	$\frac{dy}{dx} - y = \frac{11}{8} e^{-x/3}, y(0) = 1$. \\\\
    In this case, $P(x) = -1, \;Q(x) = \frac{11}{8} e^{-x/3}$. Then 
	\begin{align*}
		\mu(x) = e^{\int P(x) dx} = e^{-x}, \int e^{\int P(x) dx} Q(x) = \int \frac{11}{8} e^{-x} e^{-\frac{x}{3}} dx = \frac{-33}{32} e^{\frac{-4x}{3}}.
	\end{align*}
	 Therefore, 
	 \begin{align*}
	 y(x) = e^{-(-x)}\left(\frac{-33}{32} e^{\frac{-4x}{3}} + C\right) = e^x \left(\frac{-33}{32} e^{\frac{-4x}{3}} + C\right). 
	\end{align*}
    Plugging $y(0) = 1$, we find $C = \frac{65}{32}$, so $y(x) = \frac{65}{32} e^x - \frac{33}{32} e^{\frac{-x}{3}}. $
\end{example} 

\begin{remark}
    The formula for $y(x)$ already includes an arbitrary constant $C$. Thus, there is no need to add a constant when computing $\int P(x) dx$ and $\int e^{\int P(x) dx} Q(x) dx$, as done in the previous example.
\end{remark}

A legitimate question is whether our formula for $y$ always works. This is answered by the following theorem.

\begin{theorem}[existence and uniqueness of solutions for 1st order linear DE]
	Assume that $P(x)$ and $Q(x)$ are continuous on an interval $(a,b)$ that contains the point $x_0$. Then, for any $y_0$, the IVP 
\begin{align*}
\begin{cases}
		y^\prime + P(x) y &= Q(x)\\
		y(x_0) &= y_0 
	\end{cases}
\end{align*}
has a unique solution defined on $(a,b)$. Moreover, the solution can be written as 
$$y(x) = e^{-\int P(x) dx} \left( \int e^{\int P(x)} Q(x) dx + C\right)$$ for a suitable constant $C$. 
\end{theorem}

\begin{proof}
	Since $P(x)$ and $Q(x)$ are continuous, the integrals $\int P(x) dx$ and $\int e^{\int P(x) dx} Q(x) dx$ are well-defined and define differentiable functions on $(a,b)$. Set $y(x) = e^{-\int P(x) dx} (\int e^{\int P(x) dx} Q(x) dx) + C)$, where $C$ is a constant. Then $y$ is differentiable. Compute:
	\begin{align*}
		y^\prime &= \left(e^{-\int P(x) dx}\right)^\prime \left(\int e^{\int P(x) dx}Q(x) dx + C\right) + e^{-\int P(x) dx} \left(\int e^{\int P(x) dx}Q(x)dx + C\right)^\prime \\
		 &= - e^{-\int P(x) dx} \left(\int P(x) dx\right)^\prime \left(\int e^{\int P(x) dx} Q(x) dx + C\right) + e ^{-\int P(x) dx}\left(\int e^{\int P(x) dx} Q(x) dx\right)^\prime \\
		 &= -P(x) \underbrace{e^{-\int P(x) dx} \left(\int e^{\int P(x) dx}Q(x) dx + C\right)}_\textrm{$=y$} + \underbrace{e ^{-\int P(x) dx} e ^{\int P(x) dx}}_\textrm{$=1$}Q(x),
	\end{align*}
where we used the product rule in the first line, the chain rule in the second line, and the fundamental theorem of calculus in the third line.\\\\
Thus, $y^\prime + P(x) y = Q(x)$ and $y$ satisfy the DE. Because $e^{-\int P(x) dx}$ never vanishes, we can always solve for $C$ and determine it so that $y(x_0) = y_0$.\\
\end{proof}
 
\section{Exact equations}
Let us introduce this topic with the following example. Consider the DE: 
\begin{align*}
	\big(4y  + 3x^2 - 3xy^2\big) \frac{dy}{dx} = y^3 - 6xy.
\end{align*}
Write it as 
\begin{align*}
	(6xy - y^3) dx + (4y + 3x^2 - 3xy^2) dy = 0.
\end{align*}
Set $M(x,y) = 6xy - y^3, \;N(x,y) = 4y + 3x^2 - 3xy^2$, so that the DE becomes:
\begin{align*}
	M(x,y) dx + N(x,y) dy = 0.
\end{align*}
Now let us ask: is the LHS the differential of a function? In other words, does there exist a $F(x,y)$ such that $dF = M dx + N dy$? (Recall from calculus that by definition $dF = \frac{\partial F}{\partial x}dx + \frac{\partial F}{\partial y}dy$.) If the answer is yes, then the DE becomes $dF = 0$, which implies that $F$ is constant. In this case, the general solution of the DE will be simply $F(x,y) = C$.\\\\
Recall from calculus that $dF = M dx + N dy $ iff $ \frac{\partial M }{\partial y} = \frac{\partial N }{\partial x}$ (we state this more precisely below).\\\\
We check:
\begin{align*}
	\begin{rcases}
		\frac{\partial M }{\partial y} &= \frac{\partial }{\partial y} (6xy - y^3) = 6x - 3y^2 \\
		\frac{\partial N }{\partial x} &= \frac{\partial }{\partial x} (4y+3x^2-3xy^2)  = 6x - 3y^2
	\end{rcases}
	\Rightarrow  \frac{\partial M }{\partial y} = \frac{\partial N }{\partial x}
\end{align*}
Therefore, there exists a function $F = F(x,y)$ such that $\frac{\partial F }{\partial x} =M$ and $\frac{\partial F }{\partial y} = N$. \\\\
Let us proceed to find $F$: 
\[
\frac{\partial F }{\partial x} =M = 6xy - y^3.
\]
Integrating with respect to $x$ gives 
\begin{align*}
F(x,y) = \int (6xy - y^3)dx = 3 x^2 y - xy^3 + g(y). 
\end{align*}
After performing the integration, we added a function $g(y)$. This is because we must add a constant of integration. But here we are integrating a function of $x$ and $y$ with respect to $x$ so that anything that depends only on $y$ is treated as a constant from the point of view of $\int \cdots dx$. Therefore, the “constant" of integration can in principle be a function of $y$. \\\\
To find $g(y)$, we use $\frac{\partial F }{\partial y} = N$ and take $\frac{\partial} {\partial y}$ of the expression for $F$ and set the result equal $N$:
\begin{align*}
	\frac{\partial} {\partial y} F &= \frac{\partial} {\partial y}(3 x^2 y - xy^3 + g(y)) = 3x^2 - 3xy^2 + g^\prime(y) = N = 4y + 3x^2 - 3xy^2 \\
		&\ \Rightarrow \ 3x^2 \underbrace{- 3xy^2} + g^{\prime}(y) = 4y + \underbracket{3x^2} \underbrace{- 3xy^2} \ \Rightarrow \ g^{\prime}(y) = 4y
	\end{align*}
This is an equation for $g(y)$ that can be solved by direct integration. Notice how all the $x$'s are canceled, and the equation for $g(y)$ involves only $y$. This \textbf{must be} the case: by construction, $g$ is a function of $y$ only. If we end up with an equation for $g$ involving $x$, then there is a mistake somewhere.\\\\
The equation for $g$ is easily solved, giving $g(y) = 2y^2$. We have not added a constant of integration to $g$ because the solution of the DE already contains an undetermined constant. In summary, we have $F(x,y) = 3x^2y - xy^3 + 2y^2$ and the general solution to the DE is:
\begin{align*}
	F(x,y) = C \ \text{ or } \ 3x^2y - xy^3 + 2y^2 = C.
\end{align*}
\begin{remark}
	Above, we found the solution $3x^2y - xy^3 + 2y^2 = C$, but we have not explicitly solved $y$. In many cases, it is impossible to find an explicit expression for $y$. In these cases, i.e., when the solution is given as $F(x,y) = C$, without explicit expression for $y$, we say that we have an implicit solution.
\end{remark}
We will now streamline the ideas of the previous example.
\begin{definition}
	A first order DE written in the form
	\begin{align*}
		M(x,y) dx + N(x,y) dy  = 0
	\end{align*}
is called \textbf{exact} if there exists a function $F = F(x,y)$ such that $\frac{\partial F} {\partial x} = M$ and $\frac{\partial F} {\partial y} = N$.\\

Under appropriate hypotheses, we will show that a DE is exact iff $\frac{\partial M} {\partial y} = \frac{\partial N} {\partial x}$. Before doing so, we will summarize the method.
\end{definition}

\subsection{Method for solving exact equations}.

\begin{itemize}
    \item[1.]  Given $y^\prime = f(x,y)$, write it as $M(x,y) dx + N(x,y) dy = 0$.
    \medskip
    \item[2.] Test if $\frac{\partial M} {\partial y} = \frac{\partial N} {\partial x}$. If this is not the case, then the method cannot be applied. Otherwise, proceed as follows:
    \medskip
    \item[3.] If $\frac{\partial M} {\partial y} = \frac{\partial N} {\partial x}$, then define $F$ by
\begin{align*}
	F(x,y) = \int M(x,y) dx + g(y)
\end{align*}
where $g$ is a function of only $y$ that needs to be determined.
\medskip
\item[4.] To determine $g$, take $\frac{\partial } {\partial y}$ of $F$ found in step 3, and set it equal to $N$. This gives an equation for $y$ of the form:
\begin{align*}
	g^\prime(y) = \text{expression in } y \text{ containing no } x
\end{align*}
\item[5.] Integrate $g^\prime(y)$ to obtain $g(y)$ and thus $F(x,y)$.
\medskip
\item[6.] The general solution is given by $F(x,y) = C$, where $C$ is an arbitrary constant. 
\end{itemize}

\begin{remark}
	If the expression for $g^\prime(y)$ found in step 4 involves $x$, then there is a mistake, and we must re-check the calculations.
\end{remark}

\begin{remark}
	In step 3, we can first integrate in $y$. I.e., if $\frac{\partial M} {\partial y} = \frac{\partial N} {\partial x}$, then $\frac{\partial F} {\partial y} = N$. Integrating with respect to $y$ produces $F(x,y) = \int N(x,y) dy + h(x)$, where $h$ is a function of $x$ only. To find $h$, we differentiate $F$ with respect to $x$ and set the resulting expression equal to $M$. This will give an equation for $h^\prime(x)$ involving no $y$ (if it contains $y$, then there is a mistake). Integrating we find $h$, and hence $F$.
\end{remark}
	
In the next example, we use the idea of integrating in $y$ first. 
\begin{example}
Consider the problem: 
\begin{align*}
		y^\prime = \tan x \tan y
	\end{align*}
	Write the equation as $dy -  \tan x \tan y \ dx  = 0$. Multiply by $\cos x \cos y $ to obtain 
	\begin{align*}
		\underbrace{- \sin x \sin y}_{=M(x,y)} dx + \underbrace{\cos x \cos y}_{=N(x,y)} dy = 0.
	\end{align*}
Compute 
\begin{align*} 
\frac{\partial M} {\partial y} = - \sin x \cos y, \;\frac{\partial N} {\partial y} = - \sin x \cos y,\; \text{ so } \frac{\partial M} {\partial y} = \frac{\partial N} {\partial x}. 
\end{align*}
Then,
\begin{align*} 
\frac{\partial F} {\partial y} = N \ \Rightarrow \ F(x,y) = \int N(x,y) dy + h(x) = \int \cos x \cos y \ dy + h(x) = \cos x \sin y + h(x).
\end{align*}
Then,
\begin{align*} 
\frac{\partial F(x,y)}{\partial x} = - \sin x \sin y + h^\prime(x) = M(x,y) = - \sin x \sin y.
\end{align*}
Therefore, $h^\prime(x) = 0$. This means that $h(x)$ is constant. Recalling that we do not include constants of integration at this point, we can take $h(x) = 0$. Thus, 
\begin{align*}
	F(x,y) = \cos x \sin y = C \ \text{ or } \ y = \sin^{-1} \left(\frac{C}{\cos x}\right).
\end{align*}
\end{example}

\begin{remark}
	In the above example, if we consider the equation written as $dy - \tan x \tan y \ dx = 0$ and take $N(x,y) = 1,\; M(x,y) = - \tan x \tan y$, then we do \textbf{not} obtain $\frac{\partial M} {\partial y} = \frac{\partial N} {\partial x}$. Only after multiplying the equation by $\cos x \cos y$ is the condition satisfied. Thus, how we reorganize the terms can matter.
\end{remark}
The next theorem ensures that the steps given to solve $M dx + N dy = 0$ always work if $\frac{\partial M} {\partial y} = \frac{\partial N} {\partial x}$ (and the suitable hypotheses are satisfied).

\begin{theorem}
	Suppose that the partial derivatives of $M(x,y)$ and $N(x,y)$ exist and are continuous on a rectangle $R \subseteq \mathbb{R}^2$. Then, $M(x,y) dx + N(x,y) dy = 0$ is exact iff the compatibility condition $\frac{\partial M  (x,y)} {\partial y}= \frac{\partial N  (x,y)} {\partial x} $ holds for all $(x,y) \in R$.
\end{theorem}


\begin{proof}
	Assume that the equation is exact, i.e., that there exists a $F = F(x,y)$ such that $dF = M dx + N dy$. Since $dF = \frac{\partial F}{\partial x} dx + \frac{\partial F}{\partial y} dy$, we have  $\frac{\partial F}{\partial x}  = M $ and $\frac{\partial F}{\partial y} = N$. By assumption, the first derivatives of $M$ and $N$ exist and are continuous, hence the second partial derivatives of $F$ exist and are continuous. Under these circumstances, we have $\frac{\partial^2 F}{\partial y \partial x} = \frac{\partial^2 F}{\partial x \partial y}$. Thus,  
	\begin{align*}
		\frac{\partial^2 F}{\partial y \partial x}  = \frac{\partial}{\partial y} \frac{\partial F}{\partial x} = \frac{\partial M}{\partial y} = \frac{\partial^2 F}{\partial x \partial y} = \frac{\partial}{\partial x} \frac{\partial F}{\partial y} = \frac{\partial N}{\partial x}, \text{ showing that }\frac{\partial M}{\partial y}  = \frac{\partial N}{\partial x}.
	\end{align*}
Reciprocally, assume the compatibility condition. Let $(x_0, y_0) \in R$. We claim that the expression
\begin{align*}
	N(x,y) - \frac{\partial }{\partial y} \int_{x_0}^{x} M(t,y) dt
\end{align*}
is a function of $y$ only. To show this, compute 
\begin{align*}
	\frac{\partial }{\partial x} \left(N(x,y) - \frac{\partial }{\partial y}  \int_{x_0}^{x} M(t,y) dt \right) = \frac{\partial N(x,y)}{\partial x} - \frac{\partial }{\partial y}  \frac{\partial }{\partial x}  \int_{x_0}^{x} M(t,y) dt = \frac{\partial N(x,y)}{\partial x} - \frac{\partial M(x,y)}{\partial y} = 0,
\end{align*}
where we used the notion that $M$ and $N$ have continuous partial derivatives and the fundamental theorem of calculus. Thus, as the partial derivative with respect to $x$ of $N(x,y) - \frac{\partial }{\partial y} \int_{x_0}^{x} M(t,y) dt$ vanishes, we conclude that it depends only on $y$.\\\\
Due to the claim, we can define $g(y)$ as a solution to $g^{\prime}(y) = N(x,y) - \frac{\partial }{\partial y} \int_{x_0}^{x} M(t,y) dt$. \\\\
We now define $F(x,y) = \int_{x_0}^{x} M(t,y) dt + g(y)$. Direct computation shows that $dF = M dx + N dy$.\\ 
\end{proof}

\section{Tank problems (Compartimental Analysis)} 
We are interested in modeling situations as in the following example.

\begin{example}
	A 400 $gal$ tank initially contains 100 $gal$ of brine containing 50 $ lb$ of salt. Brine containing 1 $lb$ of salt per gallon enters the tank at a rate of 5 $gal/s$ and the well-mixed brine flows out at a rate 3 $gal/s$. How much salt will the tank contain when it is full?
	
	\begin{figure}[H]
		\centering
		\includegraphics[scale=.7]{./pic/p35.pdf}
        \caption{}
	\end{figure}

\noindent Denote by $x(t)$ the amount of salt in the tank at time $t$. Note that $x(0) = 50 $ lb. We need to find a DE for $x(t)$, solve it, and compute $x(t_*)$, where $t_*$ is the time when the tank fills up.\\\\
To find the DE, let us first think of the process as discrete, i.e., imagine constructing a table with the amount of salt at, say, every second.
\end{example}
	
\begin{table}[h]
\centering
\begin{tabular}{l | c}
    \hline
    $t$ & $x(t)$ \\ 
    \hline
    0 & $x(0) = 50\ \text{lb}$ \\ 
    1 & $x(1)$ \\
    2 & $x(2)$ \\
    \vdots & \vdots \\
    $t$ & $x(t)$ \\
    $t + \Delta t$ & $x(t + \Delta t)$ \\
    \hline
\end{tabular}
\caption{Time Table}
\end{table}

\noindent If we denote by $\Delta t$ the time interval between two steps, then the amount of salt in the next step is:
\begin{align*}
	x(t  + \Delta t) = x(t) + \Delta x
\end{align*}
where $\Delta x$ = change in salt quantity between time $t$ and $t + \Delta t$. Observe that:
\begin{align*}
	\Delta x & = \text{salt quantity coming in during the interval } \Delta t
	\\
	& \ \ \ - \text{salt quantity going out during the interval } \Delta t 
\end{align*}
\noindent If the brine flows out at 3 gal/s, and the concentration of the solution at time $t$ is $S(t) = \frac{\text {mass}}{\text {volume}} = \frac{x(t)}{V(t)}$, where the volume $V(t) = $ at time $t$, we have the amount of salt leaving the tank per second. 
\begin{align*}
	3 \frac{\text{gal}}{\text{s}} S(t) \frac{\text{lb}}{\text{gal}} = 3\frac{ x(t)}{v(t)} \frac{\text{lb}}{\text{s}} 
\end{align*}
Because the initial volume is 100 $gal$, 5 $gal$ come in and 3 $gal$ go out every second, we have:
\begin{align*}
	v(t) = 100 + 5t - 3t = 100 + 2t 
\end{align*}
Therefore, the amount of salt leaving the tank per second is $\frac{3 x(t)}{100 + 2t} \frac{\text{lb}}{\text{s}} $. This is not yet the amount of salt going out during the interval $\Delta t$, as the matter is measured in lb and not lb/s. We have:
\begin{align*}
	\text{quantity of salt going out during the interval } \Delta t= \frac{3x(t)}{100+2t} \frac{lb}{s} \cdot \Delta t \,s = \frac{3x(t)}{100+2t} \Delta t \text{ lb}
\end{align*}
Notice how keeping track of the units ($lb/s$, $s$, etc.) is useful to check that we have the right quantities.
Similarly:
\begin{align*}
	\text{quantity of salt coming in during the interval } \Delta t= \frac{1 \text{ lb}}{\text{ gal}} \cdot \frac{5 \text{ gal}}{\text{ s}} \Delta t s = 5 \Delta t \text{ gal}
\end{align*}
Thus, $\Delta x = 5 \Delta t - \frac{3x(t)}{100+2t} \Delta t$ and $x(t + \Delta t) = x(t) + \left(5-\frac{3x(t)}{100+2t}\right) \Delta t, $ giving
\begin{align*}
	\frac{x(t + \Delta t) - x(t) }{\Delta t} = 5 - \frac{3x(t)}{100+2t} 
\end{align*}
The process is not, in fact, discrete, so we need to take the limit $\Delta t \rightarrow 0$. When we do so, 
\begin{align*}
	\lim_{\Delta t \to 0} \frac{x(t + \Delta t) - x(t)}{\Delta t} = \frac{d x(t)}{dt}
\end{align*}
and we obtain:
\begin{align*}
	\frac{dx}{dt} = 5 - \frac{3x}{100+2t}.
\end{align*}
We thus have that the process is modeled by the IVP:
\begin{align*}
	\begin{cases}
		\frac{dx}{dt} + \frac{3}{100+2t} \ x &= 5\\
		x(0) &= 50
	\end{cases}
\end{align*}
The DE is a linear first order equation with $P(t) = \frac{3}{100+2t}$ and $Q(t) = 5$. Compute:
\begin{align*}
	\int \frac{3}{100+2t} dt = \frac{3}{2} \ln|100+2t| = \ln |100+2t|^{\frac{3}{2}},
\end{align*}
so we get 
\begin{align*}
	e^{\int P(t) dt} = (100+2t)^{\frac{3}{2}}.
\end{align*}
Then,
\begin{align*}
	\int e^{\int P(t)dt} Q(t) dt = 5 \int (100 + 2t)^{\frac{3}{2}} dt = (100 + 2t)^{\frac{5}{2}}.
\end{align*}
Therefore,
\begin{align*}
	x(t) = e^{-\int P(t) dt} \left(\int e^{\int P(t) dt} Q(t) dt + C\right) = (100+2t)^{-\frac{3}{2}} \left((100+2t)^{\frac{5}{2}} + C\right).
\end{align*}
Using 
\begin{align*}
	x(0) = 50 = 100^{-\frac{3}{2}}(100^{\frac{5}{2}}+C) = 10^{-3}(10^5+C),
\end{align*}
so 
\begin{align*}
	50 \cdot 10^4 - 10^{-5} = C,\; C = 5 \cdot 10^4 - 10 \cdot 10^4 = -5 \cdot 10^4.
\end{align*}
We obtain
\begin{align*}
	x(t) = (100+2t)^{\frac{-3}{2}} \left((100+2t)^{\frac{5}{2}} - 5 \cdot 10^4\right).
\end{align*}
Recall that we want $x(t)$ at the time when the tank is full. This happens when $V(t) = 400$, so $100+2t = 400, t = 150$ s. Finally, 
\begin{align*}
	x(150) = 400^{-\frac{3}{2}} (400^{\frac{5}{2}} - 50 \cdot 10^4) \approx 393.75 \text{ lb}.
\end{align*}
We note that there is a more direct way to construct the DE. We know that the change in $x(t)$ is $\frac{dx}{dt} = $ in - out. Keeping track of the unit, it is easy to figure out the “in" and “out" quantities: 
\begin{align*}
	\frac{dx}{dt} = \frac{1 lb}{gal} \cdot \frac{5 gal}{s} - \frac{x(t)}{V(t)} \frac{lb}{gal} \cdot \frac{3 gal}{s}, \;V(t) = 100 + 2t,
\end{align*}
so that $\frac{dx}{dt} = 5 - \frac{3x}{100+2t}$, $\big(\frac{dx}{dt}$ is measured in $\frac{lb}{s}\big).$\\

However, students should understand the construction with $\Delta x$ and $\Delta t$. In more complex applications, it is hard to ``read off" all quantities directly, and the construction with $\Delta x, \Delta t,$ etc. is more appropriate.


\section{The mass-spring oscillator} 
Suppose a block of mass $m$ is attached to a spring and the other end of the spring is attached to a wall as indicated in the figure:
\begin{figure}[H]
	\centering
	\includegraphics[scale=.9]{./pic/p40.pdf}
    \caption{Mass Attached to a String}
\end{figure}
\noindent If we pull the spring and release it, the block will move back and forth. We want to find a DE modeling the motion of the block.\\\\
We assume that the block moves only in the horizontal direction. We choose a coordinate system with the $x$ axis in the direction of the block's motion, with $x = 0$ marking the position when the block is at rest. \\\\
We denote by $x = x(t)$ the position of the block at time $t$. The force on the block due to the spring is given by \textbf{Hooke's law}, $F_{\text{spring} } = - k x$, where $k$ is a constant depending on the spring. Another force acting on the block is caused by the friction between the block and the floor. The force of friction is usually modeled as proportional to the velocity, so we assume $F_{\text{friction}} = - \gamma \frac{dx}{dt}$, where $\gamma$ is a non-negative constant. Finally, we assume that the block is also subject to an external force $F_{\text{ext}} (t)$ (a known function of $t$). Newton's law gives:
\begin{align*}
	ma = - kx - \gamma \ \frac{dx}{dt} + F_{\text{ext}} (t), \text{ where } a \text{ is the block's acceleration}. 
\end{align*}
Since $a = \frac{d^2 x}{d t^2}$, we have:
\begin{align*}
	m \frac{d^2 x}{d t^2} + \gamma \frac{dx}{dt} + k x = F_{\text{ext}} (t).
\end{align*}
This is a second order linear DE for $x(t)$. An IVP for this DE must contain two IC. Physically, they correspond to the initial position $x(0)$ and the initial velocity $x^{\prime}(0)$ of the block.\\

The above example illustrates an important physical situation where $2^{nd}$ order linear equations appear. There are many other physical scenarios involving $2^{nd}$ linear equations. We will next study these equations in detail.

 
\section{Homogeneous linear second order equations}
Consider the DE
\begin{align*}
	a x^{\prime\prime} + bx^{\prime} + cx=0
\end{align*}
where $a,b,c$ are constants, $a \neq 0, $ and $x = x(t)$ is the unknown. \\\\
This equation is called \textbf{homogeneous} because there is no term without the unknown $x$. Otherwise, we call the equation  \textbf{non-homogeneous} (or \textbf{inhomogeneous}).\\\\
For example, $2 x^{\prime\prime} + x = 0$ and $x^{\prime\prime} - x^{\prime} + x = 0$ are homogeneous, whereas $2x^{\prime\prime} + x = t^2$ and $x^{\prime\prime} - x^{\prime} + x = 10$ are non-homogeneous. We will first study homogeneous equations.

\begin{example}
	Consider $x^{\prime\prime} + x^{\prime} - 2x = 0$. \\
    Let us show that $x(t) = e^{\lambda t}$, $\lambda = \text{constant}$,  is a solution for appropriate values of $\lambda$. Plugging in:
	\begin{align*}
		(e^{\lambda t})^{\prime\prime} + (e^{\lambda t})^{\prime} - 2 e^{\lambda t}  &= 0 \\
		\lambda^2 e^{\lambda t} + \lambda e^{\lambda t} - 2 e^{\lambda t}  &= 0 \,.
	\end{align*}
Since $e^{\lambda t} \neq 0 $ for all t, we must have $\lambda^2 + \lambda - 2 = 0$ or $(\lambda-1) (\lambda+2) = 0 \Rightarrow \lambda = 1$ or $\lambda = -2$.\\\\
Therefore, $e^t$ and $e^{-2t}$ are solutions to the DE. Indeed:
\begin{align*}
	(e^{t})^{\prime\prime} + (e^{t})^{\prime} - 2 e^{t}  = e^t + e^t - 2e^t &= 0, \text{ and }\\
	(e^{-2t})^{\prime\prime} + (e^{-2t})^{\prime} - 2 e^{-2t}  = 4e^t-2 e^t - 2e^t &= 0 
\end{align*}
We will see that this simple idea of plugging $e^{\lambda t}$ is the basis for solving $ax^{\prime\prime}+bx^{\prime}+cx=0$.
\end{example}
Consider again 
\begin{align*}
	a^{\prime\prime} + bx^{\prime} + cx = 0.
\end{align*}
Let us try to find a solution of the form $x = e^{\lambda t}$. Notice that at this point this is an ``educated guess," i.e., we do not really know if in fact $e^{\lambda t}$ solves the DE. Plugging in:
\begin{align*}
	a (e^{\lambda t})^{\prime\prime} + b(e^{\lambda t})^{\prime} + ce^{\lambda t} &= 0	\\
	(a \lambda^2 + b \lambda + c) e^{\lambda t} &= 0\,.
\end{align*}
Since $e^{\lambda t} \neq 0$ for all t, we conclude that
\begin{center}
\fbox{$a\lambda^2 + b\lambda + c = 0$}
\end{center}
which is an equation for $\lambda$ called the \textbf{characteristic equation} (also called an auxiliary equation). \\\\
The roots of the characteristic equation are 
\begin{align*}
	\lambda_1 = \frac{-b+\sqrt{b^2-4ac}}{2a} \text{ and } \lambda_2 = \frac{-b-\sqrt{b^2-4ac}}{2a} 
\end{align*}
By construction, $e^{\lambda_1t}$ and  $e^{\lambda_2t}$ are solutions to the DE $a^{\prime\prime} + bx^{\prime} + cx = 0$.  Are there other solutions? How do we obtain the general solution? To answer these questions, we need to develop the theory of second order linear homogeneous equations further. We begin motivating the discussion with the following example.

\begin{example}
	Consider $x^{\prime\prime} - 2x^{\prime} + x =0$. \\\\
    The characteristic equation is $ \lambda^2 - 2\lambda + 1 = (\lambda-1)^2 = 0 $, which gives $\lambda_1 = \lambda_2 = 1$. Thus, $x_1 = e^t$ solves the DE. We can verify that the function $x_2 = t e^t$ is also a solution:	
	\begin{align*}
		(t e^t)^{\prime\prime}-2(te^t)^{\prime} + t e^t &= (e^t + t e^t)^{\prime} - 2(e^t + te^t) + t e^t  \\
		& = \underbrace{e^t + e^t } + \underbracket{t e^t} \underbrace{- 2e^t} \underbracket{ - 2t e^t + t e^t } = 0  \text{ as claimed.}
	\end{align*}
The solution $t e^t$ did not come solely from the characteristic equation. How do we know if such “extra" solutions exist and how do we find them? We will now investigate these questions.
\end{example}

\begin{definition}
	Two functions $x_1(t)$ and $x_2(t)$ are said to be \textbf{linearly independent} on an interval $I$ if neither of them is a constant multiple of the other on all of $I$. Otherwise, $x_1(t)$ and $x_2(t)$ are called \textbf{linearly dependent}. 
\end{definition}

\begin{example}
	The functions $\sin t$ and $\cos t$ are linearly independent on $(\frac{-\pi}{2}, \frac{\pi}{2})$. Suppose that $\sin t = c \cos t$ for some constant $c$. Then, $\tan t = c$. But this would have to hold for all $t \in (\frac{-\pi}{2}, \frac{\pi}{2})$, which would imply that $\tan t$ is constant on $(\frac{-\pi}{2}, \frac{\pi}{2})$.
\end{example}

\begin{example}
	The functions $\sin 2t$ and $6 \sin t \cos t$ are linearly dependent on $\mathbb{R}$, because 
	\begin{align*}
		6 \sin t \cos t = 3 \cdot 2 \sin t \cos t = 3 \sin(2t),
	\end{align*}
	where we used the trigonometric identity $\sin(\alpha + \beta) = \sin \alpha \cos \beta + \sin \beta \cos \alpha$.
\end{example}
Given two functions $x_1(t)$ and $x_2(t)$, a \textbf{linear} combination of them is the function
\begin{align*}
	x(t) = c_1 x_1(t) + c_2 x_2(t)
\end{align*}
where $c_1$ and $c_2$ are constants. If $x_1(t)$ and $x_2(t)$ are solutions of the DE $ax^{\prime\prime}+bx^{\prime}+cx=0$, so is any linear combination of $x_1$ and $x_2$. To see this, plug in $x(t)$ to find:
\begin{align*}
	ax^{\prime\prime}+bx^{\prime}+cx &= a(c_1x_1+c_2x_2)^{\prime\prime} + b(c_1x_1+c_2x_2)^{\prime} + c(c_1x_1+c_2x_2) \\
	&= \underbracket{ac_1x_1^{\prime\prime}}  + \underbrace{ac_2x_2^{\prime\prime}} + \underbracket{bc_1x_1^{\prime}} +\underbrace{bc_2x_2^{\prime}}  + \underbracket{c c_1x_1} +\underbrace{cc_2x_2} \\
	& = c_1 \underbrace{(a x_1^{\prime\prime} + bx_1^{\prime} + cx_1)}_{=0} + c_2\underbrace{(ax_2^{\prime\prime}+bx_2^{\prime} +cx_2)}_{=0}\\
	&= 0
\end{align*}
showing that $x(t)$ is a solution. \\\\
In particular, since we can take $c_2 = 0$ above, we also conclude that a multiple of a solution is also a solution.

%%Next Time Start here type version page 18, written version page 47
\begin{definition}
	Let $x_1(t)$ and $x_2(t)$ be two differentiable functions defined on an interval $I$. The function:
	\begin{align*}
		W(x_1, x_2) (t) = x_1(t) x_2^{\prime}(t) - x_2(t) x_1^{\prime}(t)
	\end{align*}
is called the \textbf{Wronskian} of $x_1$ and $x_2$.
\end{definition}

\begin{theorem}
	For any real numbers $a, b, c, X_1, X_2, t_0, a \neq 0$, there eixsts a unique solution to the IVP 
	\begin{align*}
		\begin{cases}
		ax^{\prime\prime}+bx^{\prime}+cx&=0 \\
		x(t_0) &= X_0 \\
		x^{\prime}(t_0) &= X_1 
		\end{cases}
	\end{align*}
The solution is valid for all $t \in (-\infty, \infty)$.
\end{theorem}
\begin{remark}
	The theorem implies that if $x$ and its derivative both vanish at some point $t_0$ then $x(t) = 0$ for all $t$.
\end{remark}
\begin{lemma}
	Let $x_1(t)$ and $x_2(t)$ be two solutions to the DE $ax^{\prime\prime}+bx^{\prime}+cx=0$ on $(-\infty, \infty)$, $a \neq 0, a, b, c$ constants. If $W(x_1, x_2)(\tau) = 0$ holds at some $\tau \in (-\infty, \infty)$, then it vanishes identically and $x_1$ and $x_2$ are linearly dependent.
\end{lemma}
\begin{proof}
	If $x_1(\tau) = 0$ and $x_1^{\prime}(\tau) = 0$, then $x_1(t) = 0$ for all t and $x_1(t) = 0 \cdot x_2(t)$.\\\\
    If $x_1(\tau) \neq 0$, then $z(t) = \frac{x_2(\tau) }{x_1(\tau) } x_1(t)$ solves the DE and $z(\tau) = x_2(\tau) $. Moreover, 
	\begin{align*}
		z^{\prime}(\tau) = \frac{x_2(\tau) }{x_1(\tau) } x_1^{\prime}(\tau) = x_2^{\prime}(\tau) \text{ since } W(x_1, x_2) (\tau) = 0
	\end{align*}
	Hence $z_2(t) = x_2(t)$ by uniqueness and $x_2(t) = \frac{x_2(\tau) }{x_1(\tau) } x_1(t)$. \\
	
	Finally, if $x_1(\tau) = 0$ but $x_1^{\prime}(\tau) \neq 0$, then $W(x_1, x_2) (\tau) = 0$ implies $x_2(\tau)  = 0$. The function $z(t) = \frac{x_2^{\prime}(\tau) }{x_1^{\prime}(\tau) } x_1(t)$ satisfies the DE and $z^{\prime}(\tau) = x_2^{\prime}(\tau)$. Since $z(\tau) = 0$, we conclude by uniqueness that $z(t) = x_2(t)$, which finishes the proof.\\
\end{proof}

\begin{theorem}
	If $x_1(t)$ and $x_2(t)$ are two linearly independent solutions to the DE $ax^{\prime\prime}+bx^{\prime}+cx=0$ on $(-\infty, \infty)$, $a \neq 0, a, b, c$ constants, then unique constants $c_1$ and $c_2$ can always be found such that $x(t) = c_1 x_1(t)  + c_2 x_2(t)$ satisfies the IC $x(t_0) = X_0,\; x^{\prime}(t_0) = X_1$, for any $X_0, X_1 \in \mathbb{R}$.
\end{theorem}
\begin{proof}
	The function $x(t)$ defined in the statement solves the DE. Consider:
	\begin{align*}
		x(t_0) = c_1 x_1(t_0) + c_2 x_2(t_0) = X_0 \\
		x^{\prime}(t_0) = c_1 x_1^{\prime}(t_0) + c_2 x_2^{\prime}(t_0) = X_1
	\end{align*}
We solve the system for $c_1$ and $c_2$:
\begin{align*}
	c_1 = \frac{X_0 x_2^{\prime}(t_0) - X_1 x_2(t_0)}{x_1(t_0) x_2^{\prime}(t_0) - x_1^{\prime}(t_0) x_2(t_0)}, \;c_2 = \frac{X_1 x_1(t_0) - X_0 x_1^{\prime}(t_0)}{x_1(t_0) x_2^{\prime}(t_0) - x_1^{\prime}(t_0) x_2(t_0)}\;.
\end{align*}
provided that the denominator in these expressions is not zero. By the previous lemma and our assumption that $x_1(t)$ and $x_2(t)$ are linearly independent, this is the case.\\
\end{proof}

We will now derive some important consequences of the above results. \\\\\
We first ask the following question: can any solution of $ax^{\prime\prime}+bx^{\prime}+cx=0$ be written as $c_1x_1+c_2x_2$ for two linearly independent functions $x_1$ and $x_2$? \\\\
Let $x$ be a solution to $ax^{\prime\prime}+bx^{\prime}+cx=0$ and let $x_1$ and $x_2$ be two linearly independent solutions. Pick $t_0 \in \mathbb{R}$. By the previous theorem, we can find $c_1$ and $c_2$ such that $c_1x_1(t_0) + c_2x_2(t_0) = x(t_0)$ and  $c_1x_1^{\prime}(t_0) + c_2x_2^{\prime}(t_0) = x^{\prime}(t_0)$. By the uniqueness of the solutions to the corresponding IVP, we conclude $x = c_1x_1 + c_2x_2$. Thus, 
\smallskip

\begin{center}
\fbox{\begin{minipage}{16 cm}
		Let $x_1$ and $x_2$ be two linearly independent solutions to $ax^{\prime\prime}+bx^{\prime}+cx=0$, where $a, b, c$ are constants and $a \neq 0$. Then any other solution $x(t)$ can be written as 
		\begin{align*}
			x = c_1 x_1 + c_2 x_2
		\end{align*}
		where $c_1$ and $c_2$ are constants. In particular, the general solution can be written as $c_1x_1 + c_2x_2$.
\end{minipage}}
\end{center}
\smallskip

We saw that we can use the Wronskian to determine that two solutions are linearly dependent if their Wronskian vanishes. It follows that if two solutions are linearly independent, their Wronskian is not zero.  We can ask the converse: if the Wronskian is not zero, are the solutions linearly independent? The answer is \textbf{yes} and is summarized in the following lemma.

\begin{lemma}
Let $x_1(t)$ and $x_2(t)$ be two solutions to the DE $ax^{\prime\prime}+bx^{\prime}+cx=0$ on $(-\infty, \infty)$, $a \neq 0$, a, b, c constants. If $W(x_1, x_2) (\tau) \neq 0$ holds at some $\tau \in (-\infty, \infty)$, then it never vanishes, and $x_1$ and $x_2$ are linearly independent.
\end{lemma}

\begin{remark}
    Note that in all the above discussion, $x_1$ and $x_2$ are solutions to a DE, and not two arbitrary functions. We cannot conclude, for example, that if the Wronskian of two functions (that are not necessarily solutions to a DE) vanishes, they are linearly dependent.
\end{remark}

Consider now the characteristic equation $a \lambda^2 + b \lambda + c = 0$ and let $\lambda_1$ and $\lambda_2$ be its two solutions. If $\lambda_1$ and $\lambda_2$ are real numbers and $\lambda_1 \neq \lambda_2$, then $e^{\lambda_1} $ and $e^{\lambda_2} $ are solutions to the DE, as we have seen. We now claim that  $e^{\lambda_1} $ and $e^{\lambda_2} $ are linearly independent. For this, we compute the Wronskian: 
\begin{align*}
	W(e^{\lambda_1t}, e^{\lambda_2t}) (t) &= e^{\lambda_1t}(e^{\lambda_2t})^{\prime} - (e^{\lambda_1t})^{\prime} e^{\lambda_2t} \\
	&= \lambda_2 e^{\lambda_1 t} e^{\lambda_2 t} - \lambda_1 e^{\lambda_1t} e^{\lambda_2t} \\
	& = (\lambda_1 - \lambda_2 ) e^{(\lambda_1 + \lambda_2) t} \neq 0 \text{ since } \lambda_1 \neq \lambda_2 \text{ and } e^{(\lambda_1 + \lambda_2) t} \neq 0 \text{ for all } t.
\end{align*}
It follows that the general solution can be written as 
\begin{align*}
	x(t) = c_1 e^{\lambda_1 t} + c_2 e^{\lambda_2 t}\,; \;\;c_1, c_2\text{ arbitrary constants.}
\end{align*}
What if $\lambda_1 = \lambda_2 = \lambda$? In this case, we already know that $e^{\lambda t}$ is a solution. We claim that $t e^{\lambda t}$ is also a solution and that $e^{\lambda t}$ and $te^{\lambda t}$ are linearly independent. \\\\
To verify the first claim, we plug $te^{\lambda t}$ into the equation:
\begin{align*}
	a (te^{\lambda t})^{\prime\prime} + (te^{\lambda t})^{\prime} + c te^{\lambda t} &= a(e^{\lambda t} + \lambda te^{\lambda t})^{\prime} + b (e^{\lambda t} + te^{\lambda t}) + c te^{\lambda t} \\
	& = (\lambda e^{\lambda t} + \lambda^2 t e^{\lambda t}  + \lambda e^{\lambda t} ) + b(e^{\lambda t} + t e^{\lambda t} ) + ct e^{\lambda t}  \\
	& = t (a \lambda^2 + \lambda  + c) e^{\lambda t} + (2 a \lambda + b) e^{\lambda t} =0\,.
\end{align*}
The last equality holds because $a \lambda^2 + b \lambda + c = 0$ since $\lambda$ is a root of the characteristic equation, whereas $2 a \lambda + b = 0$ because the root is repeated (so $\lambda = \frac{-b}{2a}$). \\\\
To verify linear independence, we compute the Wronskian:
\begin{align*}
	W(e^{\lambda t}, t e^{\lambda t}) (t) &= e^{\lambda t}(t e^{\lambda t})^{\prime} - (e^{\lambda t})^{\prime} t e^{\lambda t} \\
	&= e^{\lambda t}(e^{\lambda t} + t \lambda e^{\lambda t} ) - \lambda e^{\lambda t}  t e^{\lambda t}  \\
	& = e^{2 \lambda t} \neq 0 \text{ for all t,}
\end{align*}
hence, the two solutions are linearly independent. We conclude that the general solution can be written as:
\begin{align*}
	x(t) = c_1 e^{\lambda t} + c_2 t e^{\lambda t}
\end{align*}
where $c_1$ and $c_2$ are arbitrary constants.

\begin{remark}
	Students will probably wonder where $t e^{\lambda t}$ came from, i.e., how we know that we had to multiply by $t$. This comes from further developing the theory of DE, and we will show where it comes from when we study the variation of parameters.
\end{remark}
It remains to analyze what happens when the roots of the characteristic equation are complex, i.e., when 
\begin{align*}
	\lambda = \frac{-b \pm \sqrt{b^2 - 4 ac}}{2a} \text{ with } b^2-4ac < 0\,.
\end{align*}
In this case we can write $\lambda_1 = \alpha + i \beta$ and $\lambda_2= \alpha -  i \beta$, where $\alpha = \frac{-b}{2a}, \beta = \frac{\sqrt{b^2 - 4 ac}}{2a} $ and $i$ is the imaginary number $i^2 = 1$. Note that $\alpha, \beta \in \mathbb{R}$.\\\\
The calculations previously remain valid here, and we see that $e^{\lambda_1 t} = e^{(\alpha + i \beta) t} $ and $e^{\lambda_2 t} = e^{(\alpha - i \beta) t} $ are solutions of the DE $ax^{\prime\prime}+bx^{\prime}+cx=0$.\\\\
However, these solutions are complex valued, and we would like to have real valued functions as solutions. To do so, we are going to use \textbf{Euler's formula}:
\begin{align*}
	e^{i\theta} = \cos \theta + i \sin \theta, \ \theta \in \mathbb{R}\,.
\end{align*}
We will prove this formula below. But first, let us use it to obtain the desired real solutions. \\\\
We have, from Euler's formula:
\begin{align*}
 e^{\lambda_1 t} &= e^{(\alpha + i \beta)t} = e^{\alpha t + i \beta t} = e^{\alpha t} e^{i \beta t} = e^{\alpha t} (\cos (\beta t) + i \sin(\beta t)) \\
 e^{\lambda_2  t} &= e^{(\alpha - i \beta)t} = e^{\alpha t - i \beta t} = e^{\alpha t} e^{-i \beta t} = e^{\alpha t} (\cos (-\beta t) + i \sin(-\beta t)) \\
 &= e^{\alpha t} (\cos (\beta t) - i \sin(\beta t))\,.
\end{align*}
\begin{lemma}
	Let $z(t) = u(t) + i v(t)$ be a solution to the DE $ax^{\prime\prime}+bx^{\prime}+cx=0$, where $a, b, c \in \mathbb{R}$ and $u(t)$ and $v(t)$ are real valued. Then $u(t)$ and $v(t)$ are also solutions.
\end{lemma}
\begin{proof}
	We have the following: 
	\begin{align*}
	0 &= a z^{\prime\prime} + b z^{\prime} + cz = a(u + iv)^{\prime\prime} + b (u + iv)^{\prime} + c(u + iv) \\
	&= a(u^{\prime\prime} + iv^{\prime\prime}) + b(u^{\prime} + iv^{\prime}) + c(u + iv)
	=(a u^{\prime\prime} + b u^{\prime} + cu) + i(av^{\prime\prime} + bv^{\prime} + cv).
\end{align*}
Since a complex number vanishes iff its real and imaginary parts vanish, we have $a u^{\prime\prime} + bu^{\prime} + cu = 0$ and $a v^{\prime\prime} + bv^{\prime} + cv =0$.\\
\end{proof}

The lemma implies that $e^{\alpha t} \cos(\beta t)$ and $e^{\alpha t} \sin(\beta t)$ are solutions of the DE. Now, let us check that they are linearly independent:
\begin{align*}
	&W\left(e^{\alpha t} \cos(\beta t), e^{\alpha t} \sin(\beta t)\right) (t)\\
	&= e^{\alpha t} \cos(\beta t) (e^{\alpha t} \sin(\beta t))^{\prime} - (e^{\alpha t} \cos(\beta t))^{\prime} e^{\alpha t} \sin(\beta t) \\
	&= e^{\alpha t} \cos(\beta t) (\alpha e^{\alpha t} \sin(\beta t) + \beta e^{\alpha t} \cos(\beta t)) - (\alpha e^{\alpha t} \cos(\beta t) - \beta e^{\alpha t} \sin(\beta t)) e^{\alpha t} \sin(\beta t) \\
	&= (e^{\alpha t} )^2 \left(\alpha \cos(\beta t) \sin(\beta t) + \beta \cos^2(\beta t) - \alpha \cos(\beta t) \sin(\beta t) + \beta \sin^2(\beta t)\right) \\
	&= \beta (e^{\alpha t})^2 \left(\cos^2(\beta t) + \sin^2 (\beta t)\right) = \beta (e^{\alpha t})^2
\end{align*}
This expression is never zero because $\beta \neq 0$ (if $\beta = 0$, then $\lambda_1$ and $\lambda_2$ would not be complex numbers, but we are analyzing the case where they are). \\\\
We conclude that the general solution can be written as
\begin{align*}
	x(t) = c_1 e^{\alpha t} \cos (\beta t)+ c_2 e^{\alpha t} \sin (\beta t)
\end{align*}
where $c_1$ and $c_2$ are arbitrary constants.

\subsection{Summary of solutions to $ax^{\prime\prime}+bx^{\prime}+cx=0$}
$\\$

Consider $ax^{\prime\prime}+bx^{\prime}+cx=0, \;a, b, c \in \mathbb{R}, a \neq 0$. Let $\lambda_1$ and $\lambda_2$ be the two roots of the characteristic equation:
\begin{align*}
	a \lambda^2 + b \lambda + c = 0.
\end{align*}
\begin{itemize}
	\item If $\lambda_1 \neq \lambda_2$ are real, then the general solution is
	\begin{align*}
		x(t) = c_1 e^{\lambda_1 t} + c_2 e^{\lambda_2t}
	\end{align*}
	\item If $\lambda_1 = \lambda_2 = \lambda $, then the general solution is
	\begin{align*}
		x(t) = c_1 e^{\lambda t} + c_2 t e^{\lambda t}
	\end{align*}
	\item If $\lambda_1$ and  $\lambda_2$ are complex, then we can write $\lambda_1 = \alpha + i \beta$, $\lambda_2 = \alpha - i \beta$, $\alpha, \beta, \in \mathbb{R}$, and the general solution is 
	\begin{align*}
		x(t) = c_1 e^{\alpha t} \cos(\beta t) + c_2 e^{\alpha t} \sin(\beta t)
	\end{align*}
\end{itemize}
Above, $c_1$ and $c_2$ are arbitrary constants.

\subsection{Proof of Euler's formula} 
Recall from calculus that $e^x =  \sum_{n = 0}^{\infty} \frac{x^n}{n!}$. Thus, 
\begin{align*}
	e^{i \theta} = \sum_{n = 0}^{\infty} \frac{(i \theta)^n}{n!}\,.
\end{align*}
We separate the sum into even and odd n's:
\begin{align*}
	e^{i \theta} &= \sum_{n = 0, \text{ n even}}^{\infty} \frac{(i \theta)^n}{n!} + \sum_{n = 0, \text{ n odd}}^{\infty} \frac{(i \theta)^n}{n!} \\
	&= \sum_{k = 0}^{\infty} \frac{(i \theta)^{2k}}{(2k)!} + \sum_{k = 0}^{\infty} \frac{(i \theta)^{2k+1}}{(2k+1)!} 
\end{align*}
Notice that $i^0 = 1,\, i^1 = i,\, i^2 = -1,\, i^3 = -i,\, i^4 = 1, \,i^5 = i,\, i^6 = -1, \,i^7 = -i, \,i^8 = 1$, so this pattern repeats every four powers. Then:
\begin{align*}
	 \sum_{k = 0}^{\infty} \frac{(i \theta)^{2k}}{(2k)!} + \sum_{k = 0}^{\infty} \frac{(i \theta)^{2k+1}}{(k+1)!} &= (\frac{i^0\theta^0}{0!}+\frac{i^2\theta^2}{2!}+\frac{i^4\theta^4}{4!}+ \frac{i^6\theta^6}{6!}+ ...) + (\frac{i^1\theta^1}{1!}+\frac{i^3\theta^3}{3!}+\frac{i^5\theta^5}{5!}+\frac{i^7\theta^7}{7!}+ ...)\\
	 &= (\frac{\theta^0}{0!} - \frac{\theta^2}{2!} + \frac{\theta^4}{4!} - \frac{\theta^6}{6!} + ...) +(i \frac{\theta^1}{1!} - i\frac{\theta^3}{3!} + i \frac{\theta^5}{5!} - i \frac{\theta^7}{7!} + ...) \\
	 &=  \sum_{k = 0}^{\infty} (-1)^k \frac{\theta^{2k}}{(2k)!} + i \sum_{k = 0}^{\infty} (-1)^k \frac{(i \theta)^{2k+1}}{(2k+1)!} 
\end{align*}
Recalling from calculus that $\cos \theta = \sum_{k = 0}^{\infty} (-1)^k \frac{ \theta^{2k}}{(2k)!} $ and $\sin \theta = \sum_{k = 0}^{\infty} (-1)^k \frac{ \theta^{2k+1}}{(2k+1)!} $, we have the result.
 
 
%%Next Time Start here type version page 22, written version page 58

\section{Linear second order non-homogeneous equation} 

Consider the equation
\begin{align*}
	a x^{\prime\prime} + b x^{\prime} + cx = f(t)
\end{align*}
where $a, b, c$ are constants, $a \neq 0$, and $f(t)$ is a given function called the \textbf{non-homogeneous} or \textbf{inhomogeneous} term. Let us first proceed by examples.

\begin{example}
	Find a solution to $x^{\prime\prime} + 3 x^{\prime} + 4x = 3t + 2$. The given function $f(t) = 3t + 2$ is a polynomial of degree one. We expect that $x(t)$ will be a polynomial as well (we would not get a polynomial by differentiating, say, an exponential). Thus, we seek a solution of $x(t) = At + B$, where $A$ and $B$ are constants to be determined. Note that we are trying $x(t)$ a polynomial of degree one because $f(t)$ is a polynomial of degree one. Plugging in:
	\begin{align*}
		(At + B)^{\prime\prime} + 3(At + B)^{\prime} + 4(At + B) &= 3t + 2 \\
		0 + 3A + 4At + 4B &= 3t + 2 \\
		4At + (3A + 4B) &= 3t + 2
	\end{align*}
Two polynomials are equal iff the corresponding coefficients of the same powers are equal.
So we must have $4A = 3$ and $3A + 4B = 2$, so that 
\begin{align*}
A = \frac{3}{4}, \ 4B = 2 - 3A = 2 - 3 \cdot \frac{3}{4} = \frac{-1}{4} \ \Rightarrow \ B = \frac{-1}{16}
	\end{align*}
Therefore, $x(t) = \frac{3}{4} t - \frac{1}{16}$ is a solution.
\end{example}

\begin{example}
	Find a solution to $x^{\prime\prime} - 4x = 2 e^{3t}$. \\\\
	Here, the inhomogeneous term $f(t) = 2 e^{3t}$ is an exponential. Thus we expect $x(t)$ to be an exponential too (we would not get an exponential differentiating, say, a trigonometric function). Put $x(t) = A e^t, \text{where $A$ is to be found}$. Plugging in:
\begin{align*}
	(A e^{3t})^{\prime\prime} - 4Ae^{3t} &= 2 e^{3t}\\
	9 A e^{3t} - 4 A e^{3t} &= 2 e^{3t} \ \Rightarrow \ 5 A e^{3t} = 2 e^{3t} \ \Rightarrow \ A = \frac{2}{5}
\end{align*}
Hence $x(t) = \frac{2}{5} e^{3t}$ is a solution.
\end{example}

\begin{example}
Find a solution to $3x^{\prime\prime} + x^{\prime} - 2x = 2 \cos t$.\\\\
Here $f(t) = 2 \cos t$, so we might try $x(t) = A \cos t$. However, when we plug this in we will obtain some $\sin t$ term, and there is no $\sin t$ on the RHS to compare with. Therefore, we see that we should try $x(t) = A \cos t + B \sin t$. Then
	\begin{align*}
		3 (A \cos t + B \sin t)^{\prime\prime} + (A \cos t + B \sin t)^{\prime} - 2(A \cos t + B \sin t) = 2 \cos t \\
		3  (- A \cos t - B \sin t) + (- A \sin t + B \cos t) - 2 (A \cos t + B \sin t) = 2 \cos t \\
		(-5A + B) \cos t + (-A - 5B) \sin t = 2 \cos t
	\end{align*}
	Thus, for equality to hold, we must have
	\begin{align*}
		-5A + B = 2 \ \text{ and} \ - A - 5B = 0.
	\end{align*}
	This is a system of two equations for the two unknowns $A$ and $B$. Solving it, we find $A = \frac{-5}{13}, B = \frac{1}{13}$. Thus, $x(t) = \frac{-5}{13} \cos t + \frac{1}{13} \sin t$ is a solution.
\end{example}
 
Unfortunately, things will not always be so simple, as the next example illustrates.
\begin{example}
	Find a solution to $x^{\prime\prime} - 4x = 2 e^{2t}$. \\\\
We try $x(t) = A e^{2t}$. Plugging in:
\begin{align*}
	(A e^{2t})^{\prime\prime} - 4 A e^{2t} = 2 e^{2t} \\
	4 A e^{2t} -4 A e^{2t} = 2 e^{2t} \\
	 0 = 2 e^{2t} \text{   }???
\end{align*}
We see that our method did not work in this case. The problem is that $e^{2t}$ is a solution to the equation $x^{\prime\prime} - 4x = 0$ (the characteristic equation is $\lambda^2 - 4 = 0 , \lambda = \pm 2)$, and so is any multiple of $e^{2t}$. Therefore, if the inhomogeneous term is a function that solves the same equation when $f(t) = 0$, then the LHS will always give zero when we plug in, and this idea will not work. We see that to solve $ax^{\prime\prime} + bx^{\prime} + cx = f(t)$ we also need to understand $ax^{\prime\prime}+ bx^{\prime} + cx =0$.
\end{example}

\begin{definition}
	Given $a x^{\prime\prime} + b x^{\prime} + cx = f(t)$, the equation $a x^{\prime\prime} + b x^{\prime} + cx = 0$ is called the \textbf{associated homogeneous equation}. The general solution to the associated homogeneous equation will be denoted $x_h$. Observe that if $z$ solves $a x^{\prime\prime} + b x^{\prime} + cx = f$, so does the function $x = x_h + z$ because 
	\begin{align*}
		a(x_h + z)^{\prime\prime} + b(x_h + z)^{\prime} + c(x_h + z) = \underbrace{a x_h^{\prime\prime} + b x_h^{\prime} + c x_h}_\textrm{=0}  + \underbrace{a z^{\prime\prime} + bz^{\prime} + cz}_\textrm{=f}= f.
	\end{align*}
\end{definition}

It follows that there are two ``types" of solution to $a x^{\prime\prime} + b x^{\prime} + cx = f$: those containing arbitrary constants (because $x_h$ contains arbitrary constants) and those without arbitrary constants, such as the solutions found in the previous examples).

\begin{definition}
	A solution to $a x^{\prime\prime} + b x^{\prime} + cx = f$ that does not contain arbitrary constants  is called a \textbf{particular solution}. Particular solutions will be denoted by $x_p$.
\end{definition}

\begin{example}
	Let's go back to $x^{\prime\prime} - 4x = 2 e^{2t}$ and try to find a particular solution. We saw that if we put $x_p(t) = A e^{2t}$ then it will not work. Let us see that $x(t) = A t e^{2t}$ works:
	\begin{align*}
		(A t e^{2t})^{\prime\prime} - A t e^{2t} &= A(2t e^{2t} + e^{2t})^{\prime} - 4A t e^{2t} \\
		&= A (4t e^{2t} + 2 e^{2t} + 2 e^{2t}) - 4 A e^{2t} t = 4 A e^{2t} = 2 e^{2t}
	\end{align*}
	So we conclude that $A = \frac{1}{2}$ and $x_p(t) = \frac{1}{2} e^{2t}$. 
\end{example}
The idea of multiplying by $t$ can be understood as follows.\\\\
We want to satisfy $a x^{\prime\prime} + b x^{\prime} + cx = f$ and we expect $x_p$ to be of similar type as $f$ (since derivatives of polynomials give polynomials, of exponentials give exponentials, etc.) But if $f$ is or contains a term that solves the associated homogeneous equation, this cannot work because it will give a zero on the LHS. How can we find $x_p$ containing $f$ in such a way that after plugging it into the equation, a term with $f$ remains on the LHS? \\\\
The answer is the product rule, since it produces additional terms containing $f$. Put $x_p(t) = v(t) \tilde{f}(t)$, where $\tilde{f}$ has the same form of $f$ but contains constants to be determined as in the examples (so $\tilde{f}(t) = A e^{kt}$ if $f(t)$ is a multiple of $e^{kt}$ and so on), and $v$ is an undetermined function. Then:
\begin{align*}
	x_p^{\prime} = v^{\prime} \tilde{f} + v \tilde{f} ,\; x_p^{\prime\prime} = v^{\prime\prime} \tilde{f}  + 2v^{\prime} \tilde{f}^{\prime} + v\tilde{f}^{\prime\prime}.
\end{align*}
Then
\begin{align*}
	a x_p^{\prime\prime} + bx_p^{\prime} + c x_p &= a(v^{\prime\prime} \tilde{f}  + 2v^{\prime} \tilde{f}^{\prime}+ v \tilde{f} ^{\prime\prime}) + b(v^{\prime} \tilde{f} + v\tilde{f}^{\prime}) + cv\tilde{f} \\
	&= \tilde{f} (av^{\prime\prime}+ bv^{\prime}) + 2a v^{\prime} \tilde{f}^{\prime} + v(a\tilde{f}^{\prime\prime}+ b\tilde{f}^{\prime} + c \tilde{f} ).
\end{align*}
Because $\tilde{f} $ contains $x_h$, the term $a \tilde{f}^{\prime\prime} + b\tilde{f}^{\prime} + c\tilde{f} $ will produce zeros. For simplicity, let us assume that we are treating the case where $\tilde{f} $ is proportional to $x_h$. Then $a \tilde{f}^{\prime\prime} + b\tilde{f}^{\prime} + c\tilde{f}  = 0$. Next, recall that $\tilde{f} $ is like $f$, and we are treating functions that “repeat themselves" after differentiation, such as exponentials, polynomials, and sine or cosine (this method will not work for functions that do not repeat themselves in this way). Thus, for the sake of reasoning, we can replace $\tilde{f}^{\prime}$ by $\tilde{f} $ in the term $2 a \tilde{v}^{\prime}\tilde{f}^{\prime}$. Thus,
\begin{align*}
	a x_p^{\prime\prime} + b x_p^{\prime}+ cx_p = \tilde{f} (av^{\prime\prime}+bv^{\prime}+2av^{\prime}). 
\end{align*}
We want this to be equal to $f$ so: $\tilde{f} (av^{\prime\prime} + bv^{\prime} + 2av^{\prime}) = f$. If the term in parentheses is a constant, then we have $(\text{constant}) \cdot \tilde{f} = f$, and we can solve for the undetermined constants in $\tilde{f} $. The simplest way to accomplish this is to put $v(t) = t$ so $av^{\prime\prime} + bv^{\prime} + 2av^{\prime} = b + 2a$ and $x_p(t) = t \tilde{f} (t)$. \\\\
The method outlined above is called the \textbf{method of undetermined coefficients}, summarized as follows: given $ax^{\prime\prime} + bx^{\prime} + cx = f(t),\; a, b, c$ constants, and $a\neq 0$, we seek a particular solution $x_p(t)$ of the form below ($m \ge 0$ is an integer, $b_m, \dots, b_0,\; a_m, \dots, a_0, \;a, b, r$ and $h$ are constants): 

\begin{table}[h]
\centering
\begin{tabular}{c|c}
	\hline
	$f(t)$ & $x_p(t)$ \\ 
	\hline
	$b_m t^m + b_{m-1} t^{m-1} + \dots + b_1 t + b_0$
	& $t^s(B_m t^m + B_{m-1} t^{m-1} + \dots + B_1 t + B_0)$ \\[1em]
	
	$a \cos(kt) + b \sin(kt)$
	& $t^s(A \cos(kt) + B \sin(kt))$ \\[1em]
	
	$e^{rt}(a \cos(kt) + b \sin(kt))$
	& $t^s e^{rt}(A \cos(kt) + B \sin(kt))$ \\[1em]
	
	$e^{rt}(b_m t^m + b_{m-1} t^{m-1} + \dots + b_1 t + b_0)$
	& $t^s e^{rt}(B_m t^m + B_{m-1} t^{m-1} + \dots + B_1 t + B_0)$ \\[1em]
	
	$\begin{aligned}
	&(b_m t^m + b_{m-1} t^{m-1} + \dots + b_0)\cos(kt) \\
	&\quad + (a_m t^m + a_{m-1} t^{m-1} + \dots + a_0)\sin(kt)
	\end{aligned}$
	&
	$\begin{aligned}
	&t^s(B_m t^m + B_{m-1} t^{m-1} + \dots + B_0)\cos(kt) \\
	&\quad + t^s(A_m t^m + A_{m-1} t^{m-1} + \dots + A_0)\sin(kt)
	\end{aligned}$ \\[1em]
	
	$\begin{aligned}
	&e^{rt}(b_m t^m + b_{m-1} t^{m-1} + \dots + b_0)\cos(kt) \\
	&\quad + e^{rt}(a_m t^m + a_{m-1} t^{m-1} + \dots + a_0)\sin(kt)
	\end{aligned}$
	&
	$\begin{aligned}
	&t^s e^{rt}(B_m t^m + B_{m-1} t^{m-1} + \dots + B_0)\cos(kt) \\
	&\quad + t^s e^{rt}(A_m t^m + A_{m-1} t^{m-1} + \dots + A_0)\sin(kt)
	\end{aligned}$
\end{tabular}
\caption{Trial forms of the particular solution $x_p(t)$ for various forcing functions $f(t)$ in the method of undetermined coefficients. Here, $s$ is chosen according to the multiplicity of the corresponding root of the characteristic equation.}
\end{table}
\noindent where $s$ is the smallest non-negative integer such that no term in $x_p$ duplicates a term in $x_h$.

\begin{example}
	Find the form of $x_p$ for
	\begin{align*}
		x^{\prime\prime} + 6 x^{\prime} + 13x = e^{-3t} \cos(2t).
	\end{align*}
The characteristic equation is $\lambda^2 + 6 \lambda + 13 = 0 \ \Rightarrow \ \lambda = -3 \pm 2i$. Thus, 
\begin{align*}
	x_h(t) = c_1e^{-3t} \cos(2t) + c_2 e^{-3t} \sin(2t).
\end{align*}
We see that we cannot try $x_p(t) = A e^{-3t} \cos(2t) + B e^{-3t} \sin(2t)$ the first term duplicates a term in $x_h$. We therefore multiply by $t$:
\begin{align*}
	x_p(t) =t ( A e^{-3t} \cos(2t) + B e^{-3t} \sin(2t)).
\end{align*}
\end{example}

\begin{example}
	Find the form of $x_p$ for
	\begin{align*}
		x^{\prime\prime} - 2x^{\prime} + x = e^t.
	\end{align*}
We have $\lambda^2 - 2 \lambda+1 = (\lambda-1)^2 = 0 \Rightarrow \lambda = 1$ (repeated). Then $x_h(t) = c_1 e^t + c_2 t e^t$. If we put $x_p(t) = A e^t$, this duplicates the first term in $x_h$. Multiplying by $t$ gives $x_p(t) = At e^t$, but this duplicates the second term in $x_h$, so we multiply by $t$ again:
\begin{align*}
	x_p(t) = A t^2 e^t.
\end{align*}
\end{example}

The next theorem is known as the \textbf{superposition principle}.
\begin{theorem}
	If $x_1$ is a solution to $ax^{\prime\prime} + bx^{\prime} + cx = f_1$ and $x_2$ is a solution to $ax^{\prime\prime} + bx^{\prime} + cx = f_2$, then the function $x = c_1 x_1 + c_2 x_2$ is a solution to the DE $ax^{\prime\prime} + bx^{\prime} + cx = c_1f_1 + c_2 f_2$, where $c_1$ and $c_2$ are constants.
\end{theorem}
\begin{proof}
	Plugging in:
	\begin{align*}
		a x^{\prime\prime} + bx^{\prime} + cx &= a(c_1x_1+c_2x_2)^{\prime\prime} + b(c_1x_1+c_2x_2)^{\prime} + c(c_1x_1+c_2x_2) \\
		&= \underbrace{a x_1^{\prime\prime} + bx_1^{\prime} + cx_1}_\textrm{$=c_1f_1$}  + \underbrace{a x_2^{\prime\prime} + bx_2^{\prime} + cx_2}_\textrm{$=c_2f_2$}  = c_1 f_1 + c_2 f_2.
	\end{align*}
\end{proof}
It follows that if the inhomogeneous term is of the form $f = f_1 + f_2$, where the method of undetermined coefficients can be applied to $f_1$ and $f_2$, then we can find $x_p$ by determining $x_{p_1}$ and $x_{p_2}$, the particular solutions for the equation with inhomogeneous terms $f_1$ and $f_2$, respectively, and setting $x_p =  x_{p_1} + x_{p_2}$.

\begin{example}
Find the form of the particular solution to
\[
x''-4x'+4x=e^t+2t.
\]
First, we find $x_h$ by solving
\[
x''-4x'+4x=0,
\]
which gives
\[
x_h=c_1e^{2t}+c_2te^{2t}.
\]
We next use the superposition principle: $x_p=x_{p_1}+x_{p_2}$, where
\[
x_{p_1}''-4x_{p_1}'+4x_{p_1}=e^t,
\]
\[
x_{p_2}''-4x_{p_2}'+4x_{p_2}=2t.
\]
We find
\[
x_{p_1}=Ae^t
\qquad \text{and} \qquad
x_{p_2}=Bt+C,
\]
so
\[
x_p=Ae^t+Bt+C.
\]
\end{example}

\begin{example}
Find the form of the particular solution to
\[
x''-4x'+4x=e^{2t}+2t.
\]
This is the same as the previous example, except that $e^t$ is replaced by $e^{2t}$. Thus, $x_{p_2}$ is the same as before. For $x_{p1}$, we try
\[
Ae^{2t}.
\]
This repeats a term in $x_h$, so we multiply by $t$:
\[
Ate^{2t}.
\]
This still repeats a term in $x_h$, so we multiply by $t$ again:
\[
x_{p_1}=At^2e^{2t}.
\]
Thus
\[
x_p=At^2e^{2t}+Bt+C.
\]
\end{example}

\begin{example}
Find the form of $x_p$ for
\[
x''+2x'=7e^{-2t}+3.
\]
We have $\lambda_1=0$, $\lambda_2=-2$, so
\[
x_h=c_1e^{0t}+c_2e^{-2t}=c_1+c_2e^{-2t}.
\]
Then try
\[
x_{p_1}=Ae^{-2t}.
\]
Since this repeats $x_h$, multiply by $t$:
\[
x_{p_1}=Ate^{-2t}.
\]
Also try
\[
x_{p_2}=B.
\]
Since this also repeats $x_h$, multiply by $t$:
\[
x_{p_2}=Bt.
\]
So
\[
x_p=Ate^{-2t}+Bt.
\]
\end{example}

\begin{theorem}
	Consider $ax^{\prime\prime} + bx^{\prime} + cx = f$, where $a, b, c$ are constants, and $a \neq 0$. Suppose that $x_p$ is a particular solution of the DE in an interval $I$ containing $t_0$, and let $X_0$ and $X_1$ be two given numbers. Then there exists a unique solution in $I$ to the DE satisfying the initial conditions $x(t_0) = X_0$ and $x'(t_0) = X_1$.
\end{theorem}
\begin{proof}
By the superposition principle, $x = x_h + x_p$ solves the DE. Recall that $x_h = c_1x_1 + c_2x_2$, where $x_1$ and $x_2$ are linearly independent solutions to the associated homogeneous equation and $c_1$ and $c_2$ are constants. Then we need to solve
\begin{align*}
	x(t_0) = c_1 x_1(t_0) + c_2 x_2(t_0) + x_p(t_0) = X_0 \\
	x^{\prime}(t_0) = c_1 x_1^{\prime}(t_0) + c_2 x_2^{\prime}(t_0) + x_p^{\prime}(t_0) = X_1
\end{align*}
for $c_1$ and $c_2$. We find
\begin{align*}
	c_1 = \frac{(X_0-x_p^{\prime}(t_0)) x_2^{\prime}(t_0) - (X_1 - x_p^{\prime}(t_0)) x_2(t_0)}{x_1(t_0) x_2^{\prime}(t_0) - x_1^{\prime}(t_0) x_2(t_0)} \\
	c_2= \frac{(X_1-x_p^{\prime}(t_0)) x_1(t_0) - (X_0 - x_p^{\prime}(t_0)) x_1(t_0)}{x_1(t_0) x_2^{\prime}(t_0) - x_1^{\prime}(t_0) x_2(t_0)}
\end{align*}
The denominators in these expressions are non-zero because $x_1$ and $x_2$ are linearly independent (so their Wronskian is not zero).\\\\
To check uniqueness, suppose that $z$ is another solution to the IVP. But $w = c_1 x_1 + c_2 x_2 + x_p - z.$ Then, plugging in, we see that $w$ solves $a w^{\prime\prime} + b w^{\prime} + cw = 0$ with $w(t_0) = 0,\; w^{\prime}(t_0) = 0$. But we have seen that this IVP, where the IC and the inhomogeneous term are all zero, admits only the zero solution. Thus, $w =0$ and $z = c_1 x_1 + c_2 x_2 + x_p$. \\
\end{proof}

\begin{definition}
	We call a solution $x = x_h + x_p$ the \textbf{general solution} to $ax^{\prime\prime} + bx^{\prime} + cx = f$.  
\end{definition}

 %%Next Time Start here type version page 26, written version page 70
\section{Linear second order non-homogeneous equations: the method of variation of parameters} 
The method of undetermined coefficients will not work if the inhomogeneous term is not of the form listed on the table that summarized the method. This is because the method of undetermined coefficients is based on the property that derivatives of the inhomogeneous term repeat themselves. The method we will present now, called \textbf{variation of parameters}, deals with more general inhomogeneous terms.\\\\
Consider $ax^{\prime\prime} + bx^{\prime} + cx = f$ and let $x_1$ and $x_2$ be two linearly independent solutions to the associated homogeneous equation. We will seek a solution of the form:
\begin{align*}
	x_p(t) = v_1(t) x_1(t) + v_2(t) x_2(t)
\end{align*}
where $v_1$ and $v_2$ are functions to be determined.
Compute:
\begin{align*}
	x_p^{\prime} = v_1^{\prime} x_1 + v_2^{\prime} x_2 + v_1 x_1^{\prime} + v_2 x_2^{\prime}.
\end{align*}
Next, we reason as follows. Since $v_1$ and $v_2$ are two functions to be determined, we expect to have two equations. One equation has to come from $ax^{\prime\prime} + bx^{\prime} + cx = f$, since we want $x_p$ to be a solution. What about the second equation? Because we plug $x_p$ into $ax^{\prime\prime} + bx^{\prime} + cx = f$, we will obtain another DE involving $v_1$ and $v_2$ that is at least as complicated as the equation we are trying to solve, unless we impose some condition that simplifies it. We therefore require:
\begin{align*}
	v_1^{\prime} x_1 + v_2^{\prime} x_2 = 0
\end{align*}
which gives our second equation. Thus, $x_p^{\prime}$ becomes:
\begin{align*}
	x_p^{\prime} = v_1 x_1^{\prime} + v_2 x_2^{\prime} .
\end{align*}
Continuing, $x_p^{\prime\prime} = v_1^{\prime} x_1^{\prime} + v_2^{\prime} x_2^{\prime} +v_1x_1^{\prime\prime} + v_2 x_2^{\prime\prime}$. Then
\begin{align*}
a x_p^{\prime\prime} + b x_p^{\prime} + c x_p &= a (v_1^{\prime} x_1^{\prime} + v_2^{\prime} x_2^{\prime} +v_1x_1^{\prime\prime} + v_2 x_2^{\prime\prime}) + b(v_1 x_1^{\prime} + v_2 x_2^{\prime}) + c(v_1 x_1 + c_2 x_2)\\
&=  v_1 \underbrace{(ax_1^{\prime\prime} + b x_1^{\prime}  + cx_1)}_\textrm{=0} + v_2 \underbrace{(ax_2^{\prime\prime} + b x_2^{\prime} + c x_2)}_\textrm{=0} + a (v_1^{\prime} x_1^{\prime} + v_2 x_2^{\prime}) \\
&= a (v_1^{\prime} x_1^{\prime} + v_2^{\prime} x_2^{\prime})  = f.
\end{align*}
Therefore, we have two equations:
\begin{align*}
	x_1 v_1^{\prime} + x_2 v_2^{\prime} &= 0 \\
	x_1^{\prime} v_1^{\prime} + x_2^{\prime} v_2^{\prime} &= \frac{f}{a}
\end{align*}
This is an algebraic system for $v_1^{\prime}$ and $v_2^{\prime}$. Solving it, we find:
\begin{align*}
	v_1^{\prime} = \frac{-f x_2}{a (x_1 x_2^{\prime} - x_1^{\prime} x_2)}, \ v_2^{\prime} = \frac{f x_1}{a (x_1 x_2^{\prime} - x_1^{\prime} x_2)}
\end{align*}
The denominators in these expressions are not zero because $x_1$ and $x_2$ are linearly independent. Integrating:
\begin{align*}
	v_1(t) = \frac{-1}{a} \int \frac{f(t) x_2(t)}{W(x_1,x_2) (t)} dt,  \ v_2(t) = \frac{1}{a} \int \frac{f(t) x_1(t)}{W(x_1,x_2) (t)} dt.
\end{align*}
We do not add constants to these integrals because $x_p$ does not contain arbitrary constants. Thus, recalling that $x_p = v_1 x_1 + v_2 x_2$, we find:
\begin{center}
	\fbox{\begin{minipage}{7.5 cm}
			\begin{align*}
				x_p(t) = - \frac{x_1(t)}{a} \int \frac{f(t) x_2(t)}{W(x_1,x_2) (t)} dt + \frac{x_2(t)}{a} \int \frac{f(t) x_1(t)}{W(x_1,x_2) (t)} dt 
			\end{align*}
	\end{minipage}}
\end{center}

\begin{example}
Find $x_p$ for $x^{\prime\prime} + 4x = \tan t$. \\

\noindent Note that we cannot apply the method of undetermined coefficients here. To find $x_p$, we first solve the associated homogeneous equation. The characteristic equation is $\lambda^2 + 4 = 0, \;\lambda = \pm 2i$. Thus, $x_1(t) = \cos(2t) $ and $x_2(t) = \sin (2t) $ are two linearly independent solutions. The Wronskian is 
\begin{align*}
	W(\cos 2t, \sin 2t) (t) &= \cos(2t) (\sin(2t))^{\prime} - (\cos(2t))^{\prime} \sin(2t) \\
	& = 2 \cos^2(2t) + 2 \sin^2(2t) =2.
\end{align*}
Then
\begin{align*}
	x_p(t) = -\cos (2t) \underbrace{\int \frac{\tan t \sin (2t)}{2} dt}_\textrm{$=\frac{t}{2}-\frac{1}{4} \sin(2t)$} + \sin(2t)
\underbrace{\int \frac{\tan t \cos(2t)}{2}\, dt}_
{\smash{\textrm{$= -\frac{1}{4}\cos(2t) + \frac{1}{2}\ln|\cos t|$}}}
\end{align*}
\begin{align*}
	x_p(t) =\frac{1}{2} \left(\frac{1}{2} \sin(2t) -t\right) \cos (2t)  + \frac{1}{2} \left(\ln|\cos t| - \frac{1}{2} \cos(2t)\right) \sin(2t).
\end{align*}
\end{example}

\begin{example}
	Find $x_p$ for $x^{\prime\prime} - 2x^{\prime} + x = \frac{e^t}{t}$. (Note that we cannot use the method of undetermined coefficients here.)\\\\
	The characteristic equation is $\lambda^2 - 2 \lambda + 1 = 0, \;\lambda = 1$ (repeated). Then $x_1(t) = e^t$ and $x_2(t) = t e^t$ are two linearly independent solutions to the associated homogeneous equation.
	\begin{align*}
		W(e^t, t e^t) = e^t (t e^t)^{\prime} - (e^t)^{\prime} t e^t &= e^t(e^t + t e^t) - e^t e^t = e^{2t} \\
		\int \frac{f(t) x_2(t)}{W(x_1, x_2) (t) } dt &= \int \frac{e^t}{t} \frac{t e^t}{e^{2t}} dt = t \\
		\int \frac{f(t) x_1(t)}{W(x_1, x_2) (t) } dt &= \int \frac{e^t}{t} \frac{ e^t}{e^{2t}} dt = \int \frac{dt}{t} = \ln|t|
	\end{align*}
Since $f(t)$ is not defined for $t = 0$, we need to work with $ t > 0$ or $t < 0$. We consider $t > 0$ so that $\ln|t| = \ln t$. Then: 
\begin{align*}
	x_p(t) = - t e^t + t e^t \ln t.
\end{align*}
\end{example}

\begin{remark}
	We make no restriction on the form of $f(t)$. In particular, the parameter variation method can also be applied to equations where $f(t)$ has a form appropriate for the use of undetermined coefficients.
\end{remark}
 
 
 %%Next Time Start here type version page 28, written version page 76
\section{Second order linear equations with variable coefficients}
So far, we studied $a x^{\prime\prime} + b x^{\prime} + cx = f$ under the assumption that $a, b, c$ are constants. Now we will study $a_2(t) x^{\prime\prime}(t) + a_1(t) x^{\prime}(t) + a_0(t) x(t) = f(t)$, i.e., the coefficients can be functions of $t$. We will assume that $a_2(t) \neq 0$ so that, dividing by $a_2(t)$ and relabeling the coefficients and the inhomogeneous term, we can write the equation as $x^{\prime\prime}(t) + p(t) x^{\prime}(t) + q(t) x(t) = g(t)$. In order to be consistent with our previous notation, we will also call the inhomogeneous term $f(t)$ in this case. Thus, the equation we will study is  
\begin{align*}
	x^{\prime\prime} + p(t) x^{\prime} + q(t) x = f(t).
\end{align*}
\begin{theorem}
	Let $p(t), q(t)$ and $f(t)$ be continuous functions on the interval $(a,b)$ and $t_0 \in (a, b)$. Given any numbers $X_0$ and $X_1$, there exists a unique solution $x(t)$ defined on $(a,b)$ that satisfies the following:
	\begin{align*}
	\begin{cases}
		x^{\prime\prime} + p(t) x^{\prime} + &q(t) x = f(t)  \\
		&x(t_0) = X_0 \\
		&x^{\prime}(t_0) = X_1 \\
	\end{cases}
		\end{align*}
\end{theorem}

\begin{example}
	Consider $(t^2 - 4 ) x^{\prime\prime} + x^{\prime} + x = \frac{1}{t+1},\, x(1) = 0,\, x^{\prime}(1) = 1$. What is the maximal interval $(a,b)$ where the previous theorem guarantees the existence of a unique solution?\\\\
	After dividing by $t^2-4$, we have $p(t) = q(t) =\frac{1}{t^2-4}$, which are continuous except at $t = \pm 2$ and $f(t) = \frac{1}{(t^2-4) (t+1)}$, which is continuous except for $t = \pm 2, t = -1$. Since $t_0 = 1,$ the largest interval that contains this point is $(a,b) = (-1,2)$.
	\begin{figure}[H]
		\centering
		\includegraphics[scale=.8]{./pic/p76.pdf}
	\end{figure}
\end{example}
As in the case of constant coefficients, we will call the equation $x^{\prime\prime} + p(t) x + q(t) x = 0$ the \textbf{associated homogeneous equation}. It can be shown that this equation admits two linearly independent solutions $x_1$ and $x_2$ (if $p$ and $q$ are continuous). Then $x_h = c_1 x_1 + c_2 x_2$, where $c_1$ and $c_2$ are arbitrary constants, is also a solution, called the \textbf{general solution} to the DE $x^{\prime\prime} + p(t) x + q(t) x = 0$. \\\\
A solution to $x^{\prime\prime} + p(t) x + q(t) x = f(t)$ that does not contain arbitrary constants will be called a \textbf{particular solution}, denoted $x_p$. As in the case of constant coefficients, \textbf{any solution to the DE can be written as $x = x_h + x_p$} (provided that $p(t)$ and $q(t)$ are continuous).\\

Many of the theorems for equations with constant coefficients generalize to the case studied here, with the important difference that now statements will in general not hold on $(-\infty, \infty)$ but on an interval $(a,b)$ where $p(t)$ and $q(t)$ are continuous.


\begin{lemma}
	Let $p(t)$ and $q(t)$ be continuous functions on an interval $I$. Let $x_1(t)$ and $x_2(t)$ be two solutions of $x^{\prime\prime} + p(t) x + q(t) x = 0$ on $I$. If the Wronskian $W(x_1, x_2) (t) = x_1(t) x_2^{\prime}(t) - x_1^{\prime}(t) x_2(t)$ is zero at some point on $I$, then it vanishes identically and $x_1$ and $x_2$ are linearly dependent. If $W(x_1, x_2)(t)$ is non-zero at some point on $I$, then it is never zero and the solutions are linearly independent on $I$. 
\end{lemma}

\begin{theorem}
	Let $p(t), q(t)$ and $f(t)$ be continuous functions on an interval $I$ and $x_1(t)$ and $x_2(t)$ be two linearly independent solutions to $x^{\prime\prime} + p(t) x + q(t) x = 0$ on $I$. Let $x_p(t)$ be a particular solution to $x^{\prime\prime} + p(t) x^{\prime} + q(t) x = f(t)$. Then given $t_0 \in I$ and two real numbers $X_0, X_1$, there exist unique constants $c_1$ and $c_2$ such that $x = c_1 x_1 + c_2 x_2 + x_p$ satisfies $x^{\prime\prime} + p(t) x^{\prime} + q(t) x = f(t)$ with initial conditions $x(t_0) = X_0$ and $x^{\prime}(t_0) = X_1$.
\end{theorem}

The \textbf{superposition principle} also holds for equations with variable coefficients. \\\\
If we go back to the parameter variation method and look at how the formula for $x_p$ was derived, we will see that nowhere have we used that the coefficients had to be constants. In other words, variation of parameters applied here as well, i.e., if $x_1$ and $x_2$ are two linearly independent solutions of the associated homogeneous equation, then a particular solution is given by
\begin{align*}
	x_p(t) = - x_1(t) \int \frac{f(t) x_2(t)}{W(x_1, x_2) (t) } dt + x_2(t) \int \frac{f(t) x_1(t)}{W(x_1, x_2) (t) } dt.
\end{align*}
The formula for $x_p$ involves $x_1$ and $x_2$. In the case of constant coefficients, we have a method for finding $x_1$ and $x_2$. Here, this might be difficult. However, the next theorem shows that if we know $x_1$, then we can always determine $x_2$:
\begin{theorem}
	Let $x_1(t)$ be a solution to $x^{\prime\prime} + p(t) x^{\prime} + q(t) x = 0$ in an interval $I$, where $p(t)$ and $q(t)$ are continuous functions. Assume that $x_1$ is not identically zero. Then
	\begin{align*}
		x_2(t) = x_1(t) \int \frac{e^{-\int p(t) dt}}{(x_1(t))^2} dt
	\end{align*}
	is a second, linearly independent solution.
\end{theorem}
\begin{proof}
	We look for a solution of the form $x_2(t) = v(t) x_1(t)$. Plugging in:
	\begin{align*}
		x_2^{\prime\prime} + p(t) x_2^{\prime} + q(t) x_2 &= (v x_1^{\prime\prime} + 2 v^{\prime} x_1^{\prime} + v^{\prime\prime} x_1) + p(t) (vx_1^{\prime} + v^{\prime} x_1) + q(t) v x_1 \\
		&= v \underbrace{(x_1^{\prime\prime} + p(t) x^{\prime} + q(t) x)}_\textrm{=0} + x_1 v^{\prime\prime} + (2 x_1^{\prime} + p(t) x_1) v^{\prime} = 0
	\end{align*}
	Set $v^{\prime} = w$. Then the equation becomes:
	\begin{align*}
		x_1 w^{\prime} + (2 x_1^{\prime} + p(t) x_1) w = 0
	\end{align*}
which is a separable equation for $w$. We find
\begin{align*}
	\frac{dw}{w} = - \frac{2 x_1^{\prime}}{x_1} - p(t).
\end{align*}
Integrating: $\ln |w| = - 2 \ln |x_1| - \int p(t) dt$. Then:
\begin{align*}
	w = \frac{e^{- \int p(t) dt}}{x_1^2}\,.
\end{align*}
When we remove the absolute value from $w$ we pick the $+$ sign (this suffices since if $w$ is a solution, so is $-w$). Integrating again, we find $v(t)$, which gives the desired formula.\\\\
By construction, $x_2(t)$ is a solution. Let us check that it is linearly independent.
\begin{align*}
	W(x_1, x_2) (t) &= x_1 x_2^{\prime} - x_1^{\prime} x_2 = x_1 (v x_1)^{\prime} - x_1^{\prime} (v x_1) \\
	&= x_1 (x_1 v^{\prime} + x_1^{\prime} v) - x_1^{\prime} v x_1 = x_1^2 v^{\prime} = x_1^2 \frac{e^{- \int p(t) dt}}{x_1^2} = e^{- \int p(t) dt} \neq 0\,.
\end{align*}
\end{proof}

\begin{example}
	Knowing that $\cos t$ is a solution to 
	\begin{align*}
		\sin t x^{\prime\prime} - 2 \cos t x^{\prime} - \sin t x = 0, \ 0 < t < \pi,
	\end{align*}
find a second linearly independent solution.\\\\
Here, $p(t) = \frac{-2 \cos t }{\sin t} = -2 \cot t$.
\begin{align*}
	x_2(t)  &= \cos t \int \frac{1}{\cos^2 t} e^{2 \int \cot t \ dt }dt , \text{ where } \int \cot t \ dt=\ln |\sin t| = \ln (\sin t), 0 < t < \pi \\
	&= \cos t \int \frac{\sin^2 t}{\cos^2 t} dt = \cos t (\tan t - t)
\end{align*}
\end{example}

\begin{remark}
	The formulas we derived above (variation of parameters and second linearly independent solution) assume the equation to be written as $x^{\prime\prime} + p(t) x^{\prime} + q(t) x = f(t)$, i.e., the coefficient of $x^{\prime\prime}$ is one. If this is not the case, we have to divide by the coefficient of $x^{\prime\prime}$ before applying the formulas, as in the previous examples.
\end{remark}

\begin{remark}
	Recall that in the case of constant coefficients, where $\lambda_1 = \lambda_2 = \lambda$, a second linearly independent solution was $t e^{\lambda t}$. We can use the previous theorem to give an alternative justification of this formula.
\end{remark}

 
\section{Cauchy-Euler equation}
The equation
 \begin{align*}
 	a t^2 x^{\prime\prime} + b t x^{\prime} + cx = f(t)
 \end{align*}
 where $a, b, c$ are constants and $a \neq 0$, is called \textbf{Cauchy-Euler} equation (aka the equidimensional equation). \\

\noindent We will consider the homogeneous Cauchy-Euler equation
\begin{align*}
	a t^2 x^{\prime\prime} + b t x^{\prime} + x = 0, \ t > 0.
\end{align*}
Because the coefficients involve the power of $t$, it makes sense to look for a solution $x(t) = t^{\lambda}, \, \lambda$ to be a constant. Then:
\begin{align*}
	a t^2 \lambda (\lambda-1) t^{\lambda - 2} + b t \lambda t^{\lambda-1} + c t^{\lambda}  = 0, \ \text{or } (t \neq 0)
\end{align*}

\begin{center}
	\fbox{\begin{minipage}{ 5 cm}
			\begin{align*}
				a \lambda^2 +( b-a) \lambda + c = 0
			\end{align*}
	\end{minipage}}
\end{center}
\smallskip
which is called the \textbf{characteristic equation} for the Cauchy-Euler equation. If $\lambda$ is a root of the characteristic equation, by construction, $t^{\lambda}$ is a solution. Denote the roots of the characteristic equation by $\lambda_1$ and $\lambda_2$. We need to distinguish the following cases:\\\\
\noindent \textbf{Case 1.} $\lambda_1 \neq \lambda_2$, $\lambda_1, \lambda_2$ are real numbers. Then $t^{\lambda_1}$ and $t^{\lambda_2}$ are two linearly independent solutions. We already know that they are solutions. To verify linear independence:
\begin{align*}
	W(t^{\lambda_1}, t^{\lambda_2}) (t) = t^{\lambda_1}(t^{\lambda_2})^{\prime} - (t^{\lambda_1})^{\prime} t^{\lambda_2} = (\lambda_2 - \lambda_1) t^{\lambda_1 + \lambda_2-1} \neq 0, \text{for } t \neq 0\,.
\end{align*}
\textbf{Case 2.} $\lambda_1 = \lambda_2 = \lambda$. Then $t^{\lambda}$ and $t^{\lambda} \ln t$ are two linearly independent solutions. We obtain $t^{\lambda} \ln t$ by applying our method to find a second linearly independent solution.
\begin{align*}
	x_2(t) &= t^{\lambda} \int \frac{e^{-\int p(t) dt}}{(t^{\lambda})^2} dt = t^{\lambda} \int \frac{e^{-\frac{b}{a}\int \frac{dt}{t}}}{t^{ 2 \lambda}} dt \\
	&= t^{\lambda} \int \frac{t^{-\frac{b}{a}} }{t^{ 2 \lambda}} dt = t^{\lambda} \int t^{-\frac{b}{a}-2\lambda} dt\,.
\end{align*}
In the case $\lambda_1 - \lambda_2 = \lambda$, the (repeated) roots are given by $\lambda = \frac{-(b-a)}{2a}$, so $ - \frac{b}{a} - 2 \lambda = -1$. Thus, 
\begin{align*}
	x_2(t) = t^{\lambda} \int t^{-1} dt = t^{\lambda}  \ln t\,.
\end{align*}
\noindent \textbf{Case 3.} $\lambda_1, \lambda_2$ complex, so that $\lambda_1 = \alpha + i \beta$ and $\lambda_2 = \alpha - i \beta, \ \alpha, \beta \in \mathbb{R}$. Then $t^{\alpha} \cos (\beta \ln t)$ and $t^{\alpha} \sin (\beta \ln t)$ are two linearly independent solutions. We write
\begin{align*}
	t^{\lambda_1} = t^{\alpha + i \beta} = t^{\alpha} t^{i \beta} = t^{\alpha} (e^{\ln t})^{i \beta} = t^{\alpha} e^{i \beta \ln t}\,.
\end{align*}
Euler's formula gives $t^{\lambda_1} = t^{\alpha} \cos(\beta \ln t) + i \ t^{\alpha} \sin (\beta \ln t) $. In the case of constant coefficients, we showed that if $z(t) = u(t) + i v(t)$ is a solution, with $u, v$ real, then so are $u(t)$ and $v(t)$. The same proof works here, and we conclude that $t^{\alpha} \cos(\beta \ln t) $ and $t^{\alpha} \sin (\beta \ln t)$ are solutions. We check that they are linearly independent:
\begin{align*}
	W(t^{\alpha} \cos(\beta \ln t), t^{\alpha} \sin (\beta \ln t)) 
	= t^{\alpha} \cos(\beta \ln t) ( t^{\alpha} \sin (\beta \ln t))^{\prime} - (t^{\alpha} \cos(\beta \ln t))^{\prime} (t^{\alpha} \sin (\beta \ln t)) \\
	= t^{\alpha} \cos(\beta \ln t) \left( \alpha t^{\alpha-1} \sin (\beta \ln t) + t^{\alpha} \frac{\beta}{t} \cos (\beta \ln t)\right) - \left(\alpha t^{\alpha-1}\cos(\beta \ln t) - t^{\alpha} \frac{\beta}{t} \sin (\beta \ln t)\right)
\end{align*}
\begin{align*}
	t^{\alpha} \sin (\beta \ln t) = t^{2 \alpha-1} \beta \left(\cos^2 (\beta \ln t) + \sin^2 (\beta \ln t)\right) = \beta t^{2 \alpha-1} \neq 0, \text{ since } t > 0 \text{ and } \beta \neq 0 \\
	\text{ (because otherwise the roots could not be complex).}
\end{align*}

\begin{remark}
	In the above, we solved the Cauchy-Euler equation for $t > 0$. If we want to solve it for $t<0$, we proceed as follows. Set $\tau = -t$, so that $\tau > 0$. Then
	\begin{align*}
		&x(t) = x(-\tau), \;x^{\prime} = \frac{dx}{dt} = \frac{dx}{t \tau} \frac{d \tau}{dt} = - \frac{dx}{dt}, \text{ and } \\
		&x^{\prime\prime} = \frac{d^2 x}{d t} = \frac{d}{d \tau} \left(\frac{dx}{dt}\right) \frac{d \tau}{dt} = \frac{d^2x}{d \tau^2}, \text{ and the equation becomes}
			\end{align*}
			\begin{align*}
		a t^2 x^{\prime\prime} + bt x^{\prime} + cx = (- \tau)^2 \frac{d^2x}{d \tau^2} + b(- \tau) \left(-\frac{dx}{d \tau}\right) + cx = 0, \ i.e., \ a \tau^2 \frac{d^2 x}{d \tau^2} + b \tau \frac{dx}{d \tau} + cx = 0, \tau > 0
	\end{align*}
Now we can apply the above algorithm to find the solutions as functions of $\tau$, and then replace $\tau = -t$ to obtain the result.
\end{remark}
 

 %%Next Time Start here type version page 35, written version page 96
\section{Direction fields} 
Consider the DE $y^{\prime} = f(x,y)$. If $f(x,y)$ is very complicated, it might be difficult to find the function $y$. We will develop a method for studying this equation that will allow us to get a good grasp of what $y$ looks like, even when we cannot write it explicitly. 

\begin{example}
	Consider the equation $y^{\prime} = \frac{-y}{x}$. We can solve this equation, but to illustrate the new method, let us imagine that we do not know the solution. What the equation tells us is the value of the slope of the tangent to the graph of $y$ (i.e., $y^{\prime}$) at each point $x, y$. We construct a table of values. With enough values, we can plot the slope, on the $xy$-plane. 
\end{example}

\begin{table}[h]
\centering
\begin{tabular}{ l | c | r }
    \hline
    $x$ & $y$ & $y^{\prime} = -\frac{y}{x}$ \\ \hline
    1 & 0 & 0 \\
    1 & 1 & -1 \\
    2 & 1 & $-\frac{1}{2}$ \\
    1 & 2 & -2 \\
    \vdots & \vdots & \vdots \\
    \hline
\end{tabular}
\caption{Representative slope calculations for the differential equation $y' = -\frac{y}{x}$.}
\end{table}
\begin{figure}[H]
	\centering
	\includegraphics[scale=.5]{./pic/p95.pdf}
    \caption{Direction Field: $y^{\prime}=f(x,y)$}
\end{figure}

Using enough points, we can sketch solutions. The important thing to remember is that the solutions have their graphs tangent to the line segments we plotted, and that they vary continuously. For example, below, we draw the solutions that satisfy $y(1) = 2$ and $y(1) = -2$.

\begin{figure}[H]
	\centering
	\includegraphics[scale=.6]{./pic/p96.pdf}
    \caption{Solutions with IC — $y(1) = 2$, $y(1) = -2$}
\end{figure}

 
\section{Euler's method}
Consider a DE $y^{\prime}= f(x,y)$. Depending on what $f$ is, we may not be able to find a formula for the general solution. In this case, we can use direction fields to obtain some qualitative information on the behavior of solutions. Euler's method is a way of finding approximate solutions that provide further quantitative information.\\\\
The idea of Euler's method is that if we know the value of $y = y(x)$ at $x_0$, then $y(x_0 + h)$ can be approximated with the help of the derivative of $y$ at $x$. 
\begin{figure}[H]
	\centering
	\includegraphics[scale=.8]{./pic/p97.pdf}
    \caption{Tangent Line Approximation}
\end{figure}

\noindent This idea requires knowing $y^{\prime}$, which in our case we know since we have $y^{\prime} = f(x,y)$. Thus,
\begin{align*}
	y^{\prime}(x_0) = f(x_0, y_0) \approx \frac{y(x_0+h) - y(x_0)}{h} \Rightarrow y(x_0 + h) \approx y(x_0) + h f(x_0, y_0).
\end{align*}
We can now repeat the process. Starting from the point
\begin{align*}
	x_1 = x_0 + h, \,y_1 \approx y(x_0+h) = y(x_1), \text{ we find } y_2 \approx y(x_1+h) = y(x_0+2h)
\end{align*}
\begin{align*}
	y^{\prime}(x_1) =f(x_1, y(x_1)) \approx \frac{y(x_1+h) - y(x_1)}{h} \Rightarrow y(x_1+h) \approx y(x_1) + h f(x_1, y(x_1))
\end{align*}
This formula is not good because we do not know $y(x_1)$. But we can use $y_1 \approx y(x_1)$ so 
\begin{align*}
	y(x_1 + h) \approx y_1 + hf(x_1, y_1)
\end{align*}

\begin{figure}[H]
	\centering
	\includegraphics[scale=.8]{./pic/p98.pdf}
    \caption{Piecewise Linear Approximation via Euler’s Method}
\end{figure}

We can continue the process and find $y_3, \,y_4$, etc., which will be approximately $y(x_3), \,y(x_4)$, etc., where $x_3 = x_0 + 3h,\, x_4 = x_0 + 4h$, etc.

\subsection{Summary of Euler's method} 
Consider
$\begin{cases}
		y^{\prime} &= f(x,y) \\
		y(x_0) &= y_0 
\end{cases} \\$
Fix a small number $h$, called the step size, and set inductively:
\begin{align*}
	x_{m+1} &= x_m + h \\
	y_{m+1} &= y_m + h f(x_m, y_m)
\end{align*}
The points $y_m$ will be approximations for $y(x_m)$.
\begin{remark}
	Because we have to know the initial point $(x_0, y_0)$, Euler's method is better studied to study IVP. However, we can use it to investigate the general solution with varying $y_0$. 
\end{remark}
\begin{remark}
	Typically, the smaller the step size $h$, the better the approximation.
\end{remark}

\begin{example}
	Consider $y^{\prime} = x \sqrt{y},\, y(1) = 4$. We can solve this equation exactly. Let us compare the values of the exact solution with those of Euler's method with $h = 0.1.$
	\bigskip
	\begin{table}[h]
\centering
\begin{tabular}{ c | c | c | c }
	\hline
	$m$ & $x_m$ & $y_m \text{ (Euler's method)}$ & $y(x_m) \text{ (exact value)}$ \\ \hline
	0 & 0 & 4 & 4 \\ \hline
	1 & 1.1 & 4.2 & 4.21276 \\ \hline
	2 & 1.2 & 4.42543 & 4.45210 \\ \hline
	3 & 1.3 & 4.467787 & 4.71976 \\ \hline
	4 & 1.4 & 4.95904 & 5.01760 \\ \hline
	5 & 1.5 & 5.27081 & 5.34766 \\ \hline
\end{tabular}
\caption{Euler’s method approximations and exact solution values at the mesh points \(x_m\).}
\end{table}
\end{example}

\section{Higher order linear differential equations}

We will now study
\[
a_n(t)x^{(n)}(t)+a_{n-1}(t)x^{(n-1)}(t)+\cdots+a_1(t)x'(t)+a_0(t)x(t)=f(t).
\]
This is a linear equation. We say that the equation has \textbf{}{constant coefficients} if all the coefficients $a_i(t)$ are constants, and \textbf{variable coefficients} otherwise. The equation is called \textbf{homogeneous} if $f(t)=0$ and \textbf{non-homogeneous} otherwise. We say that the equation is in \textbf{standard form} if $a_n(t)=1$, in which case we write
\[
x^{(n)}(t)+p_1(t)x^{(n-1)}+\cdots+p_{n-1}(t)x'(t)+p_n(t)x(t)=f(t).
\]
Many of the results for second order equations generalize to the previous equation (and thus we will go over them quickly).

\begin{theorem}
Suppose that $p_1(t),\dots,p_{n}(t)$, and $f(t)$ are continuous on the interval $(a,b)$. Then, for any $t_0\in(a,b)$ and any real numbers $\overline{x}_0,\dots,\overline{x}_{n-1}$, the IVP
\[
x^{(n)}+p_1(t)x^{(n-1)}+\cdots+p_{n-1}(t)x'+p_n(t)x=f(t),
\]
\[
x(t_0)=\overline{x}_0,\dots,x^{(n-1)}(t_0)=\overline{x}_{n-1}
\]
has a unique solution defined on the interval $(a,b)$.
\end{theorem}

\begin{example}
Show that for a homogeneous constant coefficient equation, the interval $(a,b)$ of the above theorem can be taken as $(-\infty,\infty)$.
\end{example}

A constant function is continuous on $(-\infty,\infty)$.

\begin{definition}
We say that the functions $f_1,\dots,f_m$ are \textbf{linearly dependent} on an interval $I$ if there exist constants $c_1,\dots,c_m$, not all of them zero, such that
\[
c_1f_1(t)+\cdots+c_mf_m(t)=0
\]
for all $t\in I$. Otherwise the functions are called \textbf{linearly independent}.
\end{definition}

\begin{example}
The functions $f_1(t)=t$, $f_2(t)=2-3t$, and $f_3(t)=5$ are linearly dependent on $(-\infty,\infty)$ because
\[
3f_1(t)+1\cdot f_2(t)-\frac{2}{5}f_3(t)
=3t+(2-3t)-\frac{2}{5}\cdot 5
=0.
\]
\end{example}

\begin{example}
The functions $t$, $t^4$, and $t^6$ are linearly independent on $(-\infty,\infty)$.\\\\
If $c_1$, $c_2$, and $c_3$ are such that
\[
c_1t+c_2t^4+c_3t^6=0
\]
for all $t\in(-\infty,\infty)$, then we have
\[
c_1t+c_2t^4+c_3t^6=0t+0t^4+0t^6.
\]
Two polynomials are equal iff their coefficients are equal. Thus $c_1=c_2=c_3=0$. But the definition of linear dependence does not allow all $c_i$'s to be zero, so the functions are linearly independent.
\end{example}

It is useful to know that the following functions are linearly independent on any interval $(a,b)$:
\[
\{1,t,t^2,\dots,t^m\},
\]
\[
\{1,\cos t,\sin t,\cos(2t),\sin(2t),\dots,\cos(mt),\sin(mt)\},
\]
\[
\{e^{k_1t},e^{k_2t},\dots,e^{k_mt}\},\qquad k_1,\dots,k_m \text{ all distinct.}
\]
An expression of the form $c_1f_1(t)+\cdots+c_mf_m(t)$, where $c_1,\dots,c_m$ are constants, is called a \textbf{linear combination} of the functions $f_1(t),\dots,f_m(t)$. Thus, to say that certain functions are linearly dependent means that one of the functions is a linear combination of the others.

\begin{definition}
Let $f_1,\dots,f_n$ be $n$ functions that are $n-1$ times differentiable. The function
\[
W(f_1,\dots,f_n)(t)
=
\det
\begin{bmatrix}
f_1(t) & f_2(t) & \cdots & f_n(t)\\
f_1'(t) & f_2'(t) & \cdots & f_n'(t)\\
\vdots & \vdots & \ddots & \vdots\\
f_1^{(n-1)}(t) & f_2^{(n-1)}(t) & \cdots & f_n^{(n-1)}(t)
\end{bmatrix},
\]
where $\det$ means determinant, is called the \emph{Wronskian} of the functions $f_1,\dots,f_n$.
\end{definition}

\begin{remark}
Recall that
\[
\det \begin{bmatrix} a & b \\ c & d \end{bmatrix} = ad-bc.
\]
Also,
\[
\det
\begin{bmatrix}
a_{11} & a_{12} & a_{13}\\
a_{21} & a_{22} & a_{23}\\
a_{31} & a_{32} & a_{33}
\end{bmatrix}
=
a_{11}\det\begin{bmatrix} a_{22} & a_{23}\\ a_{32} & a_{33}\end{bmatrix}
-
a_{12}\det\begin{bmatrix} a_{21} & a_{23}\\ a_{31} & a_{33}\end{bmatrix}
+
a_{13}\det\begin{bmatrix} a_{21} & a_{22}\\ a_{31} & a_{32}\end{bmatrix}.
\]
\end{remark}

\begin{theorem}
Let $x_1,\dots,x_n$ be solutions to
\[
x^{(n)} + p_1(t)x^{(n-1)} + \cdots + p_n(t)x = 0
\]
on the interval $(a,b)$, and assume that $p_1,\dots,p_n$ are continuous on $(a,b)$. Then the following statements are equivalent:
\begin{enumerate}
    \item $x_1,\dots,x_n$ are linearly dependent on $(a,b)$.
    \item $W(x_1,\dots,x_n)(t_0)=0$ for some $t_0\in(a,b)$.
    \item $W(x_1,\dots,x_n)(t)=0$ for all $t\in(a,b)$.
\end{enumerate}
Moreover, the following statements are also equivalent:
\begin{enumerate}
    \item $x_1,\dots,x_n$ are linearly independent on $(a,b)$.
    \item $W(x_1,\dots,x_n)(t_0)\neq 0$ for some $t_0\in(a,b)$.
    \item $W(x_1,\dots,x_n)(t)\neq 0$ for all $t\in(a,b)$.
\end{enumerate}
\end{theorem}

\begin{example}
Knowing that $1$, $e^t$, and $e^{-t}$ are solutions to $x'''-x'=0$, show that they are linearly independent. We compute:
\[
W(1,e^t,e^{-t})
=
\det
\begin{bmatrix}
1 & e^t & e^{-t}\\
1' & (e^t)' & (e^{-t})'\\
1'' & (e^t)'' & (e^{-t})''
\end{bmatrix}
=
\det
\begin{bmatrix}
1 & e^t & e^{-t}\\
0 & e^t & -e^{-t}\\
0 & e^t & e^{-t}
\end{bmatrix}.
\]
Then
\[
= 1\cdot \det\begin{bmatrix} e^t & -e^{-t}\\ e^t & e^{-t}\end{bmatrix}
- e^t \det\begin{bmatrix} 0 & -e^{-t}\\ 0 & e^{-t}\end{bmatrix}
+ e^{-t}\det\begin{bmatrix} 0 & e^t\\ 0 & e^t\end{bmatrix}
=2\neq 0.
\]
So by the previous theorem the functions are linearly independent.
\end{example}

\begin{remark}
Only computing $W\neq 0$ would not be enough to conclude that $1$, $e^t$, and $e^{-t}$ are linearly independent. We need to know that they are solutions to a linear DE.
\end{remark}

Similarly to the case of second order equations, we call a solution to
\[
x^{(n)}+p_1x^{(n-1)}+\cdots+p_nx=f
\]
without arbitrary constants a \emph{particular solution}, denoted $x_p$. The equation with $f$ replaced by zero is called the \emph{associated homogeneous equation}.

\begin{theorem}
Let $x_p$ be a particular solution to
\[
x^{(n)} + p_1(t)x^{(n-1)} + \cdots + p_n(t)x = f(t) \tag{*}
\]
on the interval $(a,b)$, where $p_1,\dots,p_n,f$ are continuous on $(a,b)$. Let $x_1,\dots,x_n$ be $n$ linearly independent solutions to the associated homogeneous equation. Then any solution to $(*)$ on the interval $(a,b)$ can be written as
\[
x=c_1x_1+\cdots+c_nx_n+x_p,
\]
where $c_1,\dots,c_n$ are constants.
\end{theorem}

The expression $c_1x_1 + \dots + c_nx_n + x_p$ in the above theorem, with $c_1, \dots, c_n$ is called the general solution of the associated homogeneous equation (also called the fundamental solution). The \textbf{superposition principle} also generalizes to equations of order n.

\section{Homogeneous linear equations with constant coefficients}

The theory of constant coefficient homogeneous linear DE is similar to the case of second order equations, and we summarize it below.\\\\
Consider the equation
\[
a_nx^{(n)} + a_{n-1}x^{(n-1)} + \cdots + a_1x' + a_0x = 0,
\]
where $a_0,\dots,a_n$ are constants and $a_n \neq 0$. Its \textbf{characteristic equation} is
\[
a_n\lambda^n + a_{n-1}\lambda^{\,n-1} + \cdots + a_1\lambda + a_0 = 0.
\]
Let $\lambda_1,\dots,\lambda_n$ be the $n$ roots of the characteristic equation.

\textbf{Distinct real roots.}
If $\lambda_1, \dots, \lambda_n$ are all distinct and real, then
\[
e^{\lambda_1 t},\dots,e^{\lambda_n t}
\]
are $n$ linearly independent solutions.

\textbf{Complex roots.}
For each complex root $\lambda = \alpha \pm i\beta$, $\beta \neq 0$, the functions
\[
e^{\alpha t}\cos(\beta t)
\qquad \text{and} \qquad
e^{\alpha t}\sin(\beta t)
\]
are two linearly independent solutions.

\textbf{Repeated roots.}
If $\lambda$ is a real root of multiplicity $m$, then
\[
e^{\lambda t},\ te^{\lambda t},\ \dots,\ t^{m-1}e^{\lambda t}
\]
are $m$ linearly independent solutions.

If $\lambda=\alpha+i\beta$, $\beta\neq 0$, has multiplicity $m$ (so $\alpha-i\beta$ also has multiplicity $m$, and $\lambda=\alpha\pm i\beta$ gives a total of $2m$ roots), then
\[
e^{\alpha t}\cos(\beta t),\ te^{\alpha t}\cos(\beta t),\ \dots,\ t^{m-1}e^{\alpha t}\cos(\beta t),
\]
\[
e^{\alpha t}\sin(\beta t),\ te^{\alpha t}\sin(\beta t),\ \dots,\ t^{m-1}e^{\alpha t}\sin(\beta t)
\]
are $2m$ linearly independent solutions.

\begin{example}
Find the general solution to
\[
x'''-2x''-x'+2x=0.
\]
The characteristic equation is
\[
\lambda^3-2\lambda^2-\lambda+2=0.
\]
By inspection, we see that $\lambda=1$ is a root, so factoring $\lambda-1$,
\[
\lambda^3-2\lambda^2-\lambda+2
=
(\lambda-1)(\lambda^2-\lambda-2)
=
(\lambda-1)(\lambda+1)(\lambda-2)=0.
\]
So the roots are $1$, $-1$, and $2$, and
\[
x(t)=c_1e^t+c_2e^{-t}+c_3e^{2t}.
\]
\end{example}

\begin{example}
Find the general solution to
\[
x'''-3x''+4x=0.
\]
The characteristic equation is
\[
\lambda^3-3\lambda^2+4=0.
\]
By inspection we see that $-1$ is a root. Factoring $\lambda+1$,
\[
\lambda^3-3\lambda^2+4
=
(\lambda+1)(\lambda^2-4\lambda+4)
=
(\lambda+1)(\lambda-2)^2.
\]
The roots are $-1$ and $2$ (twice), so
\[
x(t)=c_1e^{-t}+c_2e^{2t}+c_3te^{2t}.
\]
\end{example}

\begin{example}
Find the general solution to
\[
x''''+10x''+9x=0.
\]
The characteristic equation is
\[
\lambda^4+10\lambda^2+9=0.
\]
We can factor
\[
\lambda^4+10\lambda^2+9=(\lambda^2+1)(\lambda^2+9),
\]
so the roots are $\pm i$ and $\pm 3i$. Thus
\[
x(t)=c_1\cos t+c_2\sin t+c_3\cos(3t)+c_4\sin(3t).
\]
\end{example}

\begin{remark}
    Recall that if the order of the equation is $n$, we must have $n$ linearly independent solutions.
\end{remark}

\begin{example}
Below, all roots of the characteristic equation for a constant coefficient homogeneous linear DE are given. State the order of the equation and write the general solution.

\begin{enumerate}
    \item $\lambda=3$, \ $\lambda=2\pm 3i$, \ $\lambda=-2$ (twice)

    \item $\lambda=1$ (three times), \ $\lambda=-1-i$ (twice), \ $\lambda=-1+i$ (twice)

    \item $\lambda=0$ (twice), \ $\lambda=2$, \ $\lambda=-1$
\end{enumerate}
\begin{enumerate}
    \item[(a)] There are five roots in total, so the equation is of order $5$. The general solution is
    \[
    x(t)=c_1e^{3t}+c_2e^{2t}\cos(3t)+c_3e^{2t}\sin(3t)+c_4e^{-2t}+c_5te^{-2t}.
    \]

    \item[(b)] There are seven roots in total, so the order of the equation is $7$. The general solution is
    \[
    x(t)=c_1e^t+c_2te^t+c_3t^2e^t+c_4e^{-t}\cos t+c_5e^{-t}\sin t
    +c_6te^{-t}\cos t+c_7te^{-t}\sin t.
    \]

    \item[(c)] There are four roots in total, so the order of the equation is $4$. The general solution is
    \[
    x(t)=c_1e^{0t}+c_2te^{0t}+c_3e^{2t}+c_4e^{-t}
    =c_1+c_2t+c_3e^{2t}+c_4e^{-t}.
    \]
\end{enumerate}
\end{example}

\begin{remark}
We can also generalize the method of undetermined coefficients and variation of parameters to \textbf{non-homogeneous} DE of order $n$. See the textbook for details.
\end{remark}

\section{Laplace transform}

We will now develop a new method for solving DE. Before introducing formal definitions, let us illustrate with an example.

\begin{example}
Consider the IVP
\[
x''+x=\cos(3t),
\qquad x(0)=1,
\qquad x'(0)=0.
\]
We have already learned how to solve it, but let us consider a different approach. Multiply the equation by $e^{-st}$, where $s>0$, and integrate from $0$ to $\infty$:
\[
\int_0^\infty e^{-st}x''(t)\,dt+\int_0^\infty e^{-st}x(t)\,dt
=
\int_0^\infty e^{-st}\cos(3t)\,dt.
\tag{*}
\]
Using
\[
\int e^{-at}\cos(bt)\,dt
=
\frac{e^{-at}}{a^2+b^2}\bigl(-a\cos(bt)+b\sin(bt)\bigr),
\]
we find
\[
\int_0^\infty e^{-st}\cos(3t)\,dt
=
\left.
\frac{e^{-st}}{s^2+9}\bigl(-s\cos(3t)+3\sin(3t)\bigr)
\right|_0^\infty
=
\frac{s}{s^2+9},
\]
where we used that
\[
e^{-st}\big|_{t=\infty}=e^{-\infty}=0,
\]
so that, by the squeeze theorem,
\[
\left.
\frac{e^{-st}}{s^2+9}\bigl(-s\cos(3t)+b\sin(3t)\bigr)
\right|_{t=\infty}
=0.
\]
Note that we have to use that $s>0$, otherwise we would have $e^{+\infty}=\infty$.\\\\
Next, recall the integration by parts formula:
\[
\int_a^b f(t)g'(t)\,dt
=
-\int_a^b f'(t)g(t)\,dt
+
\left.f(t)g(t)\right|_a^b,
\]
and compute
\begin{align*}
\int_0^\infty e^{-st}x''(t)\,dt
&=
\int_0^\infty e^{-st}(x'(t))'\,dt \\
&=
-\int_0^\infty (e^{-st})'x'(t)\,dt
+
\left.e^{-st}x'(t)\right|_0^\infty \\
&=
s\int_0^\infty e^{-st}x'(t)\,dt
+
\left.e^{-st}x'(t)\right|_0^\infty \\
&=
s\left[
-\int_0^\infty (e^{-st})'x(t)\,dt
+
\left.e^{-st}x(t)\right|_0^\infty
\right]
+
\left.e^{-st}x'(t)\right|_0^\infty \\
&=
s^2\int_0^\infty e^{-st}x(t)\,dt
+
s\left.e^{-st}x(t)\right|_0^\infty
+
\left.e^{-st}x'(t)\right|_0^\infty\\
&=
s^2\int_0^\infty e^{-st}x(t)\,dt
+
\underbrace{s\left.e^{-st}x(t)\right|_{t = \infty}}_{=0 \text{ by } e^{-\infty} = 0}
-
s\left.e^{-st}x(t)\right|_{t =0}
+
\underbrace{\left.e^{-st}x'(t)\right|_{t = \infty}}_{=0 \text{ by } e^{-\infty} = 0}
-
\left.e^{-st}x'(t)\right|_{t = 0}
\end{align*}
Since the terms at $t=\infty$ vanish, this becomes
\[
\int_0^\infty e^{-st}x''(t)\,dt
=
s^2\int_0^\infty e^{-st}x(t)\,dt
-s\underbrace{x(0)}_{=1}-\underbrace{x'(0)}_{=0}
=
s^2\int_0^\infty e^{-st}x(t)\,dt-s.
\]
Plugging the above computations into $(*)$ gives
\[
s^2\int_0^\infty e^{-st}x(t)\,dt
-s
+
\int_0^\infty e^{-st}x(t)\,dt
=
\frac{s}{s^2+9}.
\]
\end{example}

At this point we have not yet found $x(t)$, but note that whatever $x(t)$ is, the integral
\[
\int_0^\infty e^{-st}x(t)\,dt
\]
is a \textbf{function of} $s$. Indeed, we are performing a definite (improper) integral in the variable $t$, but $s$ can be any number $>0$. Let us call this function of $s$ by $X(s)$, so we have
\[
s^2X(s)-s+X(s)=\frac{s}{s^2+9}.
\]
Thus,
\[
X(s)(s^2+1)=\frac{s}{s^2+9}+s \,\Rightarrow \,X(s)=\frac{s}{(s^2+9)(s^2+1)}+\frac{s}{s^2+1}.
\]
Note that
\[
\frac{s}{(s^2+9)(s^2+1)}
=
\frac{s(s^2+9)-s(s^2+1)}{8(s^2+9)(s^2+1)}
=
\frac{1}{8}\frac{s}{s^2+1}-\frac{1}{8}\frac{s}{s^2+9},
\]
so
\[
X(s)=\frac{9}{8}\frac{s}{s^2+1}-\frac{1}{8}\frac{s}{s^2+9}.
\]
But
\[
\int_0^\infty e^{-at}\cos(bt)\,dt=\frac{a}{a^2+b^2}, \quad \text{so} \quad
\frac{9}{8}\frac{s}{s^2+1}
=
\frac{9}{8}\int_0^\infty e^{-st}\cos(t)\,dt,
\]
and
\[
-\frac{1}{8}\frac{s}{s^2+9}
=
-\frac{1}{8}\int_0^\infty e^{-st}\cos(3t)\,dt.
\]
Thus we can write
\[
\int_0^\infty e^{-st}\underbracket{x(t)}dt
=
X(s)
=
\frac{9}{8}\int_0^\infty e^{-st}\cos(t)\,dt
-\frac{1}{8}\int_0^\infty e^{-st}\cos(3t)\,dt
\]
\[
=
\int_0^\infty e^{-st}\underbracket{\left(\frac{9}{8}\cos(t)-\frac{1}{8}\cos(3t)\right)}dt.
\]
Comparing both sides we find
\[
x(t)=\frac{9}{8}\cos(t)-\frac{1}{8}\cos(3t),
\]
which is the solution to the DE.\\\\
The idea of the previous example was to transform the DE for the unknown $x(t)$ into an algebraic equation for the unknown $X(s)$. We could then easily solve for $X(s)$ (as algebraic equations are easier to solve than DE). Once we knew $X(s)$, we were able to recognize, from calculus formulas, what $x(t)$ needed to be.\\\\
We will develop this idea further. We see that the function
\[
\overline{X}(s)=\int_0^\infty e^{-st}x(t)\,dt,
\]
where $x(t)$ is the (to be found) solution to the DE, plays an important role, motivating the following definition.

\begin{definition}
Let $f$ be a function defined on $[0,\infty)$. The \textbf{Laplace transform} of $f$ is the function $F$ defined by the integral
\[
F(s)=\int_0^\infty e^{-st}f(t)\,dt.
\]
The domain of $F$ is all the values of $s$ such that the integral converges.
\end{definition}

\begin{notation}
We also denote the Laplace transform of $f$ by $\mathcal{L}\{f\}$. When we use the notation $F$, we usually employ capital letters for the Laplace transform. So the Laplace transform of $f(t)$, $x(t)$, $y(t)$, $z(t)$, \dots, is denoted by $\mathcal{L}\{f\}$, $\mathcal{L}\{x\}$, $\mathcal{L}\{y\}$, $\mathcal{L}\{z\}$, or $F(s)$, $X(s)$, $Y(s)$, $Z(s)$, respectively.
\end{notation}

From the previous example, we already know that
\[
\mathcal{L}\{\cos(at)\}=\frac{s}{s^2+a^2}, \qquad s>0.
\]

\begin{example}
Find $\mathcal{L}\{t^2\}$.\\\\
Computing the integral, we find
\[
\mathcal{L}\{t^2\}
=
\int_0^\infty e^{-st}t^2\,dt
=
\left.
-\frac{e^{-st}(s^2t^2+2st+2)}{s^3}
\right|_0^\infty
=
\frac{2}{s^3}
\]
for $s>0$. The integral diverges for $s\leq 0$, so
\[
\mathcal{L}\{t^2\}=\frac{2}{s^3}, \qquad s>0.
\]
\end{example}

Since we will use the Laplace transform to solve DE, we will be computing $\mathcal{L}\{f\}$ for different functions $f$. It is therefore convenient to catalog the Laplace transform of the most common functions:

\begin{table}[h]
\centering
\begin{tabular}{c c c}
$f(t)$ & $F(s)=\mathcal{L}\{f\}(s)$ & domain of $F(s)$ \\[0.5em]
\hline \\[-0.7em]
$1$ & $\dfrac{1}{s}$ & $s>0$ \\[1em]
$e^{at}$ & $\dfrac{1}{s-a}$ & $s>a$ \\[1em]
$t^n,\; n=1,2,\dots$ & $\dfrac{n!}{s^{n+1}}$ & $s>0$ \\[1em]
$\sin(bt)$ & $\dfrac{b}{s^2+b^2}$ & $s>0$ \\[1em]
$\cos(bt)$ & $\dfrac{s}{s^2+b^2}$ & $s>0$ \\[1em]
$e^{at}t^n$ & $\dfrac{n!}{(s-a)^{n+1}}$ & $s>a$ \\[1em]
$e^{at}\sin(bt)$ & $\dfrac{b}{(s-a)^2+b^2}$ & $s>a$ \\[1em]
$e^{at}\cos(bt)$ & $\dfrac{s-a}{(s-a)^2+b^2}$ & $s>a$
\end{tabular}
\caption{Laplace transforms and the corresponding domains of convergence.}
\end{table}

These formulas are proved by directly computing the integrals
\[
\int_0^\infty e^{-st}f(t)\,dt
\]
for each function $f(t)$. A very important property is that the Laplace transform is linear: if $c_1$ and $c_2$ are constants, then
\[
\mathcal{L}\{c_1f_1+c_2f_2\}
=
c_1\mathcal{L}\{f_1\}+c_2\mathcal{L}\{f_2\}.
\]
To see this, simply compute
\[
\mathcal{L}\{c_1f_1+c_2f_2\}
=
\int_0^\infty e^{-st}\bigl(c_1f_1(t)+c_2f_2(t)\bigr)\,dt
\]
\[
=
c_1\int_0^\infty e^{-st}f_1(t)\,dt
+
c_2\int_0^\infty e^{-st}f_2(t)\,dt
\]
\[
=
c_1\mathcal{L}\{f_1\}+c_2\mathcal{L}\{f_2\}.
\]
An advantage of the Laplace transform over other methods for solving DE that we learned is that with the Laplace transform we will be able to solve DE with discontinuous functions. Thus, let us see an example of how to compute the Laplace transform of discontinuous functions.

\begin{example}
Find $\mathcal{L}\{f\}$ if
\[
f(t)=
\begin{cases}
e^{2t}, & 0<t<3,\\
1, & t>3.
\end{cases}
\]
\begin{figure}[H]
\centering
\begin{tikzpicture}[scale=0.9]

    % Axes
    \draw[->, thick] (-0.5,0) -- (8,0) node[right] {$t$};
    \draw[->, thick] (0,-0.5) -- (0,5);

    % Tick marks and labels
    \draw (3,0.08) -- (3,-0.08);
    \node[below] at (3,0) {$3$};

    \draw (0.08,1) -- (-0.08,1);
    \node[left] at (0,1) {$1$};

    \draw (0.08,4) -- (-0.08,4);
    \node[left] at (0,4) {$e^6$};

    % Dashed guide lines
    \draw[dashed] (0,1) -- (3,1);
    \draw[dashed] (0,4) -- (3,4);
    \draw[dashed] (3,1) -- (3,4);

    % Curve for 0 < t < 3
    \draw[thick, domain=0:3, smooth, variable=\x] 
        plot ({\x}, {exp(0.4621*\x)}); % chosen so y(0)=1 and y(3)=4 visually

    % Open circles at t = 3
    \draw[thick, fill=white] (3,4) circle (2pt);
    \draw[thick, fill=white] (3,1) circle (2pt);

    % Constant branch for t > 3
    \draw[thick] (3.02,1) -- (7.2,1);

\end{tikzpicture}
\caption{Piecewise: exponential growth $t\in (0,3)$ and constant value $1$ for $t>3$.}
\end{figure}
Then
\[
F(s)=\int_0^\infty e^{-st}f(t)\,dt
=
\int_0^3 e^{-st}f(t)\,dt+\int_3^\infty e^{-st}f(t)\,dt
\]
\[
=
\int_0^3 e^{-st}e^{2t}\,dt+\int_3^\infty e^{-st}\cdot 1\,dt
=
\int_0^3 e^{(2-s)t}\,dt+\int_3^\infty e^{-st}\,dt
\]
\[
=
\left.\frac{e^{(2-s)t}}{2-s}\right|_0^3
-
\left.\frac{e^{-st}}{s}\right|_3^\infty
=
\frac{1-e^{-3(s-2)}}{s-2}+\frac{e^{-3s}}{s},
\qquad s\neq 2.
\]
For $s=2$ we have
\[
F(2)=\int_0^3 e^{-2t}e^{2t}\,dt+\int_3^\infty e^{-2t}\,dt
=
3+\frac{e^{-6}}{2}.
\]
The integral diverges for $s\leq 0$.\\\\
Therefore,
\[
F(s)=
\begin{cases}
\dfrac{1-e^{-3(s-2)}}{s-2}+\dfrac{e^{-3s}}{s}, & s\neq 2,\\[1em]
3+\dfrac{e^{-6}}{2}, & s=2,
\end{cases}
\qquad (s>0).
\]
\end{example}

A function as in the previous example is called \textbf{piecewise continuous}. More precisely, a function $f$ is \textbf{piecewise continuous} on an interval $[a,b]$ if it is continuous except for a finite number of points. A function is piecewise continuous on $[0,\infty)$ if it is piecewise continuous on $[0,N]$ for every $N>0$. A function $f$ is called of \textbf{exponential order} $\alpha$ if there exist positive constants $M$ and $T$ such that
\[
|f(t)|\leq Me^{\alpha t}
\qquad \text{for all } t\geq T.
\]

\begin{example}
The function $f$ defined on $[-2,2]$ by
\[
f(t)=
\begin{cases}
-2, & -2\leq t<-1,\\
0, & -1\leq t<0,\\
t, & 0\leq t<1,\\
2, & 1\leq t\leq 2
\end{cases}
\]
is piecewise continuous since it is discontinuous only at $t=-1$ and $t=1$ (note that $f$ is continuous at $t=0$).

\begin{figure}[H]
\centering
\begin{tikzpicture}[scale=0.9]

    % Axes
    \draw[->, thick] (-2.4,0) -- (3,0) node[right] {$t$};
    \draw[->, thick] (0,-2.4) -- (0,2.6);

    % Tick marks and labels on x-axis
    \foreach \x/\lbl in {-2/$-2$, -1/$-1$, 1/$1$, 2/$2$} {
        \draw (\x,0.08) -- (\x,-0.08);
        \node[below] at (\x,-0.08) {\lbl};
    }

    % Tick marks and labels on y-axis
    \foreach \y/\lbl in {-2/$-2$, -1/$-1$, 1/$1$, 2/$2$} {
        \draw (0.08,\y) -- (-0.08,\y);
        \node[left] at (-0.08,\y) {\lbl};
    }

    % Piece 1: f(t) = -2,  -2 <= t < -1
    \draw[blue, thick] (-2,-2) -- (-1,-2);
    \fill[blue] (-2,-2) circle (2.2pt);
    \draw[blue, thick, fill=white] (-1,-2) circle (2.2pt);

    % Piece 2: f(t) = 0,  -1 <= t < 0
    \draw[blue, thick] (-1,0) -- (0,0);
    \fill[blue] (-1,0) circle (2.2pt);
    % no open circle at (0,0) since next piece includes it

    % Piece 3: f(t) = t,  0 <= t < 1
    \draw[blue, thick] (0,0) -- (1,1);
    \fill[blue] (0,0) circle (2.2pt);
    \draw[blue, thick, fill=white] (1,1) circle (2.2pt);

    % Piece 4: f(t) = 2,  1 <= t <= 2
    \draw[blue, thick] (1,2) -- (2,2);
    \fill[blue] (1,2) circle (2.2pt);
    \fill[blue] (2,2) circle (2.2pt);

\end{tikzpicture}
\caption{Graph of the piecewise-defined function}
\end{figure}
\end{example}

\begin{example}
The function $\dfrac{1}{t}$ is \underline{not} piecewise continuous on any interval containing the origin.
\end{example}

\begin{example}
The function $f(t)=3e^{2t}\cos(t)$ is of exponential order $2$, with $M=3$ and any $T$, because
\[
|f(t)|=|3e^{2t}\cos(t)|\leq 3e^{2t}.
\]
\end{example}

\begin{example}
The function $f(t)=e^{t^2}$ is \underline{not} of exponential order $\alpha$ for any $\alpha$. If it were, then
\[
|f(t)|=|e^{t^2}|\leq Me^{\alpha t}
\]
for some $\alpha>0$ and $M>0$, and all $t\geq T$. Thus
\[
\frac{e^{t^2}}{e^{\alpha t}}\leq M.
\]
But since this is supposed to hold for all $t\geq T$, we can take the limit $t\to\infty$, arriving at a contradiction because
\[
M\geq \lim_{t\to\infty}\frac{e^{t^2}}{e^{\alpha t}}
=
\lim_{t\to\infty}e^{t^2-\alpha t}
=
+\infty.
\]
The basic idea of a piecewise discontinuous function is that it is allowed to “jump,” but not to have “infinite jumps,” as $\frac{1}{t}$ does when $t$ “passes through zero.” The idea of an exponential function of order $\alpha$ is that it cannot grow faster than an ordinary exponential $e^{\alpha t}$.
\end{example}

The following theorem gives conditions for the existence of the Laplace transform, i.e., conditions such that the integral defining the Laplace transform converges.

\begin{theorem}[Conditions for existence of the Laplace transform]
If $f(t)$ is piecewise continuous on $[0,\infty)$ and of exponential order $\alpha$, then $\mathcal{L}\{f\}(s)=F(s)$ exists for $s>\alpha$.
\end{theorem}

\subsection{Properties of the Laplace transform}

\begin{align*}
\mathcal{L}\{f+g\}&=\mathcal{L}\{f\}+\mathcal{L}\{g\}\\
\mathcal{L}\{cf\}&=c\,\mathcal{L}\{f\}, \qquad c=\text{constant}\\
\mathcal{L}\{e^{at}f(t)\}(s)&=\mathcal{L}\{f\}(s-a)\\
\mathcal{L}\{f'\}(s)&=s\,\mathcal{L}\{f\}-f(0)\\
\mathcal{L}\{f''\}(s)&=s^2\mathcal{L}\{f\}(s)-sf(0)-f'(0)\\
\mathcal{L}\{f^{(n)}\}(s)&=s^n\mathcal{L}\{f\}(s)-s^{n-1}f(0)-s^{n-2}f'(0)-\cdots-f^{(n-1)}(0)\\
\mathcal{L}\{t^n f(t)\}(s)&=(-1)^n\frac{d^n}{ds^n}\bigl(\mathcal{L}\{f\}(s)\bigr)
\end{align*}
(See the textbook for a proof of these properties.)

\begin{example}
Find $\mathcal{L}\{e^{-t}t\sin(t)\}$.\\\\
Let $f_1(t)=\sin(t)$. Then
\[
\mathcal{L}\{f_1\}(s)=\frac{1}{s^2+1}=F_1(s).
\]
Let $f_2(t)=t\sin(t)$. By the above properties,
\[
\mathcal{L}\{f_2\}(s)=\mathcal{L}\{t\sin(t)\}(s)
=-\frac{dF_1(s)}{ds}
=-\frac{d}{ds}\left(\frac{1}{s^2+1}\right)
=\frac{2s}{(s^2+1)^2}
=F_2(s).
\]
Using again the properties,
\[
\mathcal{L}\{e^{-t}t\sin(t)\}(s)
=\mathcal{L}\{e^{-t}f_2(t)\}(s)
=\mathcal{L}\{f_2(t)\}(s+1)
=F_2(s+1)
\]
\[
=\frac{2(s+1)}{\bigl((s+1)^2+1\bigr)^2}.
\]
\end{example}

\section{The inverse Laplace transform}

We saw how to find the Laplace transform $F(s)$ of a given function $f(t)$. We now ask whether we can do the “inverse” process, i.e., given $F(s)$, find a $f(t)$ such that $\mathcal{L}\{f\}=F$.

\begin{definition}
Given a function $F(s)$, if there is a function $f(t)$ that is continuous on $[0,\infty)$ and satisfies
\[
\mathcal{L}\{f\}=F,
\]
then we say that $f$ is the \textbf{inverse Laplace transform} of $F$ and write
\[
f=\mathcal{L}^{-1}\{F\}.
\]

If every function $f$ satisfying $\mathcal{L}\{f\}=F$ is discontinuous, then we can take any of them to be the inverse Laplace transform of $F$ (indeed, which one we take will be inconsequential for studying DE) and still write
\[
f=\mathcal{L}^{-1}\{F\}.
\]
\end{definition}

\begin{example}
Find $\mathcal{L}^{-1}\left\{\dfrac{27}{s^4}\right\}$. Since $\mathcal{L}\{t^n\}=\frac{n!}{s^{n+1}}$,
we see that
\[
\mathcal{L}^{-1}\left\{\frac{27}{s^4}\right\}
=\mathcal{L}^{-1}\left\{\frac{3!}{s^{3+1}}\right\}
=t^3.
\]
\end{example}

\begin{example}
Find $\mathcal{L}^{-1}\left\{\dfrac{s-1}{s^2-2s+5}\right\}$. \\\\
Write
\[
\frac{s-1}{s^2-2s+5}
=
\frac{s-1}{(s-1)^2+4}.
\]
Using
\[
\mathcal{L}\{\cos(bt)\}=\frac{s}{s^2+b^2} \quad \text{and} \quad
\mathcal{L}\{e^{at}f(t)\}=F(s-a),
\]
we find
\[
\mathcal{L}^{-1}\left\{\frac{s-1}{s^2-2s+5}\right\}
=
\mathcal{L}^{-1}\left\{\frac{s-1}{(s-1)^2+4}\right\}
=
e^t\cos(2t).
\]
\end{example}

A very important property of the inverse Laplace transform is that it is linear, i.e.,
\[
\mathcal{L}^{-1}\{c_1F_1+c_2F_2\}
=
c_1\mathcal{L}^{-1}\{F_1\}+c_2\mathcal{L}^{-1}\{F_2\},
\]
where $c_1$ and $c_2$ are constants.\\\\
We also have the properties
\[
\mathcal{L}^{-1}\{\mathcal{L}\{f\}\}=f \quad \text{and} \quad
\mathcal{L}\{\mathcal{L}^{-1}\{F\}\}=F.
\]

\begin{example}
Find $\mathcal{L}^{-1}\left\{-\dfrac{s+7}{s^2+s-2}\right\}$. \\\\The function $-\frac{s+7}{s^2+s-2}$ does not appear in our list of Laplace transforms, nor does it correspond directly to one of the properties
applied to a function in our list. But we can write
\[
s^2+s-2=(s+2)(s-2)
\]
and try to split
\[
-\frac{s+7}{s^2+s-2}
=
\frac{-s-7}{(s+2)(s-2)}
=
\frac{A}{s+1}+\frac{B}{s-2}.
\]
Applying partial fractions we find $A=2$, $B=-3$, thus
\[
-\frac{s+7}{s^2+s-2}
=
\frac{2}{s+1}-\frac{3}{s-2}, \quad \text{so}
\]
\begin{align*}
\mathcal{L}^{-1}\left\{-\frac{s+7}{s^2+s-2}\right\}
&=
\mathcal{L}^{-1}\left\{\frac{2}{s+1}\right\}
+
\mathcal{L}^{-1}\left\{-\frac{3}{s-2}\right\}\\
&=
2\mathcal{L}^{-1}\left\{\frac{1}{s+1}\right\}
-
3\mathcal{L}^{-1}\left\{\frac{1}{s-2}\right\}.
\end{align*}
Since $\mathcal{L}\{e^{at}\}=\frac{1}{s-a}$, we find
\[
\mathcal{L}^{-1}\left\{-\frac{s+7}{s^2+s-2}\right\}
=
2e^{-t}-3e^{2t}.
\]
\end{example}

As the previous example illustrates, partial fractions are very useful to find the inverse Laplace transform, so it is useful to briefly recall how to apply it.

\subsection{The method of partial fractions}

Let $P(s)$ and $Q(s)$ be polynomials and consider $\frac{P(s)}{Q(s)}$.\\\\
\textbf{Case I.}
$Q(s)$ can be factored as
\[
Q(s)=(s-\lambda_1)(s-\lambda_2)\cdots(s-\lambda_n),
\]
where all $\lambda_i$'s are different. Then the partial fraction has the form:
\[
\frac{P(s)}{Q(s)}
=
\frac{A_1}{s-\lambda_1}
+
\frac{A_2}{s-\lambda_2}
+\cdots+
\frac{A_n}{s-\lambda_n},
\]
where $A_1,\dots,A_n$ are real numbers to be determined.\\\\
\textbf{Case II.}
$Q(s)$ has a factor $(s-\lambda)^\ell$. Then, the corresponding portion of the partial fraction 
\[
\frac{A_1}{s-\lambda}
+
\frac{A_2}{(s-\lambda)^2}
+\cdots+
\frac{A_\ell}{(s-\lambda)^\ell},
\]
where $A_1,\dots,A_\ell$ are real numbers to be determined.\\\\
\textbf{Case III.}
$Q(s)$ has a quadratic factor $(s-\alpha)^2+\beta^2$ that cannot be reduced to real linear factors, with $\ell$ being the highest power of $(s-\alpha)^2+\beta^2$ that divides $Q(s)$. Then, the corresponding portion of the partial fraction is
\[
\frac{A_1(s-\alpha)+B_1}{(s-\alpha)^2+\beta^2}
+
\frac{A_2(s-\alpha)+B_2}{\bigl((s-\alpha)^2+\beta^2\bigr)^2}
+\cdots+
\frac{A_\ell(s-\alpha)+B_\ell}{\bigl((s-\alpha)^2+\beta^2\bigr)^\ell},
\]
where $A_1,\dots,A_\ell,B_1,\dots,B_\ell$ are real numbers to be determined.

\begin{example}
Write the form of the partial fraction for
\[
F(s)=\frac{1}{(s^2+s-2)(s^2-4s+13)^2(s^2+6s+9)^2}.
\]
Write
\[
s^2+s-2=(s-1)(s+2),
\]
\[
s^2-4s+13=(s-2)^2+3^2,
\]
\[
s^2+6s+9=(s+3)^2,
\]
thus
\[
\frac{1}{(s^2+s-2)(s^2-4s+13)^2(s^2+6s+9)^2}
=
\frac{1}{(s-1)(s+2)\bigl((s-2)^2+9\bigr)^2(s+3)^4}.
\]
The portion $(s-1)(s+2)$ corresponds to Case I, $\bigl((s-2)^2+9\bigr)^2$ to Case III with $\ell=2$, and $(s+3)^4$ to Case II with $\ell=4$. Thus
\begin{align*}
\frac{1}{(s^2+s-2)(s^2-4s+13)^2(s^2+6s+9)^2}
&=
\frac{A_1}{s-1}
+
\frac{A_2}{s+2}
+
\frac{A_3}{s+3}
+
\frac{A_4}{(s+3)^2} \\
&\quad+
\frac{A_5}{(s+3)^3}
+
\frac{A_6}{(s+3)^4}
+
\frac{A_7(s-2)+A_8}{(s-2)^2+3^2} \\
&\quad+
\frac{A_9(s-2)+A_{10}}{\bigl((s-2)^2+3^2\bigr)^2}.
\end{align*}
\end{example}

\section{Solving IVP with the Laplace transform}

Let us go back to the example
\[
x''+x=\cos(3t),
\qquad x(0)=1,
\qquad x'(0)=0.
\]
We found $x(t)$ by multiplying the equation by $e^{-st}$, integrating from $0$ to $\infty$, finding $\overline{X}(s)$, and finally identifying a function $x(t)$ such that
\[
\int_0^\infty e^{-st}x(t)\,dt=\overline{X}(s).
\]
Now that we developed the Laplace transform, we see that what we did was to use the Laplace transform to solve the IVP. Applying $\mathcal{L}$, we converted the DE for $x(t)$ into an algebraic equation for $X(s)$. After finding $X(s)$, we found $x(t)$ using $\mathcal{L}^{-1}$. Thus, repeating what we did before, but now using the terminology of the Laplace transform, we have:
\begin{align*}
\mathcal{L}\{x''+x\}&=\mathcal{L}\{\cos(3t)\}=\frac{s}{s^2+9}.\\
= \mathcal{L}\{x''\}+\mathcal{L}\{x\}
&=s^2\mathcal{L}\{x\}-sx(0)-x'(0)
\end{align*}
by properties of the Laplace transform. Using $x(0)=1$, $x'(0)=0$, and denoting $\mathcal{L}\{x\}(s)=X(s)$:
\[
s^2X(s)-s+X(s)=\frac{s}{s^2+9}.
\]
Thus
\[
X(s)=\frac{s}{(s^2+1)(s^2+9)}+\frac{s}{s^2+1}
=
\frac{9}{8}\frac{s}{s^2+1}-\frac{1}{8}\frac{s}{s^2+9}.
\]
Applying $\mathcal{L}^{-1}$:
\[
x(t)=\mathcal{L}^{-1}\{X(s)\}
=
\mathcal{L}^{-1}\left\{
\frac{9}{8}\frac{s}{s^2+1}
-
\frac{1}{8}\frac{s}{s^2+9}
\right\}
\]
\[
=
\frac{9}{8}\mathcal{L}^{-1}\left\{\frac{s}{s^2+1}\right\}
-
\frac{1}{8}\mathcal{L}^{-1}\left\{\frac{s}{s^2+9}\right\}
\]
\[
=
\frac{9}{8}\cos(t)-\frac{1}{8}\cos(3t).
\]
The Laplace transform allows us to \textbf{change the DE for $x(t)$ into an algebraic (thus simpler) equation for $X(s)$.}

\[
\text{DE for } x(t)
\overset{\text{usual methods for solving DE}}{\longrightarrow}
\text{solution } x(t)
\]

\[
\downarrow \mathcal{L}
\qquad\qquad\qquad\qquad\qquad\qquad\qquad
\uparrow \mathcal{L}^{-1}
\]

\[
\text{algebraic equation for } X(s)
\overset{\text{simple algebra to find } X(s)}{\longrightarrow}
\text{solution } X(s)
\]

\subsection{Solving IVP with the Laplace transform}

\begin{enumerate}
    \item Take $\mathcal{L}$ of the DE.
    \item Use the properties of $\mathcal{L}$ and the I.C. to obtain an algebraic equation for $X(s)$. Find $X(s)$.
    \item Find $x(t)$ by
    \[
    x(t)=\mathcal{L}^{-1}\{X(s)\}.
    \]
\end{enumerate}

\begin{example}
Solve the IVP below using Laplace transform.
\[
x''' + 4x'' + x' - 6x = -12
\]
\[
x(0)=1,\qquad x'(0)=4,\qquad x''(0)=-2.
\]

\[
\mathcal{L}\{x''' + 4x'' + x' - 6x\}
=
\mathcal{L}\{-12\}
=
-\frac{12}{s}.
\]

\[
\mathcal{L}\{x'''\}
+
4\mathcal{L}\{x''\}
+
\mathcal{L}\{x'\}
-
6\mathcal{L}\{x\}.
\]
Using
\[
\mathcal{L}\{x'''\}
=
s^3X(s)-s^2x(0)-sx'(0)-x''(0),
\]
\[
\mathcal{L}\{x''\}
=
s^2X(s)-sx(0)-x'(0),
\]
\[
\mathcal{L}\{x'\}
=
sX(s)-x(0),
\]
\[
\mathcal{L}\{x\}=X(s),
\]
we get:
\[
s^3X(s)-s^2x(0)-sx'(0)-x''(0)
+
4\bigl(s^2X(s)-sx(0)-x'(0)\bigr)
+
sX(s)-x(0)
-
6X(s)
=
-\frac{12}{s}.
\]
Substituting $x(0)=1$, $x'(0)=4$, and $x''(0)=-2$:
\[
s^3X(s)-s^2-4s+2
+
4(s^2X(s)-s-4)
+
sX(s)-1
-
6X(s)
=
-\frac{12}{s}.
\]
\[
X(s)(s^3+4s^2+s-6)
=
-\frac{12}{s}+s^2+8s+15
=
\frac{s^3+8s^2+15s-12}{s}.
\]
Thus
\[
X(s)
=
\frac{s^3+8s^2+15s-12}{s(s^3+4s^2+s-6)}.
\]
We see that $s=1$ is a root of $s^3+4s^2+s-6$, so
\[
s^3+4s^2+s-6
=
(s-1)(s^2+5s+6)
=
(s-1)(s+2)(s+3).
\]
Hence
\[
X(s)
=
\frac{s^3+8s^2+15s-12}{s(s-1)(s+2)(s+3)}
=
\frac{A}{s}+\frac{B}{s-1}+\frac{C}{s+2}+\frac{D}{s+3}.
\]
Solving the partial fractions, we find
\[
A=2,\qquad B=1,\qquad C=-3,\qquad D=1.
\]
So
\[
X(s)=\frac{2}{s}+\frac{1}{s-1}-\frac{3}{s+2}+\frac{1}{s+3}.
\]
Therefore
\begin{align*}
x(t)
&=
\mathcal{L}^{-1}X(s)\} \\
&=
\mathcal{L}^{-1}\left\{\frac{2}{s}+\frac{1}{s-1}-\frac{3}{s+2}+\frac{1}{s+3}\right\} \\
&=
2\mathcal{L}^{-1}\left\{\frac{1}{s}\right\}
+\mathcal{L}^{-1}\left\{\frac{1}{s-1}\right\}
-3\mathcal{L}^{-1}\left\{\frac{1}{s+2}\right\}
+\mathcal{L}^{-1}\left\{\frac{1}{s+3}\right\} \\
&=
2+e^t-3e^{-2t}+e^{-3t}.
\end{align*}
\end{example}

\begin{example}
Use Laplace transform to solve
\[
x''-2x'+x=6t-2,
\qquad
x(-1)=3,
\qquad
x'(-1)=7.
\]
This problem is not given with initial conditions at $t=0$, which we need to use properties of the Laplace transform. So we change variables:
\[
y(t)=x(t-1).
\]
By the chain rule,
\[
y'(t)=x'(t-1),
\qquad
y''(t)=x''(t-1).
\]
Then
\[
y(0)=x(-1),
\qquad
y'(0)=x'(-1).
\]
Evaluating the equation at $t-1$ (i.e., replacing $t$ by $t-1$):
\[
x''(t-1)-2x'(t-1)+x(t-1)=6(t-1)-2=6t-8, \quad \text{so}
\]
so
\[
y''(t)-2y'(t)+y(t)=6t-8,
\qquad
y(0)=3,
\qquad
y'(0)=7.
\]
Then
\[
\mathcal{L}\{y''\}-2\mathcal{L}\{y'\}+\mathcal{L}\{y\}
=
\mathcal{L}\{6t-8\}
=
\frac{6}{s^2}-\frac{8}{s}.
\]
Thus
\[
s^2Y(s)-sy(0)-y'(0)-2\bigl(sY(s)-y(0)\bigr)+Y(s)
=
\frac{6}{s^2}-\frac{8}{s}.
\]
Substituting $y(0)=3$ and $y'(0)=7$:
\[
(s^2-2s+1)Y(s)
=
\frac{6}{s^2}-\frac{8}{s}+3s+1
=
\frac{3s^3+s^2-8s+6}{s^2}.
\]
Since $s^2-2s+1=(s-1)^2$, we get
\[
Y(s)
=
\frac{3s^3+s^2-8s+6}{s^2(s-1)^2}
=
\frac{A}{s}+\frac{B}{s^2}+\frac{C}{s-1}+\frac{D}{(s-1)^2}.
\]
We find
\[
A=4,\qquad B=6,\qquad C=-1,\qquad D=2.
\]
Then
\[
Y(s)=\frac{4}{s}+\frac{6}{s^2}-\frac{1}{s-1}+\frac{2}{(s-1)^2}.
\]
Therefore
\begin{align*}
Y(t)
&=
4\mathcal{L}^{-1}\left\{\frac{1}{s}\right\}
+6\mathcal{L}^{-1}\left\{\frac{1}{s^2}\right\}
-\mathcal{L}^{-1}\left\{\frac{1}{s-1}\right\}
+2\mathcal{L}^{-1}\left\{\frac{1}{(s-1)^2}\right\} \\
&=
4+6t-e^t+2te^t.
\end{align*}
Since $y(t)=x(t-1)$, we have
\[
x(t)=y(t+1),
\]
so
\begin{align*}
x(t)
&=
4+6(t+1)-e^{t+1}+2(t+1)e^{t+1} \\
&=
10+6t+e^{t+1}+2te^{t+1}.
\end{align*}
\end{example}

\begin{remark}
In the above example, once we decompose $Y(s)$ into partial fractions
\[
Y(s)=\frac{3s^3+s^2-8s+6}{s^2(s-1)^2}
=
\frac{A}{s}+\frac{B}{s^2}+\frac{C}{s-1}+\frac{D}{(s-1)^2},
\]
we can find $y(t)$ except for the values of $A$, $B$, $C$, and $D$, as
\[
Y(t)=\mathcal{L}^{-1}\{Y(s)\}
=
A\mathcal{L}^{-1}\left\{\frac{1}{s}\right\}
+
B\mathcal{L}^{-1}\left\{\frac{1}{s^2}\right\}
+
C\mathcal{L}^{-1}\left\{\frac{1}{s-1}\right\}
+
D\mathcal{L}^{-1}\left\{\frac{1}{(s-1)^2}\right\}
\]
\[
=
A+Bt+Ce^t+Dte^t.
\]
Since the process of determining $A$, $B$, $C$, and $D$ is a simple but tedious algebraic computation, you may be asked to solve a problem using the Laplace transform without determining the constants of partial fractions, leaving them indicated, as above.
\end{remark}

\noindent \textbf{Using the Laplace transform when the initial conditions are not given at \(t_0=0\)}\\\\
As in the previous example, if the initial conditions are given at $t_0\neq 0$, we need to make a change of variables before applying $\mathcal{L}$, as follows:

\begin{enumerate}
    \item[1.] Define $y(t)=x(t+t_0),$ so that $y(0)=x(t_0).$  
    \smallskip
    \item[2.] Compute $y'(t)=x'(t+t_0),\quad y''(t)=x''(t+t_0),\dots$
    \smallskip
    \item[3.] Find the initial conditions for $y$: $y(0)=x(t_0),\quad y'(0)=x'(t_0),\dots$
    \smallskip
    \item[4.] Evaluate the DE at $t+t_0$, i.e., replace $t$ by $t+t_0$ in the DE, including in $x(t)$, $x'(t)$, \dots
    \smallskip
    \item[5.] Replace $x(t+t_0)$, $x'(t+t_0)$, \dots by $y(t)$, $y'(t)$, \dots in the DE.
    \smallskip
    \item[6.] Use the Laplace transform to find $y(t)$.
    \smallskip
    \item[7.] Find $x(t)$ by $x(t)=y(t-t_0).$
\end{enumerate}

\begin{remark}
It is recommended that students understand the above steps rather than memorize them.
\end{remark}

\section{Laplace transform of discontinuous and periodic functions}

The Laplace transform will allow us to solve DE with discontinuous terms. This is important to model, for instance, an electric circuit with an ``on-off'' switch.

\begin{figure}[H]
\centering
\begin{tikzpicture}[scale=1]
\draw[->] (-1,0) -- (4,0) node[right] {$t$};
\draw[->] (0,-1) -- (0,2) node[above] {current};

\draw[thick] (-1,0) -- (1,0);
\draw[dashed] (1,0) -- (1,1);
\draw[thick] (1,1) -- (4,1);
\node at (1,-0.3) {$t_0$};
\end{tikzpicture}
\caption{"On-off Model}
\end{figure}



We will use the following three important discontinuous functions:

\subsection{Step function}

\[
u(t)=
\begin{cases}
0, & t<0,\\
1, & t>0.
\end{cases}
\]

\begin{figure}[H]
\centering
\begin{tikzpicture}[scale=1]
\draw[->] (-2,0) -- (3,0) node[right] {$t$};
\draw[->] (0,-1) -- (0,2);

\draw[thick] (-2,0) -- (0,0);
\draw[thick] (0,1) -- (3,1);

\fill (0,1) circle (2pt);
\draw (0,0) circle (2pt);

\node at (-0.2,1) {$1$};
\end{tikzpicture}
\caption{Step function}
\end{figure}


\subsection{Shifted step function}

\[
u_a(t)=u(t-a)=
\begin{cases}
0, & t<a,\\
1, & t>a.
\end{cases}
\]

\begin{figure}[h]
\centering
\begin{tikzpicture}[scale=1]
\draw[->] (-2,0) -- (4,0) node[right] {$t$};
\draw[->] (0,-1) -- (0,2);

\draw[thick] (-2,0) -- (1,0);
\draw[dashed] (1,0) -- (1,1);
\draw[thick] (1,1) -- (4,1);

\draw (1,0) circle (2pt);
\fill (1,1) circle (2pt);

\node at (1,-0.3) {$a$};
\node at (-0.2,1) {$1$};
\end{tikzpicture}
\caption{Shifted step function}
\end{figure}


\subsection{Rectangular window function}

\[
\Pi_{a,b}(t)=u(t-a)-u(t-b)=
\begin{cases}
0, & t<a,\\
1, & a<t<b,\\
0, & t>b.
\end{cases}
\]

\begin{figure}[H]
\centering
\begin{tikzpicture}[scale=1]
\draw[->] (-2,0) -- (5,0) node[right] {$t$};
\draw[->] (0,-0.5) -- (0,2);

\draw[thick] (-2,0) -- (1,0);
\draw[dashed] (1,0) -- (1,1);
\draw[thick] (1,1) -- (3,1);
\draw[dashed] (3,1) -- (3,0);
\draw[thick] (3,0) -- (5,0);

\draw (1,0) circle (2pt);
\fill (1,1) circle (2pt);
\fill (3,0) circle (2pt);
\draw (3,1) circle (2pt);

\node at (1,-0.3) {$a$};
\node at (3,-0.3) {$b$};
\node at (-0.2,1) {$1$};
\end{tikzpicture}
\caption{Rectangular window function}
\end{figure}

Using these functions we can write a given discontinuous function with a simple equation.

\begin{example}
The function
\[
g(t)=
\begin{cases}
\frac{1}{2}, & 0<t<2,\\
t+1, & t>2,
\end{cases}
\]
can be written as
\[
g(t)=\frac{1}{2}\,\Pi_{0,2}(t)+(t+1)u(t-2).
\]
\end{example}

\begin{figure}[h]
\centering
\begin{tikzpicture}[scale=1]
\draw[->] (-1,0) -- (5,0) node[right] {$t$};
\draw[->] (0,-0.5) -- (0,4);

\draw[thick] (-1,0.5) -- (2,0.5);
\draw[dashed] (2,0.5) -- (2,3);
\draw[thick] (2,3) -- (4,4);

\draw (2,0.5) circle (2pt);
\fill (2,3) circle (2pt);

\node at (-0.3,0.5) {$\frac{1}{2}$};
\node at (2,-0.3) {$2$};
\node at (-0.3,3) {$3$};
\end{tikzpicture}
\caption{Composite step functions}
\end{figure}

\subsection{Laplace Transform of Discontinuous Functions}

For the function $u(t-a)$ defined above,
\[
\mathcal{L}\{u(t-a)\}(s) = \frac{e^{-as}}{s}, \quad s > 0,\; a \geq 0.
\]
If $F(s) = \mathcal{L}\{f\}(s)$ exists for $s > a \geq 0$, then
\[
\mathcal{L}\{f(t-a)u(t-a)\} = e^{-as}F(s),
\]
and
\[
\mathcal{L}^{-1}\{e^{-as}F(s)\} = f(t-a)u(t-a).
\]

\begin{remark}
From the Laplace transform of $u(t-a)$, we find
\[
\mathcal{L}\{\Pi_{a,b}(t)\}
= \mathcal{L}\{u(t-a)\} - \mathcal{L}\{u(t-b)\}
= \frac{e^{-as} - e^{-bs}}{s}.
\]   
\end{remark}


\begin{example}
Find the Laplace transform of
\[
g(t) =
\begin{cases}
\frac{1}{2}, & 0 < t < 2, \\
t+1, & t > 2.
\end{cases}
\]
First, we write $g(t)$ as (see example above)
\[
g(t) = \frac{1}{2}\,\Pi_{0,2}(t) + (t+1)u(t-2).
\]
Taking Laplace transforms,
\[
\mathcal{L}\{g(t)\}
= \frac{1}{2}\mathcal{L}\{\Pi_{0,2}(t)\}
+ \mathcal{L}\{(t+1)u(t-2)\}.
\]
For the first term,
\[
\mathcal{L}\{\Pi_{0,2}(t)\}
= \frac{1 - e^{-2s}}{s}.
\]
For the second term, we use the shifting property
\[
\mathcal{L}\{f(t-a)u(t-a)\} = e^{-as}F(s),
\]
with $a=2$. But for this, the function multiplying $u(t-a)$ (i.e., $t+1$ in our case) has to be a function of $t-2$. So we write
\[
t+1 = (t-2) + 3
\]
and consider the function
\[
f(t) = t + 3 \quad \Rightarrow \quad f(t-2) = t+1.
\]
Hence $(t+1) u(t-2) = f(t-2)u(t-2)$ and we find
\[
\mathcal{L}\{(t+1)u(t-2)\}
= \mathcal{L}\{f(t-2)u(t-2)\}
= e^{-2s}F(s),
\]
where $F(s)$ is the \textbf{Laplace transform of $f(t)$} (and not the laplace transform of $t+1$). We find
\[
\mathcal{L}\{f(t)\}
= \mathcal{L}\{t+3\}
=  \mathcal{L}\{t\} +  3 \mathcal{L}\{1\} = \frac{1}{s^2} + \frac{3}{s}.
\]
Thus,
\[
\mathcal{L}\{(t+1)u(t-2)\}
= e^{-2s}\left(\frac{1}{s^2} + \frac{3}{s}\right).
\]
Combining the above calculations,
\[
\mathcal{L}\{g(t)\}
= \frac{1}{2}\cdot \frac{1 - e^{-2s}}{s}
+ e^{-2s}\left(\frac{1}{s^2} + \frac{3}{s}\right).
\]   
\end{example}

\subsection{General Procedure} The above example illustrates a general procedure to compute $\mathcal{L}\{z(t)u(t-a)\}$, namely:

\begin{enumerate}
    \item[1.] Write
    \[
    z(t)u(t-a) = z(t-a+a)u(t-a).
    \]

    \item[2.] Define
    \[
    f(t) = z(t+a),
    \;\; \text{so that} \;\;
    f(t-a) = z((t-a)+a) = z(t-a+a)= z(t).
    \]

    \item[3.] Compute
    \[
    \mathcal{L}\{z(t)u(t-a)\}
    = \mathcal{L}\{f(t-a)u(t-a)\}
    = e^{-as}F(s),
    \]
    where $F(s)$ is the Laplace transform of $f(t)$ (and not of $z(t)).$
\end{enumerate}

\begin{remark}
It is recommended that students understand these steps rather than memorize them.
\end{remark}

\subsection{Laplace Transform of Periodic Functions}

\begin{definition}
A function $f(t)$ is called \textbf{periodic} if there exists a $T>0$ such that
\[
f(t+T) = f(t)
\]
for all $t$ in the domain of $f$. The smallest such $T$ is called the \textbf{period} of $f$.
\end{definition}

\begin{remark}
Informally, a function is periodic if it “repeats itself.”
\end{remark}

\begin{example}
$\cos(t)$ is periodic since
\[
\cos(t + 2\pi) = \cos(t), \quad \cos(t + 4\pi) = \cos(t), \dots
\]
The period is $2\pi$ because it is the smallest value with this property.
\end{example}

\begin{example}
The function below has period $2$.
\end{example}

\begin{figure}[htbp]
\centering
\begin{tikzpicture}[scale=0.9]

% axes
\draw[->] (-4,0) -- (4,0) node[right] {$t$};
\draw[->] (0,-2) -- (0,2);

% ticks
\foreach \x in {-3,-2,-1,1,2,3}
    \draw (\x,0.1) -- (\x,-0.1) node[below] {\x};

% repeating segments
\foreach \k in {-1,0,1} {
    \draw[blue, thick] (2*\k-1, -1.5) -- (2*\k+1, 1.5);
    \draw[blue, fill=white] (2*\k-1, -1.5) circle (2pt);
    \draw[blue, fill=white] (2*\k+1, 1.5) circle (2pt);
}

\foreach \k in {-3,-1,1,3} {
    \draw[blue, fill=blue] (\k,0) circle (2pt);
}

\draw[blue, thick] (-3, 1.5) -- (-4, 0);
\draw[blue, fill=white] (-3, 1.5) circle (2pt);

\draw[blue, thick] (4, 0) -- (3, -1.5);
\draw[blue, fill=white] (3, -1.5) circle (2pt);

\end{tikzpicture}
\caption{A periodic function with period $2$.}
\end{figure}

\begin{remark}
A periodic function need not be continuous, as the previous example shows.
\end{remark}

\begin{remark}
To specify a periodic function, it suffices to define it over a single period. I.e., one period of the function contains all its information.
\end{remark}

\begin{example}
Graph the function
\[
f(t) =
\begin{cases}
-3, & 0 < t < 2, \\
3, & -2 < t < 0,
\end{cases}
\]
where $f(t)$ has period $4$.
\end{example}

\begin{figure}[H]
\centering
\begin{tikzpicture}[scale=0.8]

% axes
\draw[->] (-7,0) -- (7,0) node[right] {$t$};
\draw[->] (0,-4) -- (0,4);

% ticks
\foreach \x in {-6,-4,-2,2,4,6}
    \draw (\x,0.1) -- (\x,-0.1) node[below] {\x};

\draw (0,3) -- (-0.3,3) node[left] {3};
\draw (0,-3) -- (0.3,-3) node[right] {-3};


% top segments (y=3)
\foreach \k in {-1,0,1} {
    \draw[blue, thick] (4*\k,-3) -- (4*\k+2,-3);
    \draw[blue, fill=white] (4*\k,-3) circle (2pt);
    \draw[blue, fill=white] (4*\k+2,-3) circle (2pt);
}

% bottom segments (y=-3)
\foreach \k in {-1,0,1} {
    \draw[blue, thick] (4*\k-2,3) -- (4*\k,3);
    \draw[blue, fill=white] (4*\k-2,3) circle (2pt);
    \draw[blue, fill=white] (4*\k,3) circle (2pt);
}

\end{tikzpicture}
\caption{A periodic function with period $4$, defined piecewise over one period.}
\end{figure}

\begin{remark}
Note that a periodic function need not be defined for all $t$. E.g., the function above is not defined for even $t$.

Because all information of a periodic function is contained in one period, it is convenient to  introduce a function that is not zero only over the corresponding period, as well as its Laplace transform. Thus, if $f(t)$ has period $T$, we define
\[
f_T(t) = f(t)\,\Pi_{0,T}(t) =
\begin{cases}
f(t), & 0 < t < T, \\
0, & \text{otherwise}.
\end{cases}
\]
\end{remark}

\noindent The Laplace transform of $f_T(t)$ is
\[
F_T(s) = \int_0^\infty e^{-st} f_T(t)\,dt = \int_0^T e^{-st} f(t)\,dt.
\]
\subsection{Relation between $F(s)$ and $F_T(s)$}
We have the following:
\[
F(s) = \frac{F_T(s)}{1 - e^{-sT}}.
\]

\begin{example}
Find $F_T(s)$ for $f(t) = \cos(t)$.\\\\
In this case $T = 2\pi$ and $F(s) = \mathcal{L}\{\cos(t)\}(s) = \frac{s}{s^2 + 1}$. Then
\[
F_{2\pi}(s) = (1 - e^{-2\pi s}) \frac{s}{s^2 + 1}.
\]
\end{example}

\section{Other tools for computing the Laplace transform}

For functions that admit a Taylor expansion, we can use the linearity of $\mathcal{L}$ and the formula
\[
\mathcal{L}\{t^n\}(s) = \frac{n!}{s^{n+1}}
\]
to compute the Laplace transform.

\begin{example}
Find $\mathcal{L}\{f\}$ for
\[
f(t) =
\begin{cases}
\dfrac{\sin(t)}{t}, & t > 0, \\
1, & t = 0.
\end{cases}
\]
Because $\lim_{t \to 0} \frac{\sin(t)}{t} = 1$, we have that $f(t)$ is continuous on $[0,\infty)$. Moreover, $f(t)$ is of exponential order. Thus, $\mathcal{L}\{f\}$ is well defined.\\\\
Using the Taylor series for $\sin(t)$:
\[
\frac{\sin(t)}{t}
= \frac{1}{t}\left(t - \frac{t^3}{3!} + \frac{t^5}{5!} - \cdots \right)
= 1 - \frac{t^2}{3!} + \frac{t^4}{5!} - \cdots, \quad t > 0.
\]
Since $f(0) = 1$ and
\[
\lim_{t \to 0} \left(1 - \frac{t^2}{3!} + \frac{t^4}{5!} - \cdots \right) = 1,
\]
the expansion also represents $f(t)$ for $t = 0$. Then,
\[
\mathcal{L}\{f(t)\}
= \mathcal{L}\left\{1 - \frac{t^2}{3!} + \frac{t^4}{5!} - \cdots \right\}
\]
\[
= \mathcal{L}\{1\} - \frac{1}{3!}\mathcal{L}\{t^2\} + \frac{1}{5!}\mathcal{L}\{t^4\} - \cdots
\]
\[
= \frac{1}{s} - \frac{2!}{3!}\frac{1}{s^3} + \frac{4!}{5!}\frac{1}{s^5} - \cdots
\]
\[
= \frac{1}{s} - \frac{1}{3s^3} + \frac{1}{5s^5} - \cdots
\]
\[
= \arctan\left(\frac{1}{s}\right),
\]
where in the last step we used $\arctan(x) = x - \frac{1}{3}x^3 + \frac{1}{5}x^5 - \cdots$ with $x = \frac{1}{s}$.
\end{example}
An important function whose Laplace transform we have not yet studied is the power function $t^r$. When $r = n$ is a nonnegative integer, we have seen that
\[
\mathcal{L}\{t^n\} = \frac{n!}{s^{n+1}}.
\]
To compute $\mathcal{L}\{t^r\}$ we need a generalization of the factorial for non-integer numbers.

\begin{definition}
The gamma function $\Gamma(r)$ is defined by
\[
\Gamma(r) = \int_0^\infty e^{-t} t^{r-1}\,dt, \quad r > 0.
\]
\end{definition}

It can be showed that the above integral converges for $r > 0$.\\\\
To evaluate $\Gamma(r)$ for a given value of $r$, we have to perform the above integral. Some values of $\Gamma(r)$ are:
\[
\Gamma(1) = 1, \quad \Gamma\left(\tfrac{3}{2}\right) = \frac{\sqrt{\pi}}{2}, \quad \Gamma(2) = 1,
\]
\[
\Gamma\left(\tfrac{5}{2}\right) = \frac{3\sqrt{\pi}}{4}, \quad \Gamma(3) = 2, \quad \Gamma(4) = 6.
\]
Two important properties of $\Gamma(r)$ are:
\begin{itemize}
    \item[1.] $\Gamma(r+1) = r\Gamma(r)$

    \item[2.] $\Gamma(n+1) = n!$, \quad where $n$ is a non-negative integer.
\end{itemize}

\noindent We can now state the Laplace transform of $t^r$:
\[
\mathcal{L}\{t^r\}(s) = \frac{\Gamma(r+1)}{s^{r+1}}, \quad r > -1.
\]
Note that when $r = n$, we obtain
\[
\mathcal{L}\{t^n\} = \frac{\Gamma(n+1)}{s^{n+1}} = \frac{n!}{s^{n+1}},
\]
agreeing with the previous formula for the Laplace transform of $t^n$.

\begin{example}
Find $\mathcal{L}\{t^{5/2} e^{3t}\}$.\\\\
By properties of the Laplace transform:
\[
\mathcal{L}\{t^{5/2} e^{3t}\} = \mathcal{L}\{t^{5/2}\}(s-3).
\]
But
\[
\mathcal{L}\{t^{5/2}\} = \frac{\Gamma\left(\frac{5}{2}+1\right)}{s^{7/2}}.
\]
Using properties of $\Gamma(r)$, we find
\[
\Gamma\left(\frac{5}{2}+1\right)
= \frac{5}{2}\Gamma\left(\frac{5}{2}\right)
= \frac{5}{2} \cdot \frac{3\sqrt{\pi}}{4}
= \frac{15\sqrt{\pi}}{8},
\]
where we used the given value of $\Gamma\left(\frac{5}{2}\right)$ above. Thus
\[
\mathcal{L}\{t^{5/2} e^{3t}\}
= \frac{15\sqrt{\pi}}{8} \cdot \frac{1}{(s-3)^{7/2}}.
\]
\end{example}


\section{Convolution}

Suppose $\mathcal{L}\{f\}(s) = F(s)$ and $\mathcal{L}\{g\}(s) = G(s)$. How do we find $\mathcal{L}^{-1}\{F(s)G(s)\}$? The first thing to point out is that
\[
\mathcal{L}^{-1}\{F(s)G(s)\} \ne \mathcal{L}^{-1}\{F(s)\}\mathcal{L}^{-1}\{G(s)\}.
\]
In order to answer the question, we need the following.

\begin{definition}
Let $f$ and $g$ be continuous on $[0,\infty)$. The \textbf{convolution} of $f$ and $g$, denoted $f * g$, is defined by
\[
(f * g)(t) = \int_0^t f(t - v)g(v)\,dv.
\]
\end{definition}

\begin{example}
Find the convolution of $t$ and $t^2$.
\end{example}

\[
t * t^2 = \int_0^t (t - v)v^2\,dv
= \int_0^t (tv^2 - v^3)\,dv
\]
\[
= \frac{tv^3}{3}\Big|_0^t - \frac{v^4}{4}\Big|_0^t
= \frac{t^4}{3} - \frac{t^4}{4}
= \frac{t^4}{12}.
\]

\subsection{Properties of the convolution}

\begin{itemize}
\item[(a)] $f * g = g * f$
\item[(b)] $f * (g + h) = f * g + f * h$
\item[(c)] $(f * g) * h = f * (g * h)$
\item[(d)] $f * 0 = 0$
\end{itemize}

We can now answer what $\mathcal{L}^{-1}\{F(s)G(s)\}$ is.

\begin{theorem}[Convolution theorem]
Let $f$ and $g$ be piecewise continuous and of exponential order. Set $F(s) = \mathcal{L}\{f\}(s)$, $G(s) = \mathcal{L}\{g\}(s)$. Then

(a) $\mathcal{L}\{f * g\}(s) = F(s)G(s)$

(b) $\mathcal{L}^{-1}\{F(s)G(s)\}(t) = (f * g)(t)$.
\end{theorem}

\begin{example}
Use convolution to find $\mathcal{L}^{-1}\left\{\frac{1}{(s^2+1)^2}\right\}$.\\\\
Since $\mathcal{L}^{-1}\left\{\frac{1}{s^2+1}\right\} = \sin t$, we have that
\[
\mathcal{L}^{-1}\left\{\frac{1}{(s^2+1)^2}\right\}
= \mathcal{L}^{-1}\left\{\frac{1}{s^2+1} \cdot \frac{1}{s^2+1}\right\}
= \sin t * \sin t.
\]
Now we compute
\[
\sin t * \sin t = \int_0^t \sin(t - v)\sin(v)\,dv.
\]
Recalling that $\cos(A\pm B) = \cos A \cos B \mp \sin A \sin B$, so that
\[
\sin A \sin B = \frac{\cos(B-A) - \cos(A+B)}{2},
\]
we find, with $A = t - v$, $B = v$:
\begin{align*}
\sin t * \sin t &= \frac{1}{2} \int_0^t \left(\cos(2v - t) - \cos t \right)\,dv\\
&= \frac{1}{2} \left[\frac{\sin(2v - t)}{2}\right]_0^t - \frac{1}{2}v\cos t \Big|_0^t\\
&= \frac{\sin t - t\cos t}{2}.
\end{align*}
\end{example}

 % page 142
We will now see a very useful application of convolutions.\\\\\
Consider the IVP:
\[
a x'' + b x' + cx = f(t),
\]
\[
x(0) = X_0, \quad x'(0) = X_1,
\]
where $a,b,c$ are constants, $a \ne 0$, $X_0, X_1$ are given numbers and $f(t)$ is a given function. To solve this IVP, we begin noticing that by the superposition principle, we can write
\[
x = y + z,
\]
where $y$ and $z$ are solutions to, respectively,
\[
a y'' + b y' + cy = f(t), \quad y(0) = 0, \quad y'(0) = 0
\]

\[
a z'' + b z' + cz = 0, \quad z(0) = X_0, \quad z'(0) = X_1.
\]
We have already learned that $z(t)$ can be found using the characteristic equation, so let us focus on $y(t)$. Taking the Laplace transform, we find
\[
a \mathcal{L}\{y''\} + b \mathcal{L}\{y'\} + c \mathcal{L}\{y\} = \mathcal{L}\{f\}
\]

\[
a (s^2 Y(s) - s \underbrace{y(0)}_{=0} - \underbrace{y'(0)}_{=0}) + b (s Y(s) - \underbrace{y(0)}_{=0}) + c Y(s) = F(s)
\]

\[
a (s^2 Y(s)) + b (s Y(s)) + c Y(s) = F(s)
\]
so
\[
(as^2 + bs + c)Y(s) = F(s),
\]
or
\[
Y(s) = \frac{F(s)}{as^2 + bs + c}.
\]
Consider
\[
H(s) = \frac{1}{as^2 + bs + c}.
\]
Its inverse Laplace transform, denoted $h(t)$, is called the \textbf{impulse response function} of DE, i.e.,
\[
h(t) = \mathcal{L}^{-1}\{H(s)\} = \mathcal{L}^{-1}\left\{\frac{1}{as^2 + bs + c}\right\}.
\]
Since $\mathcal{L}^{-1}\{F(s)\} = f(t)$, we have
\[
y(t) = \mathcal{L}^{-1}\left\{\frac{F(s)}{as^2 + bs + c}\right\}
= \mathcal{L}^{-1}\{H(s)F(s)\}
= h(t) * f(t).
\]
Therefore the solution $x(t)$ is given by
\[
x(t) = h(t) * f(t) + z(t)
= \int_0^t h(t - \sigma) f(\sigma)\,d\sigma + z(t).
\]
This formula is useful because $z(t)$ is easy to find, while, for a given DE, $h(t)$ needs to be \textit{computed only once}. In other words, $h(t)$ does not involve $f(t)$; it only depends on $a,b,$ and $c$ by the simple formula
\[
h(t) = \mathcal{L}^{-1}\left\{\frac{1}{as^2 + bs + c}\right\}.
\]
Then, if we want to solve the same DE but with different $f(t)$ terms, all we need to do is to plug $f(t)$ into the above formula. Moreover, changing the initial conditions will only affect $z(t)$, which, as said, is not difficult to find.

As another application of convolutions, let us show how they can be used to solve equations that are more general than DE.

\begin{example}
Find $y(t)$ such that
\[
y'(t) = 1 - \int_0^t y(t - v)e^{-2v}\,dv, \quad y(0) = 1.
\]
An equation of this type is known as an integro-differential equation. To solve it, write it as
\[
y'(t) = 1 - y(t) * e^{-2t},
\]
and apply $\mathcal{L}$:
\[
\mathcal{L}\{y'(t)\} = \mathcal{L}\{1\} - \mathcal{L}\{y(t) * e^{-2t}\}
\]

\[
sY(s) - \underbrace{y(0)}_{=1} = \frac{1}{s} - Y(s)\frac{1}{s+2},
\]
where we used $\mathcal{L}\{f * g\} = F(s)G(s)$ and $\mathcal{L}\{e^{-2t}\} = \frac{1}{s+2}$. Thus
\[
\left(s + \frac{1}{s+2}\right)Y(s) = \frac{1}{s} + 1,
\]
which gives
\[
\frac{s^2 + 2s + 1}{s+2} Y(s) = \frac{s+1}{s},
\]
or yet
\[
Y(s) = \frac{(s+2)(s+1)}{s(s^2+2s+1)}
= \frac{(s+2)(s+1)}{s(s+1)^2}
= \frac{s+2}{s(s+1)}
= \frac{2}{s} - \frac{1}{s+1},
\]
where we used partial fractions in the last step. Then
\[
y(t) = \mathcal{L}^{-1}\{Y(s)\}
= \mathcal{L}^{-1}\left\{\frac{2}{s}\right\}
- \mathcal{L}^{-1}\left\{\frac{1}{s+1}\right\}
\]

\[
= 2 - e^{-t}.
\]
\end{example}

Let us now prove the formula $\mathcal{L}\{f * g\} = F(s)G(s)$ (the other convolution formula, $\mathcal{L}^{-1}\{F(s)G(s)\} = f * g$, follows from this one). Write:

\[
f * g(t) = \int_0^t f(t - v)g(v)\,dv, \quad \text{ so}
\]
Because this integral is only between $0$ and $t$, we can write it as
\[
\int_0^t f(t-v)g(v)\,dv
= \int_0^t f(t-v)g(v)\,dv + \int_t^\infty 0 \cdot f(t-v)g(v)\,dv
\]

\[
= \int_0^t 1 \cdot f(t-v)g(v)\,dv + \int_t^\infty 0 \cdot f(t-v)g(v)\,dv.
\]
Since $u(t-v) = 1$ for $t > v$, we can replace $1$ by $u(t-v)$ in the first integral (because $0 < v < t$ in the first integral). Similarly, since $u(t-v) = 0$ for $t < v$, we can replace $0$ by $u(t-v)$ in the second integral (because $v > t$ in the second integral). Thus,
\[
\int_0^t f(t-v)g(v)\,dv
= \int_0^t u(t-v)f(t-v)g(v)\,dv
+ \int_t^\infty u(t-v)f(t-v)g(v)\,dv
\]

\[
= \int_0^\infty u(t-v)f(t-v)g(v)\,dv.
\]
Next, we compute:
\[
\mathcal{L}\{f * g(t)\}
= \int_0^\infty e^{-st}(f * g)(t)\,dt
= \int_0^\infty e^{-st} \left( \int_0^t f(t-v)g(v)\,dv \right) dt.
\]
Using the above expression for $\int_0^t f(t-v)g(v)\,dv$:
\[
\mathcal{L}\{f * g(t)\}
= \int_0^\infty e^{-st} \left( \int_0^\infty u(t-v)f(t-v)g(v)\,dv \right) dt
\]

\[
= \int_0^\infty \int_0^\infty e^{-st} u(t-v)f(t-v)g(v)\,dv\,dt.
\]
Now we change the order of integration:
\[
= \int_0^\infty \int_0^\infty e^{-st} u(t-v)f(t-v)g(v)\,dt\,dv
\]

\[
= \int_0^\infty \left( \int_0^\infty e^{-st} u(t-v)f(t-v)g(v)\,dt \right)\,dv.
\]
Since the second integral is in $t$ and $g(v)$ does not depend on $t$, we can move it outside:
\[
= \int_0^\infty g(v) \left( \int_0^\infty e^{-st} u(t-v)f(t-v)\,dt \right) dv.
\]

\[
= \int_0^\infty g(v)\, e^{-sv} F(s)\, dv
\]

\[
= F(s) \int_0^\infty e^{-sv} g(v)\,dv
\]

\[
= F(s)G(s).
\]

\section{The Delta Function}

In many situations, it is important to describe a situation where a function is very large over a small period of time or length of space.

\begin{figure}[H]
\centering
\begin{tikzpicture}[scale=1]
\draw[->] (-1,0) -- (3,0) node[right] {$t$};
\draw[->] (0,-0.2) -- (0,3);

\draw[blue, thick, domain=-0.5:2.5, smooth, samples=200]
plot (\x,{3*exp(-400*(\x-1)^2)});

\draw (1,0) node[below] {$t_0$};
\end{tikzpicture}
\caption{Delta function around $t_0$.}
\end{figure}

With this goal in mind, consider the functions $f_a$ that depend on the parameter $a$:

\[
f_a(t) =
\begin{cases}
\frac{1}{a}, & -\frac{a}{2} < t < \frac{a}{2}, \\
0, & \text{otherwise}.
\end{cases}
\]

\begin{figure}[H]
\centering
\begin{tikzpicture}[scale=1]
\draw[->] (-3,0) -- (3,0) node[right] {$t$};
\draw[->] (0,-0.2) -- (0,2);

\draw[blue, thick] (-1,0) -- (-1,1);
\draw[blue, thick] (-1,1) -- (1,1);
\draw[blue, thick] (1,1) -- (1,0);

\draw (-1,0) node[below] {$-\frac{a}{2}$};
\draw (1,0) node[below] {$\frac{a}{2}$};
\draw (0,1) node[right] {$\frac{1}{a}$};
\end{tikzpicture}
\caption{The function $f_a(t)$ with height $\frac{1}{a}$ and width $a$.}
\end{figure}

Note that
\[
\int_{-\infty}^{+\infty} f_a(t)\,dt = 1
\]
for any value of $a$. If we consider
\[
\lim_{a \to 0^+} f_a(t),
\]
we find
\[
\lim_{a \to 0^+} f_a(t) =
\begin{cases}
\infty, & t = 0, \\
0, & t \ne 0.
\end{cases}
\]
We see that the limit $\lim_{a \to 0^+} f_a$ is not, strictly speaking, a function. But if we insist in treating it as a function, we could write
\[
\lim_{a \to 0^+} f_a(t) = \delta(t),
\]
where
\[
\delta(t) =
\begin{cases}
\infty, & t = 0, \\
0, & \text{otherwise}
\end{cases}
\quad \text{and} \quad
\int_{-\infty}^{+\infty} \delta(t)\,dt = 1.
\]

It can be showed that no function can satisfy both criteria (e.g., it can be showed that if a function $f(t)$ is such that $f(t) = 0$ for all $t \ne 0$, then necessarily $\int_{-\infty}^{+\infty} f(t)\,dt = 0$, regardless of the value of $f(0)$). But it is still useful to treat $\delta(t)$ satisfying the above properties as a function. We think of $\delta(t)$ as representing some sort of limiting process (e.g., $a \to 0^+$ as above), although the limit object itself (i.e., $\delta(t)$) is \textit{not} a function.

\begin{remark}
The object $\delta(t)$ is something more general than a function, called a \textbf{distribution}. We do not have in this course all background necessary to precisely define distributions, and for the remainder of the course we will continue to refer to $\delta(t)$ and manipulate it as a function.
\end{remark}

The reason why we do not need to worry too much about $\delta(t)$ not being a function is that in practice it will always appear in expressions such as
\[
\int_{-\infty}^{+\infty} f(t)\delta(t)\,dt,
\]
where $f(t)$ is continuous. Such integrals are well defined, as we now illustrate:
\[
\int_{-\infty}^{+\infty} f(t)\delta(t)\,dt
= \lim_{a \to 0^+} \int_{-\infty}^{+\infty} f(t) f_a(t)\,dt
= \frac{1}{a} \int_{-a/2}^{a/2} f(t)\,dt.
\]
Because $f(t)$ is continuous, it has a maximum value for some $t_M \in \left[-\frac{a}{2}, \frac{a}{2}\right]$ and some minimum value for some $t_m \in \left[-\frac{a}{2}, \frac{a}{2}\right]$ (this would not be true if $f(t)$ were not continuous; take, e.g., the function $1/t$).

\begin{figure}[H]
\centering
\begin{tikzpicture}[scale=1]
\draw[->] (-2,0) -- (2,0) node[right] {$t$};
\draw[->] (0,-2) -- (0,2);

\draw[blue, thick, domain=-1.5:1.75, smooth] plot (\x-0.5,{-0.8*sin(2*\x r)});

\draw[dashed] (-1.25,0) -- (-1.25,0.8);
\draw[dashed] (0.25,0) -- (0.25,-0.8);

\draw (-2,0) node[below] {$-\frac{a}{2}$};
\draw (1.25,0) node[below] {$\frac{a}{2}$};

\draw (-0.7,-0.25) node[left] {$t_\mu$};
\draw (0.15,0.25) node[right] {$t_m$};
\end{tikzpicture}
\caption{$f(t)$ continuous on $\left[-\frac{a}{2}, \frac{a}{2}\right]$ showing maximum and minimum values.}
\end{figure}

\noindent Thus
\[
f(t_m) \le f(t) \le f(t_\mu)
\]
for all $t \in \left[-\frac{a}{2}, \frac{a}{2}\right]$. Therefore
\[
\frac{1}{a} \int_{-a/2}^{a/2} f(t)\,dt
\le \frac{1}{a} \int_{-a/2}^{a/2} f(t_\mu)\,dt = \frac{f(t_\mu)}{a} \int_{-a/2}^{a/2}\,dt
= f(t_\mu),
\]

\[
\frac{1}{a} \int_{-a/2}^{a/2} f(t)\,dt
\ge \frac{1}{a} \int_{-a/2}^{a/2} f(t_m)\,dt = \frac{f(t_m)}{a} \int_{-a/2}^{a/2} \,dt
= f(t_m).
\]
Hence,
\[
f(t_m) \le \frac{1}{a} \int_{-a/2}^{a/2} f(t)\,dt \le f(t_\mu).
\]
Because $t_m, t_\mu \in \left[-\frac{a}{2}, \frac{a}{2}\right]$, when $a \to 0^+$ we must have $t_m \to 0$ and $t_\mu \to 0$. Since $f$ is continuous, we then have $f(t_m) \to f(0)$ and $f(t_\mu) \to f(0)$. Therefore, by the squeeze theorem we have:
\[
\lim_{a \to 0^+} \frac{1}{a} \int_{-a/2}^{a/2} f(t)\,dt = f(0).
\]
We conclude that
\[
\lim_{a \to 0^+} \int_{-\infty}^{+\infty} f(t)\delta(t)\,dt = f(0)
\]
for any continuous function $f$. This motivates the following.

\begin{definition}
The delta function $\delta(t)$ (also Dirac delta function) is characterized by the properties
\[
\delta(t) =
\begin{cases}
\infty, & t = 0, \\
0, & t \ne 0
\end{cases}
\quad \text{and} \quad
\int_{-\infty}^{+\infty} f(t)\delta(t)\,dt = f(0)
\]
for any function $f(t)$ that is continuous on an open interval containing $t=0$.
\end{definition}

\begin{remark}
Again, we stress that $\delta(t)$ is not a function strictly speaking.
\end{remark}

Shifting the argument of $\delta(t)$ we see that
\[
\delta(t-a) =
\begin{cases}
\infty, & t = a, \\
0, & t \ne a
\end{cases}
\quad \text{and} \quad
\int_{-\infty}^{+\infty} f(t)\delta(t-a)\,dt = f(a).
\]
The delta function provides a model for the type of functions we mentioned earlier, i.e., very large over a small time interval. For instance, suppose we have a DE modeling a mechanical system with an external force $F(t)$:
\[
a x'' + b x' + c x = F(t).
\]
Suppose that $F$ is zero except for a tiny time interval when it is very large. For example, $F$ could be the force of hitting the system with a hammer. In this case, the time over which the force acts (i.e., the hammer touches the system) is so small that in practice we can say it happens at a single time, say $t = a$. And since the force at $t=a$ is so large compared to other forces acting on the system, we can say that at $t=a$, we have $F(a) = \infty$. Thus, we can take $F(t) = \delta(t-a)$.\\\\
Since $\delta(t-a)$ is zero for $t<a$ and for $t>a$, and
\[
\int_{-\infty}^{+\infty} \delta(t-a)\,dt = 1,
\]
we conclude that
\[
\int_{-\infty}^{t} \delta(t-a)\,dt =
\begin{cases}
0, & t < a, \\
1, & t > a
\end{cases}
= u(t-a),
\]
because
\[
\int_{-\infty}^{t} \delta(t-a)\,dt
= \int_{-\infty}^{+\infty} \delta(t-a)\,dt - \int_{t}^{+\infty} \delta(t-a)\,dt
= 1 - \int_{t}^{+\infty} \delta(t-a)\,dt,
\]
and the second integral is zero for $t>a$.\\\\
The function $u(t-a)$ is not differentiable, but if we pretend it were and differentiate the above equality and invoke the fundamental theorem of calculus, we would find
\[
\frac{d}{dt} u(t-a) = \delta(t-a).
\]
Although this formula is not quite correct (since $u(t-a)$ is not differentiable and $\delta(t-a)$ is not a function), it can be made mathematically sound using the theory of distributions mentioned earlier. It is in any case interesting to interpret this formula: for $t \ne a$, $u(t-a)$ is constant so its derivative should be zero. This is exactly what the above equality says since $\delta(t-a) = 0$ for $t \ne a$. But for $t=a$, $u(t-a)$ jumps \textit{instantaneously} from zero to one, so its rate of change (i.e., its derivative) should be infinite. Again, this is what the equality says since $\delta(t-a) = \infty$ for $t=a$.\\\\
We now turn to the Laplace transform of $\delta(t-a)$. It is straightforward to compute:
\[
\mathcal{L}\{\delta(t-a)\}
= \int_0^\infty e^{-st}\delta(t-a)\,dt
= e^{-as}.
\]
We also obtain
\[
\mathcal{L}^{-1}\{e^{-as}\} = \delta(t-a).
\]
In particular, with $a=0$ we find
\[
\mathcal{L}^{-1}\{1\} = \delta(t).
\]
We can now study DE involving $\delta(t-a)$.

\begin{example}
Solve the IVP
\[
x'' + x = \delta(t-\pi),
\]
\[
x(0) = 0, \quad x'(0) = 0.
\]
Applying $\mathcal{L}$, we find
\[
s^2 X(s) - s \underbrace{x(0)}_{=0} - \underbrace{x'(0)}_{=0} + X(s)
= \mathcal{L}\{\delta(t-\pi)\}
= e^{-\pi s},
\]
Thus
\[
X(s) = \frac{e^{-\pi s}}{s^2 + 1}.
\]
Since
\[
\mathcal{L}^{-1}\left\{\frac{1}{s^2+1}\right\} = \sin t,
\quad
\mathcal{L}^{-1}\{e^{-as}F(s)\} = f(t-a)u(t-a),
\]
we find
\[
x(t) = \mathcal{L}^{-1}\{X(s)\}
= \sin(t-\pi)\,u(t-\pi).
\]
\end{example}

Recall that given a DE
\[
a x'' + b x' + c x = f(t),
\]
we defined the impulse response function by:
\[
h(t) = \mathcal{L}^{-1}\left\{\frac{1}{a s^2 + b s + c}\right\}.
\]
$h(t)$ can also be computed as a solution to the IVP
\[
a y'' + b y' + c y = \delta(t),
\]
\[
y(0) = 0, \quad y'(0) = 0.
\]
Indeed, applying $\mathcal{L}$ we find
\[
(a s^2 + b s + c)Y(s) = \mathcal{L}\{\delta(t)\} = 1,
\]
so that
\[
Y(t) = \mathcal{L}^{-1}\left\{\frac{1}{a s^2 + b s + c}\right\} = h(t).
\]

\section{Series solutions to DE}

We will now study a method that produces solutions to DEs in the form of a power series. I.e., a solution will be given in the form
\[
y(x) = \sum_{n=0}^{\infty} a_n x^n.
\]
Before discussing the method in detail, let us illustrate it with an example.

\begin{example}
Use power series to solve
\end{example}
\[
y'' + 4y = 0.
\]
(Note that we can solve this equation with the methods we learned so far; but let us use power series.)\\\\
We seek a solution in the form:
\[
y(x) = \sum_{n=0}^{\infty} a_n x^n.
\]
Then
\[
y'(x) = \sum_{n=0}^{\infty} n a_n x^{n-1}.
\]
Note that the first term in this series (corresponding to $n=0$) is zero, so we can start the sum from $n=1$:
\[
y'(x) = \sum_{n=1}^{\infty} n a_n x^{n-1}.
\]
Taking another derivative:
\[
y''(x) = \sum_{n=1}^{\infty} n(n-1)a_n x^{n-2}.
\]
Again, the first term in the sum vanishes so we can start at $n=2$. Then
\[
y''(x) = \sum_{n=2}^{\infty} n(n-1)a_n x^{n-2}.
\]
Plugging into the DE $y'' + 4y = 0$, we have
\[
\sum_{n=2}^{\infty} n(n-1)a_n x^{n-2} + 4 \sum_{n=0}^{\infty} a_n x^n = 0.
\]
The first sum is a power series in $x^{n-2}$. We want to write it as a power series in $x^n$ so that we can combine it with the first sum. For this, we make the change of variables $m = n-2$, so $n = m+2$. Then
\[
\sum_{\underbrace{n=2}_{m+2 = 2, m = 0}}^{\overbrace{\infty}^{m+2 = n \to \infty}} n(n-1)a_n x^{n-2}
=
\sum_{m=0}^{\infty} (m+2)(m+1)a_{m+2} x^m.
\]
The DE becomes:
\[
\sum_{m=0}^{\infty} (m+2)(m+1)a_{m+2} x^m
+
4 \sum_{n=0}^{\infty} a_n x^n = 0.
\]
But $m$ in the first sum is a \textit{dummy index of summation}, i.e., it only serves to label the terms in the order first term, second term, etc., and we can label it any way we want. Thus we can call it $n$:
\[
\sum_{n=0}^{\infty} (n+2)(n+1)a_{n+2} x^n
+
4 \sum_{n=0}^{\infty} a_n x^n = 0.
\]
We can now group both sums as
\[
\sum_{n=0}^{\infty} \left[(n+2)(n+1)a_{n+2} x^n + 4 a_n x^n \right] = 0,
\]
or
\[
\sum_{n=0}^{\infty} \left[(n+2)(n+1)a_{n+2} + 4a_n \right] x^n = 0.
\]
For this equality to hold, the coefficient of each $x^n$ has to vanish:
\[
(n+2)(n+1)a_{n+2} + 4a_n = 0.
\]
Thus
\[
a_{n+2} = -\frac{4a_n}{(n+2)(n+1)}.
\]
This recursively determines all coefficients $a_n$ except $a_0$ and $a_1$:
\[
n = 0:\quad a_2 = -\frac{4a_0}{2\cdot 1},
\]

\[
n = 1:\quad a_3 = -\frac{4a_1}{3\cdot 2},
\]

\[
n = 2:\quad a_4 = -\frac{4a_2}{4\cdot 3}
= -\frac{4}{4\cdot 3}\left(-\frac{4}{2\cdot 1}\right)a_0
= \frac{4^2}{4\cdot 3\cdot 2\cdot 1}a_0,
\]

\[
n = 3:\quad a_5 = -\frac{4a_3}{5\cdot 4}
= -\frac{4}{5\cdot 4}\left(-\frac{4}{3\cdot 2}\right)a_1
= \frac{4^2}{5\cdot 4\cdot 3\cdot 2}a_1,
\]

\[
n = 4:\quad a_6 = -\frac{4a_4}{6\cdot 5}
= -\frac{4}{6\cdot 5}\frac{4^2}{4\cdot 3\cdot 2\cdot 1}a_0
= -\frac{4^3}{6\cdot 5\cdot 4\cdot 3\cdot 2\cdot 1}a_0,
\]

\[
n = 5:\quad a_7 = -\frac{4a_5}{7\cdot 6}
= -\frac{4}{7\cdot 6}\frac{4^2}{5\cdot 4\cdot 3\cdot 2}a_1
= -\frac{4^3}{7\cdot 6\cdot 5\cdot 4\cdot 3\cdot 2}a_1.
\]
Continuing this way, we recognize the following patterns: for $n$ even, in which case we can write $a_n$ (with $n=2,4,6,\dots$) as $a_{2n}$ (with $n=1,2,3,\dots$), we have
\[
a_{2n} = \frac{(-1)^n 4^n}{(2n)!}a_0
= \frac{(-1)^n 2^{2n}}{(2n)!}a_0, \quad n=1,2,\dots
\]
For $n$ odd, in which case we can write $a_n$ (with $n=3,5,7,\dots$) as $a_{2n+1}$ (with $n=0,1,2,\dots$), we have
\[
a_{2n+1}
= \frac{(-1)^n 4^n}{(2n+1)!}a_1
= \frac{(-1)^n 2^{2n}}{(2n+1)!}a_1
= \frac{(-1)^n 2^{2n+1}}{(2n+1)!}\frac{a_1}{2}.
\]
The constants $a_0$ and $a_1$ are undetermined, i.e., they are arbitrary. Set $c_0 = a_0$, $c_1 = \frac{a_1}{2}$, so that $c_0$ and $c_1$ are also arbitrary constants. Then
\[
y(x) = \sum_{n=0}^{\infty} a_n x^n
= \sum_{\substack{n=0 \\ n \text{ even}}}^{\infty} a_n x^n
+ \sum_{\substack{n=0 \\ n \text{ odd}}}^{\infty} a_n x^n
\]

\[
= \sum_{n=0}^{\infty} \frac{(-1)^n 2^{2n}}{(2n)!} a_0 x^{2n}
+ \sum_{n=0}^{\infty} \frac{(-1)^n 2^{2n+1}}{(2n+1)!}\frac{a_1}{2} x^{2n+1}
\]

\[
= c_0 \sum_{n=0}^{\infty} \frac{(-1)^n (2x)^{2n}}{(2n)!}
+ c_1 \sum_{n=0}^{\infty} \frac{(-1)^n (2x)^{2n+1}}{(2n+1)!}
\]

\[
= c_0 \cos(2x) + c_1 \sin(2x).
\]

\begin{remark}
Above, we recognized the series $y(x)$ as a sum of $\sin(2x)$ and $\cos(2x)$. In particular, the series converges. But we investigate convergence directly. Let us use the ratio test. Then, for the even terms
\[
\left|
\frac{(-1)^{n+1}2^{2n+2}x^{2n+2}/(2n+2)!}{(-1)^n 2^{2n}x^{2n}/(2n)!}
\right|
=
\frac{2^2 |x|^2}{(2n+2)(2n+1)} \to 0 \quad \text{as } n \to \infty,
\]
and for the odd terms:
\[
\left|
\frac{(-1)^{n+1}2^{2n+3}x^{2n+3}/(2n+3)!}{(-1)^n 2^{2n+1}x^{2n+1}/(2n+1)!}
\right|
=
\frac{2^2 |x|^2}{(2n+3)(2n+2)} \to 0 \quad \text{as } n \to \infty,
\]
and we conclude that the series converges with a radius of convergence $R = \infty$.
\end{remark}

\subsection{Brief review of power series}

\begin{definition}
A \textbf{power series centered at $x_0$} (also a \textbf{power series about} $x_0$, or power series or simply series) where $x_0$ is a fixed number, is an expression of the form
\[
\sum_{n=0}^{\infty} a_n (x - x_0)^n,
\]
where the infinite sum is understood as the limit
\[
\lim_{N \to \infty} \sum_{n=0}^{N} a_n (x - x_0)^n
\]
(which may or may not converge). The sums
\[
\sum_{n=0}^{N} a_n (x - x_0)^n
\]
are called the \textbf{partial sums} of the series. We say that the series \textbf{converges} at $x = c$ if the limit
\[
\lim_{N \to \infty} \sum_{n=0}^{N} a_n (c - x_0)^n
\]
exists, and that the series \textbf{diverges} at $x = c$ otherwise (note that a power series always converges at $x = x_0$).\\\\
The power series is called \textbf{absolutely convergent} if
\[
\sum_{n=0}^{\infty} \left| a_n (x - x_0)^n \right|
\]
converges.
\end{definition}

\begin{theorem}
Given a power series
\[
\sum_{n=0}^{\infty} a_n (x - x_0)^n,
\]
there exists an $R \geq 0$ such that the series converges absolutely for $x$ such that $|x - x_0| < R$ and diverges for $|x - x_0| > R$. If the series converges for all $x$, we write $R = \infty$. $R$ is called the \textbf{radius of convergence} of the series.
\end{theorem}

Note that $R = 0$ if a series converges only for $x = x_0$. The theorem does not say anything about what happens when $|x - x_0| = R$.

\begin{figure}[H]
\centering
\begin{tikzpicture}[scale=1.1]
    % axis
    \draw[->] (-4.5,0) -- (4.5,0) node[right] {$x$};

    % center
    \node[below] at (0,0) {$x_0$};

    % interval
    \draw[red, very thick] (-2.5,0) -- (2.5,0);

    % endpoints
    \draw[blue, fill=white] (-2.5,0) circle (2pt);
    \draw[blue, fill=white] (2.5,0) circle (2pt);

    % labels
    \node[below, blue] at (-2.5,0) {$x_0-R$};
    \node[below, blue] at (2.5,0) {$x_0+R$};

    % text
    \node[red] at (0.2,0.45) {converges};
    \node[green!50!black] at (-3.4,0.3) {diverges};
    \node[green!50!black] at (3.4,0.3) {diverges};

    \node[blue] at (-2.5,1.4) {theorem gives};
    \node[blue] at (-2.5,1.1) {no information};

    \node[blue] at (2.5,1.4) {theorem gives};
    \node[blue] at (2.5,1.1) {no information};
\end{tikzpicture}
\caption{A power series centered at $x_0$ converges absolutely for $|x-x_0|<R$ and diverges for $|x-x_0|>R$, while the theorem gives no information at the endpoints $x=x_0\pm R$.}
\end{figure}

\begin{remark}
If a series converges absolutely, then it is convergent. I.e., if $x$ is such that
\[
\sum_{n=0}^{\infty} \left| a_n (x - x_0)^n \right|
\]
converges then
\[
\sum_{n=0}^{\infty} a_n (x - x_0)^n
\]
converges as well. The converse is not true (e.g.,
\[
\sum_{n=1}^{\infty} \frac{(-1)^n}{n} x^n
\]
converges at $x = 1$, but
\[
\sum_{n=1}^{\infty} \left| \frac{(-1)^n}{n} x^n \right|
\]
diverges).
\end{remark}

When a series converges/diverges (for certain $x$) we call it \textbf{convergent/divergent}. The largest interval about $x_0$ such that the series converges for all points on the interval is called the \textbf{interval of convergence} (also the convergence set). Thus, the interval of convergence may or may not include the endpoints where $|x - x_0| = R$.

\begin{example}
Below are some series with their $x_0$, radius and interval of convergence:
\[
\sum_{n=0}^{\infty} \frac{x^n}{n!}, \quad x_0 = 0,\ R = \infty,\ (-\infty, \infty).
\]

\[
\sum_{n=0}^{\infty} (x - 2)^n, \quad x_0 = 2,\ R = 1,\ (1,3).
\]

\begin{figure}[H]
\centering
\begin{tikzpicture}[scale=1.2]
    \draw[->] (-0.5,0) -- (4.2,0) node[right] {$x$};

    % interval
    \draw[blue, very thick] (1,0) -- (3,0);

    % endpoints
    \draw[blue, fill=white] (1,0) circle (2pt);
    \draw[blue, fill=white] (3,0) circle (2pt);

    % midpoint
    \draw (2,0.08) -- (2,-0.08);

    % labels
    \node[below] at (1,0) {$1$};
    \node[below] at (2,0) {$x_0=2$};
    \node[below] at (3,0) {$3$};

    % annotations
    \node[blue] at (2,0.55) {converges};
    \node[blue] at (1,-0.55) {diverges};
    \node[blue] at (3,-0.55) {diverges};
\end{tikzpicture}
\caption{The power series $\sum_{n=0}^{\infty}(x-2)^n$ is centered at $x_0=2$, has radius of convergence $R=1$, and interval of convergence $(1,3)$.}
\end{figure}

\[
\sum_{n=0}^{\infty} n! x^n, \quad x_0 = 0,\ R = 0,\ \{0\}.
\]
\[
\sum_{n=0}^{\infty} \frac{2^n}{n} (4x - 8)^n, \quad x_0 = 2,\ R = \frac{1}{8},\ \left[\frac{15}{8}, \frac{17}{8}\right).
\]

\begin{figure}[H]
\centering
\begin{tikzpicture}[scale=1.2]
    \draw[->] (-0.5,0) -- (4.2,0) node[right] {$x$};

    % interval
    \draw[blue, very thick] (1,0) -- (3,0);

    % endpoints
    \draw[blue, fill=blue] (1,0) circle (2pt);
    \draw[blue, fill=white] (3,0) circle (2pt);

    % midpoint
    \draw (2,0.08) -- (2,-0.08);

    % labels
    \node[below] at (1,0) {$\frac{15}{8} $};
    \node[below] at (2,0) {$x_0=2$};
    \node[below] at (3,0) {$\frac{17}{8}$};

    % annotations
    \node[blue] at (2,0.55) {converges};
    \node[blue] at (1,0.25) {converges};
    \node[blue] at (3.2,-0.75) {diverges};
\end{tikzpicture}
\caption{The power series $\sum_{n=0}^{\infty}\frac{2^n}{n}(4x-8)^n$ is centered at $x_0=2$, has radius of convergence $R=\frac{1}{8}$, and interval of convergence $\left[\frac{15}{8},\frac{17}{8}\right)$.}
\end{figure}
\end{example}

\noindent The following is a very useful criterion for determining the radius of convergence.

\subsection{Ratio test} Consider the series
\[
\sum_{n=0}^{\infty} c_n,
\]
where the $c_n$'s are real numbers. Suppose that
\[
\lim_{n \to \infty} \left| \frac{c_{n+1}}{c_n} \right| = L.
\]
Then the series converges absolutely if $L < 1$, and diverges if $L > 1$. If $L = 1$ or if the limit does not exist, then the test is inconclusive.\\\\
To apply this to power series, we use the test with
\[
c_n = a_n (x - x_0)^n.
\]

\begin{example}
Determine the radius of convergence of
\[
\sum_{n=0}^{\infty} \frac{(-3)^n}{n+2} (x - 1)^n.
\]
We put
\[
c_n = \frac{(-3)^n}{n+2}(x-1)^n
\]
and compute
\[
\lim_{n \to \infty} \left| \frac{c_{n+1}}{c_n} \right|
= \lim_{n \to \infty}
\left|
\frac{(-3)^{n+1}(x-1)^{n+1}}{n+3}
\cdot
\frac{n+2}{(-3)^n (x-1)^n}
\right|
= \lim_{n \to \infty} \frac{3(n+2)|x-1|}{n+3}
= 3|x-1|.
\]
So in this case \(L = 3|x-1|\). We want \(L < 1\), so
\[
3|x-1| < 1 \;\Rightarrow\; |x-1| < \frac{1}{3}.
\]
So the radius of convergence is \(\frac{1}{3}\), i.e., the series converges for
\[
|x-1| < \frac{1}{3}
\]
and diverges for \(x\) such that \(|x-1| > \frac{1}{3}\).\\

Information about the radius of convergence, thus in particular information derived from the ratio test as in the above example, does not tell us what happens at the endpoints, i.e., for \(x\) such that \(|x-x_0| = R\). For this we need to investigate the endpoints directly.
\end{example}

\begin{example}
Determine the interval of convergence of
\[
\sum_{n=0}^{\infty} \frac{(-3)^n (x-1)^n}{n+2}.
\]
We already know from the previous example that \(R = \frac{1}{3}\). Thus the endpoints, i.e., the points such that \(|x-1| = R\), are
\[
x = \frac{4}{3} \quad \text{and} \quad x = \frac{2}{3}.
\]
Plugging \(x = \frac{4}{3}\), we find:
\[
\sum_{n=0}^{\infty} \frac{(-3)^n \left(\frac{4}{3}-1\right)^n}{n+2}
= \sum_{n=0}^{\infty} \frac{(-3)^n \left(\frac{1}{3}\right)^n}{n+2}
= \sum_{n=0}^{\infty} \frac{(-1)^n}{n+2}.
\]
Using the alternating series test from calculus, we see that this series converges. Thus \(x = \frac{4}{3}\) belongs to the interval of convergence.\\\\
Plugging \(x = \frac{2}{3}\), we find:
\[
\sum_{n=0}^{\infty} \frac{(-3)^n \left(\frac{2}{3}-1\right)^n}{n+2}
= \sum_{n=0}^{\infty} \frac{(-3)^n \left(-\frac{1}{3}\right)^n}{n+2}
= \sum_{n=0}^{\infty} \frac{1}{n+2}.
\]
Using the integral test from calculus, we see that this series diverges. Thus \(x = \frac{2}{3}\) does not belong to the interval of convergence. We conclude that the interval of convergence is $\left(\frac{2}{3}, \frac{4}{3}\right].$
\end{example}

\begin{remark}
If the radius of convergence is \(R > 0\), we know that the series always converges absolutely for \(|x-x_0| < R\). But at the endpoints, i.e., for \(|x-x_0| = R\), even if the series converges, it may not converge absolutely. E.g., in the previous example the series converges at \(x = \frac{4}{3}\), but it does not converge absolutely since
\[
\sum_{n=0}^{\infty} \left| \frac{(-3)^n \left(\frac{4}{3}-1\right)^n}{n+2} \right| = \sum_{n=0}^{\infty} \left| \frac{(-1)^n}{n+2} \right|
= \sum_{n=0}^{\infty} \frac{1}{n+2}
\]
diverges.
\end{remark}

\begin{example}
Find the interval of convergence of
\[
\sum_{n=0}^{\infty} \frac{2^{-n}}{n+1}(x-1)^n.
\]
We first find \(R\):
\[
\lim_{n \to \infty}
\left|
\frac{2^{-(n+1)}(x-1)^{n+1}}{n+2}
\cdot
\frac{n+1}{2^{-n}(x-1)^n}
\right|
=
\lim_{n \to \infty}
\frac{1}{2}\frac{n+1}{n+2}|x-1|
= \frac{1}{2}|x-1|.
\]
We want this to be less than 1:
\[
\frac{1}{2}|x-1| < 1 \;\Rightarrow\; |x-1| < 2.
\]
So \(R = 2\). Test the endpoints \(|x-1| = 2\), i.e., \(x = 3\) and \(x = -1\).

\(x = 3\):
\[
\sum_{n=0}^{\infty} \frac{2^{-n}(3-1)^n}{n+1}
= \sum_{n=0}^{\infty} \frac{1}{n+1},
\]
which diverges (by the integral test).

\(x = -1\):
\[
\sum_{n=0}^{\infty} \frac{2^{-n}(-1-1)^n}{n+1}
= \sum_{n=0}^{\infty} \frac{(-1)^n}{n+1},
\]
which converges (by the alternating series test).\\\\
Thus the interval of convergence is
\[
[-1, 3).
\]
Let us look again at the ratio test. We have:
\begin{align*}
\lim_{n \to \infty} \left| \frac{c_{n+1}}{c_n} \right|
&= \lim_{n \to \infty} \left| \frac{a_{n+1}(x-x_0)^{n+1}}{a_n(x-x_0)^n} \right|
= \lim_{n \to \infty} \left| \frac{a_{n+1}}{a_n} \right| |x-x_0|\\
&= |x-x_0|\lim_{n \to \infty} \left| \frac{a_{n+1}}{a_n} \right| 
\end{align*}
For convergence, we want this limit to be less than one, so:
\[
|x - x_0| \lim_{n \to \infty} \left| \frac{a_{n+1}}{a_n} \right| < 1
\quad \Rightarrow \quad
|x - x_0| < \frac{1}{\lim_{n \to \infty} \left| \frac{a_{n+1}}{a_n} \right|}.
\]
But because we are assuming the limit to exist (otherwise the ratio test could not be used in the first place), we have
\[
\frac{1}{\lim_{n \to \infty} \left| \frac{a_{n+1}}{a_n} \right|}
= \lim_{n \to \infty} \frac{1}{\left| \frac{a_{n+1}}{a_n} \right|}
= \lim_{n \to \infty} \left| \frac{a_n}{a_{n+1}} \right|.
\]
And our condition becomes
\[
|x - x_0| < \lim_{n \to \infty} \left| \frac{a_n}{a_{n+1}} \right|,
\]
which tells us that the radius of convergence is
\[
R = \lim_{n \to \infty} \left| \frac{a_n}{a_{n+1}} \right|.
\]
\end{example}

\noindent \textbf{Summarizing:}

\textbf{Ratio test (part 2).} The radius of convergence of
\[
\sum_{n=0}^{\infty} a_n (x - x_0)^n
\]
is given by
\[
R = \lim_{n \to \infty} \left| \frac{a_n}{a_{n+1}} \right|.
\]

\textbf{Warning.} In the first version of the ratio test, as we originally stated above, we compute the limit involving ``$n+1$ divided by $n$'' and the limit is not the radius of convergence; we still have to solve for $|x - x_0| < \cdots$, as in the above example. In the second (part 2) version of the ratio test, we compute a limit involving ``$n$ divided by $n+1$'' (rather than ``$n+1$ divided by $n$'' as before), and the answer is the radius of convergence.

\subsection{Properties of power series.} Suppose that
\[
f(x) = \sum_{n=0}^{\infty} a_n (x - x_0)^n
\quad \text{and} \quad
g(x) = \sum_{n=0}^{\infty} b_n (x - x_0)^n
\]
have radius of convergence $R > 0$. Then, for $|x - x_0| < R$:

\begin{itemize}
\item[(a)]
\[
f'(x) = \sum_{n=0}^{\infty} n a_n (x - x_0)^{n-1}
\]

\item[(b)]
\[
\int f(x)\,dx = \sum_{n=0}^{\infty} \frac{a_n}{n+1} (x - x_0)^{n+1} + C
\]

\item[(c)]
\[
f(x) = 0 \text{ for all } x \in (x_0 - R, x_0 + R)
\quad \text{iff} \quad a_n = 0 \text{ for all } n
\]

\item[(d)]
\[
f(x)g(x) = \sum_{n=0}^{\infty} c_n (x - x_0)^n,
\quad \text{where} \quad
c_n = \sum_{j=0}^{n} a_j b_{n-j}
\]
\end{itemize}

Because we will be dealing with power series, it is important to distinguish functions that can be written as a power series. This is the purpose of the next definition.

\begin{definition}
A function $f$ is said to be \textbf{analytic at $x_0$} if, in an open interval about $x_0$, $f$ equals a power series
\[
\sum_{n=0}^{\infty} a_n (x - x_0)^n
\]
that has a positive radius of convergence. In other words, there exists $R > 0$ such that for all $x \in (x_0 - R, x_0 + R)$,
\[
f(x) = \sum_{n=0}^{\infty} a_n (x - x_0)^n.
\]
When a function is analytic at $x_0$ for any $x_0$, we say simply that it is \textbf{analytic}. If it is analytic at every point in an open interval $(a,b)$, we say that it is \textbf{analytic on} $(a,b)$.\\\\
When we express a given function as a power series, i.e., given $f(x)$ we find
\[
\sum_{n=0}^{\infty} a_n (x - x_0)^n
\quad \text{such that} \quad
f(x) = \sum_{n=0}^{\infty} a_n (x - x_0)^n,
\]
we call this a \textbf{power series representation} (about $x_0$) of $f(x)$.
\end{definition}

\begin{example}
The functions $e^x$, $\cos x$, and $\sin x$ are analytic. For $x_0 = 0$ we have
\[
e^x = \sum_{n=0}^{\infty} \frac{x^n}{n!}, \quad
\cos x = \sum_{n=0}^{\infty} \frac{(-1)^n}{(2n)!} x^{2n}, \quad
\sin x = \sum_{n=0}^{\infty} \frac{(-1)^n}{(2n+1)!} x^{2n+1}.
\]
These expressions are valid for any $x$, i.e., $R = \infty$.\\\\
It is important to note that the power series representation changes with $x_0$. For example, replacing $x$ by $x-2$ in $e^x$:
\[
e^{x-2} = \sum_{n=0}^{\infty} \frac{(x-2)^n}{n!},
\]
so
\[
e^x = \sum_{n=0}^{\infty} \frac{e^2}{n!} (x-x_0)^n,
\]
which is another way of writing $e^x$ as a power series.
\end{example}

\begin{example}
$\ln x$ is analytic for $x > 0$. A power series representation about $x_0 = 1$ is
\[
\ln x = \sum_{n=1}^{\infty} \frac{(-1)^{n+1}}{n} (x - 1)^n,
\]
with radius of convergence $R = 1$.
\end{example}

\begin{example}
Any polynomial $a_0 + a_1 x + \cdots + a_n x^n$ is analytic since it equals the series
\[
\sum_{k=0}^{\infty} a_k x^k,
\]
where $a_k = 0$ for all $k > n$. A rational function $\frac{p(x)}{q(x)}$, where $p(x)$ and $q(x)$ are polynomials without a common factor, is analytic at any $x_0$ where $q(x_0) \neq 0$.
\end{example}

\begin{example}
From the properties of differentiation of power series, it follows that if $f$ is analytic at $x_0$, then it is infinitely many times differentiable at $x_0$. Consequently, if a derivative of some order does not exist at $x_0$, then $f$ is not analytic at $x_0$. E.g.,
\[
f(x) = |x-2|
\]
is not analytic at $x=2$ because $f'(2)$ does not exist. Also,
\[
f(x) = x^{7/3}
\]
is not analytic at $x=0$ because $f'''(0)$ does not exist.
\end{example}

The following result is very useful: if $f(x)$ is analytic at $x_0$, then the coefficients of its power series representation about $x_0$ are given by
\[
a_n = \frac{f^{(n)}(x_0)}{n!}.
\]
Thus,
\[
f(x) = \sum_{n=0}^{\infty} \frac{f^{(n)}(x_0)}{n!} (x - x_0)^n.
\]

\begin{remark}
We noted above that if $f(x)$ is analytic at $x_0$, then all its derivatives at $x_0$ exist. The converse is not true. For example, consider
\[
f(x) =
\begin{cases}
e^{-1/x^2}, & x \neq 0, \\
0, & x = 0.
\end{cases}
\]
One can show that all derivatives of $f$ at $0$ exist and in fact $f^{(n)}(0) = 0$ for all $n$. If $f$ were analytic, then
\[
f(x) = \sum_{n=0}^{\infty} \frac{f^{(n)}(0)}{n!} x^n = 0,
\]
which is only true at $x=0$ (and to be analytic, a function needs to equal the power series on an open interval about $x_0$).
\end{remark}

\noindent \textbf{Properties of analytic functions}. The sum, product, and composition of analytic functions are analytic.

\section{Differential Equations with Analytic Coefficients}

We will study the differential equation
\[
a_2(x) y'' + a_1(x) y' + a_0(x) y = 0
\]
(linear, second order, homogeneous), which we write as
\[
y'' + p(x) y' + q(x) y = 0,
\]
with
\[
p(x) = \frac{a_1(x)}{a_2(x)}, \quad
q(x) = \frac{a_0(x)}{a_2(x)}.
\]

\begin{definition}
A point $x_0$ is called an \textbf{ordinary point} of the differential equation
\[
y'' + p(x) y' + q(x) y = 0
\]
if $p(x)$ and $q(x)$ are analytic at $x_0$. If $x_0$ is not an ordinary point, then it is called a \textbf{singular point}.
\end{definition}

\begin{example}
Determine the singular points of
\[
x y'' + x^2(x+1)y' + \frac{\sin x}{x+1} y = 0.
\]
Write the equation as
\[
y'' + \frac{x^2(x+1)}{x} y' + \frac{\sin x}{x(x+1)} y = 0.
\]
Then
\[
p(x) = \frac{x^2(x+1)}{x} = x(x+1),
\]
which is a polynomial, hence analytic. For
\[
q(x) = \frac{\sin x}{x(x+1)},
\]
the denominator is zero at zero. But this zero is "removable" in the sense that
\[
\frac{\sin x}{x}
= \frac{1}{x}\left(x - \frac{x^3}{3!} + \frac{x^5}{5!} - \frac{x^7}{7!} + \cdots \right)
= 1 - \frac{x^2}{3!} + \frac{x^4}{5!} - \frac{x^6}{7!} + \cdots.
\]
Showing not only that $\frac{\sin x}{x}$ is well defined at zero but it is in fact analytic at zero. Since $\frac{1}{x}$ and $\sin x$ are separately analytic at any $x \neq 0$, we conclude that $\frac{\sin x}{x}$ is analytic for any $x$ (product of analytic functions). The function $\frac{1}{x+1}$ is analytic at any $x$ for except $x = -1$. Thus $q(x)$ is analytic for nay $x$ except $x = -1$ and we conclude that $-1$ is the only singularity point of the DE.
\end{example}

\begin{example}
Find the singular points of
\[
e^{1/x^2} y'' + y = 0.
\]
Write
\[
y'' + \frac{1}{e^{1/x^2}} y = 0.
\]
Thus
\[
p(x) = 0, \quad q(x) = e^{-1/x^2}.
\]
We know $e^{-1/x^2}$ is not analytic at $x=0$, but it is analytic for $x \neq 0$ since it is the composition of $e^x$ (analytic) with $\frac{1}{x^2}$ (analytic for $x\neq 0)$. Thus $x=0$ is the only singular point.
\end{example}

\begin{theorem}[Existence of analytic solutions]
Suppose that $x_0$ is an ordinary point of the differential equation
\[
y'' + p(x) y' + q(x) y = 0.
\]
Then the equation has two linearly independent solutions of the form
\[
y(x) = \sum_{n=0}^{\infty} a_n (x - x_0)^n.
\]
The radius of convergence of any such power series solution is at least as large as the distance from $x_0$ to the nearest (real or complex) singular point of the differential equation.
\end{theorem}

\begin{remark}
Recall the example $y'' + 4y = 0$. We found a power series solution with $a_0$ and $a_1$ arbitrary, which can be separated into two power series giving two linearly independent solutions. Something similar happens in general and another way to state the theorem is that the differential equation has a solution of the form
\[
y(x) = \sum_{n=0}^{\infty} a_n (x - x_0)^n,
\]
with $a_0$ and $a_1$ arbitrary constants.
\end{remark}

\begin{example}
Do the DE
\begin{align*}
(a)\quad & y'' + x^4 y' + y = 0, \\
(b)\quad & (1 + x^2) y'' + y = 0, \\
(c)\quad & y'' + \frac{1}{1 + x^2} y' + \frac{1}{1 - 3x} y = 0
\end{align*}
admit a power series solution about $x = 0$? If yes, what can be said about its radius of convergence?

\begin{itemize}
    \item[(a)] We have $p(x) = x^4$ and $q(x) = 1$, which are analytic for all $x$ thus in particular at $x = 0$. Therefore, the DE admits a power series solution of the form
\[
y(x) = \sum_{n=0}^{\infty} a_n x^n \quad (x_0 = 0).
\]
The DE has no singular poin,t so the distance between the ordinary point $x = 0$ and a singular point is infinite and the radius of convergence of the solutions is $\infty$.
\medskip
\item[(b)] We have $p(x) = 0$ (analytic) and $q(x) = \frac{1}{1 + x^2}$. The singular points occur when $1 + x^2 = 0 \Rightarrow x = \pm i$. Thus $x = 0$ is not a singular point and the DE admits a solution
\[
\sum_{n=0}^{\infty} a_n x^n \quad (x_0 = 0).
\]
Since the distance between zero and the singular points $\pm i$ is one, the radius of convergence of the solution is at least one. (We do not know from the theorem whether it is equal to one, only that it is at least one.)
\end{itemize}

\begin{figure}[H]
\centering
\begin{tikzpicture}[scale=0.9]
\draw[->] (-2,0) -- (2,0);
\draw[->] (0,-1.5) -- (0,1.5);
\fill (0,0) circle (2pt) node[below right] {$0$};
\fill (0,1) circle (2pt) node[right] {$i$};
\fill (0,-1) circle (2pt) node[right] {$-i$};
\draw[decorate,decoration={brace,amplitude=5pt},red] (0,0) -- (0,1)
node[midway,left=6pt] {$1$};
\draw[decorate,decoration={brace,amplitude=5pt}, red] (0,-1) -- (0,0)
node[midway,left=6pt] {$1$};
\end{tikzpicture}
\caption{Distance between $0$ and the singular points $\pm i$}
\end{figure}

\begin{itemize}
    \item[(c)] We already know that $\frac{1}{1 + x^2}$ is analytic at zero. $\frac{1}{1 - 3x}$ is analytic for all $x$ except when $1 - 3x = 0 \Rightarrow x = \frac{1}{3}$. Thus $x = 0$ is an ordinary point and the DE admits a solution
\[
\sum_{n=0}^{\infty} a_n x^n \quad (x_0 = 0).
\]
The distance between $x_0 = 0$ and the nearest singular point is $\frac{1}{3}$, so the radius of convergence of the solution is at least $\frac{1}{3}$.
\end{itemize}

\begin{figure}[H]
\centering
\begin{tikzpicture}[scale=0.9]
\draw[->] (-2,0) -- (2,0);
\draw[->] (0,-2) -- (0,2);
\fill (0,0) circle (2pt) node[below right] {$0$};
\fill (0,1.25) circle (2pt) node[right] {$i$};
\fill (0,-1.25) circle (2pt) node[right] {$-i$};
\fill (2/3,0) circle (2pt) node[below] {$\frac{1}{3}$};
\draw[decorate,decoration={brace,amplitude=5pt}] (0,0) -- (0,1.25)
node[midway,left=6pt] {$1$};
\draw[decorate,decoration={brace,amplitude=5pt}] (0,-1.25) -- (0,0)
node[midway,left=6pt] {$1$};
\draw[decorate,decoration={brace,amplitude=5pt}] (0,0) -- (2/3,0)
node[midway,above=5pt] {$\frac{1}{3}$};
\end{tikzpicture}
\caption{Distances from $0$ to singular points $\pm i$ and $\frac{1}{3}$}
\end{figure}
\end{example}

\begin{remark}
The distance between two complex numbers $z_1 = a_1 + i b_1$ and $z_2 = a_2 + i b_2$ is
\[
\sqrt{(a_1 - a_2)^2 + (b_1 - b_2)^2}.
\]
The above theorem essentially says that if we are given a DE with analytic coefficients we are justified in seeking a power solution, knowing ahead of time that this will produce a solution with a positive radius of convergence.
\end{remark}

Let us now see how this works in practice.

\begin{example}
Find a general solution to
\[
2y'' + x y' + y = 0.
\]
(Note that even though this is a very simple looking equation, none of the methods we developed prior to power series is applicable here.) We write
\[
y'' + \frac{x}{2} y' + \frac{1}{2} y = 0.
\]
Since $\frac{x}{2}$ and $\frac{1}{2}$ are analytic functions we can look for a solution as a power series
\[
y(x) = \sum_{n=0}^{\infty} a_n (x - x_0)^n.
\]
In doing so we need to decide what to choose for $x_0$. Since $\frac{x}{2}$ and $\frac{1}{2}$ are analytic for any $x_0$, we are free to pick any $x_0$ we want so we choose for simplicity $x_0 = 0$, so
\[
y(x) = \sum_{n=0}^{\infty} a_n x^n.
\]
Compute:
\[
y'(x) = \sum_{n=0}^{\infty} n a_n x^{n-1}, \quad
y''(x) = \sum_{n=0}^{\infty} n(n-1)a_n x^{n-2}.
\]
Plugging into the equation:
\begin{align*}
\sum_{n=0}^{\infty} n(n-1)a_n x^{n-2}
+ \frac{x}{2} \sum_{n=0}^{\infty} n a_n x^{n-1}
+ \frac{1}{2} \sum_{n=0}^{\infty} a_n x^n &= 0 \\
\sum_{n=0}^{\infty} n(n-1)a_n x^{n-2}
+ \sum_{n=0}^{\infty} \frac{1}{2} n a_n x^n
+ \sum_{n=0}^{\infty} \frac{1}{2} a_n x^n &= 0
\end{align*}
We can start the first sum at $n=2$ and the second sum at $n=1$:
\[
\sum_{n=2}^{\infty} n(n-1)a_n x^{n-2}
+ \sum_{n=1}^{\infty} \frac{1}{2} n a_n x^n
+ \sum_{n=0}^{\infty} \frac{1}{2} a_n x^n = 0.
\]
We shift the indices in the first sum by setting $m = n - 2$:
\[
\sum_{n=2}^{\infty} \overbrace{n(n-1)}^{(m+2)(m+1)}\underbrace{a_n}_{m+2} \overbrace{x^{n-2}}^{m}
= \sum_{m=0}^{\infty} (m+2)(m+1)a_{m+2} x^m.
\]
Since $m$ is a dummy index of summation we can relabel it as $n$:
\[
\sum_{n=0}^{\infty} (n+2)(n+1)a_{n+2} x^n
+ \sum_{n=1}^{\infty} \frac{1}{2} n a_n x^n
+ \sum_{n=0}^{\infty} \frac{1}{2} a_n x^n = 0.
\]
We want to group all sums into a single one. For this we need all sums to start at the same value, so we expand the first and last sums:
\[
\sum_{n=0}^{\infty} (n+2)(n+1)a_{n+2} x^n
= 2a_2 + \sum_{n=1}^{\infty} (n+2)(n+1)a_{n+2} x^n
\]
and
\[
\sum_{n=0}^{\infty} \frac{1}{2} a_n x^n
= \frac{1}{2} a_0 + \sum_{n=1}^{\infty} \frac{1}{2} a_n x^n,
\]
thus
\[
2a_2 + \sum_{n=1}^{\infty} (n+2)(n+1)a_{n+2} x^n
+ \sum_{n=1}^{\infty} \frac{1}{2} n a_n x^n
+ \frac{1}{2} a_0 + \sum_{n=1}^{\infty} \frac{1}{2} a_n x^n = 0.
\]
or,
\[
2a_2 + \frac{1}{2} a_0
+ \sum_{n=1}^{\infty} \left[(n+2)(n+1)a_{n+2} + \frac{1}{2}(n+1)a_n \right] x^n = 0.
\]
Since the coefficients of all powers of $x$ must vanish separately:
\[
2a_2 + \frac{1}{2} a_0 = 0,
\]
\[
(n+2)(n+1)a_{n+2} + \frac{1}{2}(n+1)a_n = 0, \quad n \geq 1.
\]
The first equation corresponds to the second with $n=0$ so we combine both as
\[
(n+2)(n+1)a_{n+2} + \frac{1}{2}(n+1)a_n = 0, \quad n \geq 0.
\]
Thus
\[
a_{n+2} = -\frac{1}{2} \frac{1}{n+2} a_n, \quad n \geq 0.
\]
From this relation we can determine all coefficients except $a_0$ and $a_1$. We find:
\[
a_2 = -\frac{1}{4} a_0 = -\frac{1}{2^2} a_0, \quad
a_3 = -\frac{1}{2 \cdot 3} a_1,
\]
\[
a_4 = -\frac{1}{2 \cdot 4} a_2 = \frac{1}{2^2 \cdot 2 \cdot 4} a_0, \quad
a_5 = -\frac{1}{2 \cdot 5} a_3 = \frac{1}{2^2 \cdot 3 \cdot 5} a_1,
\]
\[
a_6 = -\frac{1}{2 \cdot 6} a_4 = -\frac{1}{2^3 \cdot 2 \cdot 4 \cdot 6} a_0, a_7 = -\frac{1}{2 \cdot 7} a_5 = -\frac{1}{2^3 \cdot 3 \cdot 5 \cdot 7} a_1, \ \ldots
\]
Continuing, we find the patterns
\[
a_{2n} = \frac{(-1)^n}{2^{2n} n!} a_0, \qquad
a_{2n+1} = \frac{(-1)^n}{2^{2n}(1 \cdot 3 \cdot 5 \cdots (2n+1))} a_1, \quad n \geq 1.
\]
Thus
\[
y(x) = \sum_{n=0}^{\infty} a_n x^n
= \sum_{n=0}^{\infty} a_{2n} x^{2n}
+ \sum_{n=0}^{\infty} a_{2n+1} x^{2n+1}
\]
\[
= a_0 \underbrace{\sum_{n=0}^{\infty} \frac{(-1)^n}{2^{2n} n!} x^{2n}}_{=y_1(x)}
+ a_1 \underbrace{\sum_{n=0}^{\infty} \frac{(-1)^n}{2^{2n}(1 \cdot 3 \cdot 5 \cdots (2n+1))} x^{2n+1}.}_{=y_2(x)}
\]
So
\[
y(x) = a_0 y_1(x) + a_1 y_2(x).
\]
Because the equation has no singular points the radius of convergence is $\infty$. We also see that $y_1(x)$ and $y_2(x)$ are linearly independent (since one involves even and another odd powers of $x$).
\end{example}

\begin{remark}
When dealing with power series it is natural to ask how we can compute things ``in practice.'' For example, suppose that in some application we need to compute $y_1(3)$ in the above example. We have
\[
y_1(3) = \sum_{n=0}^{\infty} \frac{(-1)^n}{2^{2n} n!} 3^{2n}.
\]
While we know this to be a real number (the series converges), it might be very difficult to determine which number it is. However, in most applications a good approximation to $y_1(3)$ would be enough. Recall that the partial sum
\[
\sum_{n=0}^{N} a_n (x-x_0)^n
\]
becomes closer to the actual value the larger $N$ is. Thus
\[
y_1(3) \approx \sum_{n=0}^{N} \frac{(-1)^n}{2^{2n} n!} 3^{2n},
\]
for some large fixed $N$. How large $N$ should be depends on how good we want the approximation to be. For example, if we require accuracy only up to the second decimal digit, we can test a few values of $N$ until the corresponding values of $y_1(3)$ differ only at the third decimal digit. (There are much better ways to get a good approximation by getting precise estimates for error incurred upon truncating the series at the $N$th term. Students are referred to the theory of power series for details.) The important point here is that
\[
\sum_{n=0}^{N} \frac{(-1)^n}{2^{2n} n!} 3^{2n}
\]
is a finite sum that can easily be computed with a computer (regardless of how large $N$ is).
\end{remark}

\begin{remark}
Suppose that in the above example we are given the initial conditions
\[
y(3) = -4, \qquad y'(3) = 2.
\]
We can then determine the constants $a_0$ and $a_1$ in $y(x) = a_0 y_1(x) + a_1 y_2(x)$ by solving
\[
y(3) = -4 = a_0 y_1(3) + a_1 y_2(3),
\]
\[
y'(3) = 2 = a_0 y_1'(3) + a_1 y_2'(3),
\]
for $a_0$ and $a_1$. To do so we need the values $y_1(3), y_2(3), y_1'(3)$, and $y_2'(3)$. As remarked above it can be very difficult to determine such values exactly, but we can find them approximately. This will give an approximation for $a_0$ and $a_1$. However, a better approach is the following. Instead of looking for a power series solution of the form
\[
\sum_{n=0}^{\infty} a_n x^n,
\]
i.e., centered at $0$, we solve the DE using
\[
y(x) = \sum_{n=0}^{\infty} a_n (x-3)^n,
\]
i.e., a power series centered at $3$. Then
\[
y(x) = a_0 + a_1 (x-3) + a_2 (x-3)^2 + a_3 (x-3)^3 + \cdots
\]
and
\[
y'(x) = a_1 + 2a_2 (x-3) + 3a_3 (x-3)^2 + \cdots
\]
so that $y(3) = a_0$ and $y'(3) = a_1$. In this case we can determine exactly what $a_0$ and $a_1$ are. Therefore, \textit{when given initial conditions at $x_0$, we look for a power series solution centered at $x_0$, i.e., in the form}
\[
y(x) = \sum_{n=0}^{\infty} a_n (x-x_0)^n.
\]
\end{remark}

\subsection{Some terminology} Solving DE with power series typically involves finding a relation that expresses the coefficients $a_n$ in terms of its predecessors (e.g., $a_{n+2} = -\frac{1}{2}\frac{1}{n+2} a_n$ in the previous example). A relation of this type is called a \textbf{recurrence relation}.\\\\
Many times we have to rearrange a sum to write a series in powers of $x^{n+k}$ as a series in powers of $x^n$ (or some other power), as, for instance,

\[
\sum_{n=2}^{\infty} n(n-1)a_n x^{n-2}
=
\sum_{n=0}^{\infty} (n+2)(n+1)a_{n+2} x^n
\]
in the above example. We refer to this procedure as \textbf{shifting the summation index}.\\\\
Sometimes it is difficult to determine the complete pattern of the coefficients $a_n$, in which case we leave them indicated by the recurrence relation, as illustrated in the next example.

\begin{example}
Find a power series solution about zero to
\[
(1+x^2)y'' - y' + y = 0.
\]
We have $p(x) = -\frac{1}{1+x^2}$ and $q(x) = \frac{1}{1+x^2}$ so $x=0$ is an ordinary point. Therefore we can express the general solution as
\[
y(x) = \sum_{n=0}^{\infty} a_n x^n,
\]
so
\[
y'(x) = \sum_{n=0}^{\infty} n a_n x^{n-1}, \qquad
y''(x) = \sum_{n=0}^{\infty} n(n-1)a_n x^{n-2}.
\]
Plugging in:
\[
(1+x^2)\sum_{n=0}^{\infty} n(n-1)a_n x^{n-2}
- \sum_{n=0}^{\infty} n a_n x^{n-1}
+ \sum_{n=0}^{\infty} a_n x^n = 0,
\]
or
\[
(1+x^2)\sum_{n=2}^{\infty} n(n-1)a_n x^{n-2}
- \sum_{n=1}^{\infty} n a_n x^{n-1}
+ \sum_{n=0}^{\infty} a_n x^n = 0,
\]
\[
\sum_{n=2}^{\infty} n(n-1)a_n x^{n-2}
+ \sum_{n=2}^{\infty} n(n-1)a_n x^n
- \sum_{n=1}^{\infty} n a_n x^{n-1}
+ \sum_{n=0}^{\infty} a_n x^n = 0.
\]
Shifting the summation index in the first and third sums:
\[
\color{blue} \sum_{n=0}^{\infty} (n+2)(n+1)a_{n+2} x^n
\color{orange} +\sum_{n=2}^{\infty} n(n-1)a_n x^n
  \color{green} -\sum_{n=0}^{\infty} (n+1)a_{n+1} x^n
\color{red}+ \sum_{n=0}^{\infty} a_n x^n = 0.
\]
Expanding the first, third, and fourth sums up to $n=1$:
\[
\color{blue} 2\cdot 1 a_2 + 3\cdot 2 a_3 x
+ \sum_{n=2}^{\infty} (n+2)(n+1)a_{n+2} x^n
\color{orange}+ \sum_{n=2}^{\infty} n(n-1)a_n x^n
\]
\[
\color{green} - a_1 - 2a_2 x
- \sum_{n=2}^{\infty} (n+1)a_{n+1} x^n
\color{red} + a_0 + a_1 x + \sum_{n=2}^{\infty} a_n x^n = 0.
\]
Grouping the terms in same powers of $x$:
\[
(2a_2 - a_1 + a_0)
+ (6a_3 - 2a_2 + a_1)x
\]
\[
+ \sum_{n=2}^{\infty}
\left[
(n+2)(n+1)a_{n+2}
- (n+1)a_{n+1}
+ (n(n-1)+1)a_n
\right] x^n = 0,
\]
from which we derive the following recurrence relations:
\[
2a_2 - a_1 + a_0 = 0,
\]
\[
6a_3 - 2a_2 + a_1 = 0,
\]
\[
(n+2)(n+1)a_{n+2}
- (n+1)a_{n+1}
+ (n(n-1)+1)a_n = 0, \quad n \ge 2,
\]
or
\[
a_2 = \frac{a_1 - a_0}{2},
\]
\[
a_3 = \frac{2a_2 - a_1}{6},
\]
\[
a_{n+2} =
\frac{(n+1)a_{n+1} - (n(n-1)+1)a_n}{(n+2)(n+1)}, \quad n \ge 2.
\]
Because the recurrence relations are somewhat complicated (with $a_{n+2}$ involving two coefficients, $a_{n+1}$ and $a_n$, rather than only $a_n$ as in the previous example) we do not attempt to find a general pattern for $a_n$. Instead, we state the solution as follows: the general solution is given by
\[
y(x)=\sum_{n=0}^{\infty} a_n x^n,
\]
with $a_0$ and $a_1$ arbitrary and the remaining coefficients determined by the above recurrence relations. The radius of convergence of the power series is at least one (because this is the distance from zero to the nearest singular points, see previous example above).\\\\
It is useful to compute the first few terms of the solution to get an idea of how it ``looks like'', we have
\[
a_2=\frac{a_1-a_0}{2},
\]
\[
a_3=\frac{2a_2-a_1}{6}
=\frac{2\left(\frac{a_1-a_0}{2}\right)-a_1}{6}
=-\frac{a_0}{6},
\]
\[
a_4=a_{2+2}
=\frac{3a_3-3a_2}{4\cdot 3}
=\frac{-\frac{a_0}{6}-\left(\frac{a_1-a_0}{2}\right)}{4}
=\frac{2a_0-3a_1}{24},
\]
\[
a_5=a_{3+2}
=\frac{4a_4-7a_3}{5\cdot 4}
=\frac{3a_0-a_1}{40},
\]
so
\[
y(x)=a_0+a_1x+\frac{a_1-a_0}{2}x^2-\frac{a_0}{6}x^3+\frac{2a_0-3a_1}{24}x^4+\frac{3a_0-a_1}{40}x^5+\cdots
\]
\[
= a_0\left(1-\frac{1}{2}x^2-\frac{1}{6}x^3+\frac{1}{12}x^4+\frac{3}{40}x^5+\cdots\right)
+ a_1\left(x+\frac{1}{2}x^2-\frac{1}{8}x^4-\frac{1}{40}x^5+\cdots\right).
\]
In yet more complicated equations, finding the recurrence relation is itself a daunting task. In these cases we typically restrict ourselves to finding the first few terms of the solution.
\end{example}

\begin{example}
Find the first seven terms of the solution to:
\[
y''+e^x y' +(1+x^2)y=0,\qquad y(0)=1,\qquad y'(0)=0.
\]
Because the initial condition is given at zero, we look for a power series solution about zero. This can be done because the equation has no singular points. Thus
\[
y(x)=\sum_{n=0}^{\infty} a_n x^n, \text{with radius of convergence } R=\infty.
\]
We compute:
\[
y'(x)=\sum_{n=0}^{\infty} n a_n x^{n-1}
=\sum_{n=1}^{\infty} n a_n x^{n-1},
\]
\[
y''(x)=\sum_{n=1}^{\infty} n(n-1)a_n x^{n-2}
=\sum_{n=2}^{\infty} n(n-1)a_n x^{n-2},
\]
and plug in:
\[
\sum_{n=2}^{\infty} n(n-1)a_n x^{n-2}
+e^x\sum_{n=1}^{\infty} n a_n x^{n-1}
+(1+x^2)\sum_{n=0}^{\infty} a_n x^n=0.
\]
But
\[
e^x=\sum_{n=0}^{\infty}\frac{x^n}{n!}
=1+x+\frac{x^2}{2}+\frac{x^3}{6}+\frac{x^4}{24}+\cdots, \text{ so}
\]
\[
\sum_{n=2}^{\infty} n(n-1)a_n x^{n-2}
+\left(1+x+\frac{x^2}{2}+\frac{x^3}{6}+\frac{x^4}{24}+\cdots\right)
\sum_{n=1}^{\infty} n a_n x^{n-1}
+(1+x^2)\sum_{n=0}^{\infty} a_n x^n=0.
\]
Expand each sum:
\[
\left(2a_2+6a_3x+12a_4x^2+20a_5x^3+30a_6x^4+\cdots\right)
\]
\[
+\left(\color{blue}1\color{green}+ x\color{red}+\frac{x^2}{2}\color{brown}+\frac{x^3}{6}\color{violet}+\frac{x^4}{24}+\cdots\right)
\left(a_1+2a_2x+3a_3x^2+4a_4x^3+5a_5x^4+\cdots\right)
\]
\[
+(\color{orange}1\color{purple}+x^2) \color{black} \left(a_0+a_1x+a_2x^2+a_3x^3+a_4x^4+\cdots\right)=0,
\]
\[
\left(2a_2+6a_3x+12a_4x^2+20a_5x^3+30a_6x^4+\cdots\right)
\]
\[
\color{blue} +\left(a_1+2a_2x+3a_3x^2+4a_4x^3+5a_5x^4+\cdots\right)
\]
\[
\color{green} +\left(a_1x+2a_2x^2+3a_3x^3+4a_4x^4+\cdots\right)
\]
\[
\color{red}+\left(\frac{1}{2}a_1x^2+a_2x^3+\frac{3}{2}a_3x^4+\cdots\right)
\]
\[
\color{brown}+\left(\frac{1}{6}a_1x^3+\frac{1}{3}a_2x^4+\cdots\right)
\]
\[
\color{violet}+\left(\frac{1}{24}a_1x^4+\cdots\right)
\]
\[
\color{orange}+\left(a_0+a_1x+a_2x^2+a_3x^3+a_4x^4+\cdots\right)
\]
\[
\color{purple}+\left(a_0x^2+a_1x^3+a_2x^4+\cdots\right)=0.
\]
We now group the terms with the same power of $x$ and set them equal to zero:
\[
x^0\text{ term:}\qquad 2a_2+a_1+a_0=0
\]
\[
x^1\text{ term:}\qquad 6a_3+2a_2+2a_1=0
\]
\[
x^2\text{ term:}\qquad 12a_4+3a_3+3a_2+\frac{1}{2}a_1+a_0=0
\]
\[
x^3\text{ term:}\qquad 20a_5+4a_4+4a_3+a_2+\frac{7}{6}a_1=0
\]
\[
x^4\text{ term:}\qquad 30a_6+5a_5+5a_4+\frac{3}{2}a_3+\frac{4}{3}a_2+\frac{1}{24}a_1=0
\]
The initial conditions give $a_0=1$, $a_1=0$, so
\[
2a_2+0+1=0 \quad \Rightarrow \quad a_2=-\frac{1}{2}
\]
\[
6a_3-1+0=0 \quad \Rightarrow \quad a_3=\frac{1}{6}
\]
\[
12a_4+\frac{1}{2}-\frac{3}{2}+0+1=0 \quad \Rightarrow \quad a_4=0
\]
\[
20a_5+0+\frac{2}{3}-\frac{1}{2}+0=0 \quad \Rightarrow \quad a_5=-\frac{1}{120}
\]
\[
30a_6-\frac{1}{24}+0+\frac{1}{4}-\frac{2}{3}+0=0 \quad \Rightarrow \quad a_6=\frac{11}{720}.
\]
Hence
\[
y(x)=\sum_{n=0}^{\infty} a_n x^n
=1-\frac{1}{2}x^2+\frac{1}{6}x^3-\frac{1}{120}x^5+\frac{11}{720}x^6+\cdots
\]
(note that the second and fifth terms are zero).
\end{example}

\begin{remark}
It is also possible to use the method of power series to solve non-homogeneous equations; see the textbook.
\end{remark}

\section{The method of Frobenius}

We will now present a method that allows us to find a power series solution about $x_0$ in certain cases when $x_0$ is not an ordinary point. Before formalizing the method, let us illustrate with an example.

\begin{example}
Find a power series solution about $x=0$ to
\[
(x+2)x^2y''-xy'+(1+x)y=0, \qquad x>0.
\]
We have
\[
p(x)=-\frac{x}{(x+2)x^2}=-\frac{1}{x(x+2)}, 
\qquad 
q(x)=\frac{1+x}{x^2(x+2)}.
\]
We see that $p(x)$ and $q(x)$ are not analytic at $x=0$, i.e., zero is a singular point of the DE. Thus the method we have been using does not apply. But if instead of $\sum_{n=0}^{\infty} a_nx^n$ we seek for a solution of the form
\[
y(x)=x^r\sum_{n=0}^{\infty} a_nx^n
=
\sum_{n=0}^{\infty} a_nx^{n+r},
\]
then the ``bad terms'' $\frac{1}{x}$ and $\frac{1}{x^2}$ in $p(x)$ and $q(x)$ will cancel with $x^r$, provided we choose $r$ appropriately. Let us try this. Compute
\[
y'(x)=\sum_{n=0}^{\infty}(n+r)a_nx^{n+r-1},
\qquad
y''(x)=\sum_{n=0}^{\infty}(n+r)(n+r-1)a_nx^{n+r-2}.
\]
Plugging in:
\[
(x+2)x^2\sum_{n=0}^{\infty}(n+r)(n+r-1)a_nx^{n+r-2}
-
x\sum_{n=0}^{\infty}(n+r)a_nx^{n+r-1}
+
(1+x)\sum_{n=0}^{\infty}a_nx^{n+r}
=0,
\]
\[
\sum_{n=0}^{\infty}(n+r)(n+r-1)a_nx^{n+r+1}
+
\sum_{n=0}^{\infty}2(n+r)(n+r-1)a_nx^{n+r}
-
\sum_{n=0}^{\infty}(n+r)a_nx^{n+r}
\]
\[
+
\sum_{n=0}^{\infty}a_nx^{n+r}
+
\sum_{n=0}^{\infty}a_nx^{n+r+1}
=0.
\]
We group the first and last (those in powers of $x^{n+r+1}$) and the second, third, and fourth sums, so
\[
\sum_{n=0}^{\infty}\bigl((n+r)(n+r-1)+1\bigr)a_nx^{n+r+1}
+
\sum_{n=0}^{\infty}\bigl(2(n+r)(n+r-1)-(n+r)+1\bigr)a_nx^{n+r}
=0.
\]
The $n=0$ term in the second sum involves $x^r$, whereas all terms in the first sum involve at least $x^{r+1}$ and higher powers, so the $n=0$ term in the second sum cannot cancel with any other power of $x$. Separating this term we find
\[
\bigl(2r(r-1)-r+1\bigr)a_0x^r
+
\sum_{n=0}^{\infty}\bigl((n+r)(n+r-1)+1\bigr)a_nx^{n+r+1}
\]
\[
+
\sum_{n=1}^{\infty}\bigl(2(n+r)(n+r-1)-(n+r)+1\bigr)a_nx^{n+r}
=0.
\]
As mentioned, the term $\bigl(2r(r-1)-r+1\bigr)a_0x^r$ will not cancel with any other term, so it must vanish on its own if we want the left hand side of the equation to be equal to zero. Since we cannot set $a_0=0$ we must choose $r$ such that
\[
2r(r-1)-r+1=0.
\]
This gives $r=1$ or $r=\frac{1}{2}$. For reasons that we will explain later, we take $r=1$. Then, plugging $r=1$ we have
\[
\sum_{n=0}^{\infty}\bigl((n+1)n+1\bigr)a_nx^{n+2}
+
\sum_{n=1}^{\infty}\bigl(2(n+1)n-n\bigr)a_nx^{n+1}
=0.
\]
Shifting the summation index (make $m=n+2$ in the first sum and $\ell=n+1$ in the second one)
\[
\sum_{n=2}^{\infty}\bigl((n-1)(n-2)+1\bigr)a_{n-2}x^n
+
\sum_{n=2}^{\infty}\bigl(2n(n-1)-(n-1)\bigr)a_{n-1}x^n
=0
\]
or
\[
\sum_{n=2}^{\infty}
\left[
\bigl((n-1)(n-2)+1\bigr)a_{n-2}
+
(n-1)(2n-1)a_{n-1}
\right]x^n
=0.
\]
From which we derive the recurrence relation
\[
a_{n-1}
= -\frac{(n-1)(n-2)+1}{(n-1)(2n-1)}\,a_{n-2},
\qquad n\geq 2.
\]
\end{example}

Setting $n=2,3,\dots$ we find
\[
n=2:\quad a_1=-\frac{1}{3}a_0,
\]
\[
n=3:\quad a_2=-\frac{3}{10}a_1=\frac{1}{10}a_0,
\]
\[
n=4:\quad a_3=-\frac{1}{3}a_2=-\frac{1}{30}a_0,
\]
and so on. Thus, recalling that $r=1$, we have
\[
y(x)=\sum_{n=0}^{\infty} a_n x^{n+r}
= a_0 x + a_1 x^2 + a_2 x^3 + a_3 x^4 + \cdots
\]
\[
= a_0\left(x - \frac{1}{3}x^2 + \frac{1}{10}x^3 - \frac{1}{30}x^4 + \cdots \right), \qquad x>0,
\]
where $a_0$ is an arbitrary constant.

\begin{remark}
Strictly speaking, we still have to check the convergence of the above solution; we will state a theorem later on that will deal with this. Note also that we found only one arbitrary constant. Since we need two linearly independent solutions, we see that we are missing one. We will see how to determine a second linearly independent solution later on.
\end{remark}

Let us now see why we choose $r=1$ instead of $r=\tfrac{1}{2}$ in the above example. Let us go back to
\[
\bigl(2r(r-1)-r+1\bigr)a_0 x^r
+ \sum_{n=0}^{\infty} \bigl((n+r)(n+r-1)+1\bigr)a_n x^{n+r+1}
\]
\[
+ \sum_{n=1}^{\infty} \bigl(2(n+r)(n+r-1)-(n+r)+1\bigr)a_n x^{n+r}
=0,
\]
which we can write as
\[
\bigl(2r(r-1)-r+1\bigr)a_0 x^r
+ \sum_{n=1}^{\infty} \bigl((n-1+r)(n+r-2)+1\bigr)a_{n-1} x^{n+r}
\]
\[
+ \sum_{n=1}^{\infty} \bigl(2(n+r)(n+r-1)-(n+r)+1\bigr)a_n x^{n+r}
=0,
\]
or
\[
\bigl(2r(r-1)-r+1\bigr)a_0 x^r
+ \sum_{n=1}^{\infty}
\left[
\bigl((n-1+r)(n+r-2)+1\bigr)a_{n-1}
\right.
\]
\[
\left.
+ \bigl(2(n+r)(n+r-1)-(n+r)+1\bigr)a_n
\right] x^{n+r}
=0.
\]
This gives the recurrence relation
\[
a_n
=
-
\frac{(n-1+r)(n+r-2)+1}{2(n+r)(n+r-1)-(n+r)+1}\, a_{n-1},
\qquad n\geq 1.
\]
If we choose the smallest root, then it may happen that when we consider $n=1,2,3,\dots$, for some value of $n$ we find that $n+r$ is also a root, so that the denominator in the recurrence relation will be zero.

\begin{figure}[H]
\centering
\begin{tikzpicture}[xscale = 1.75]
\draw[->] (-1,0) -- (6,0);
\foreach \x/\lbl in {0/$r_1$, 1/$r_1+1$, 2/$r_1+2$, 3/$r_1+3$}
    \draw (\x,0.1) -- (\x,-0.1) node[below=5pt] {\small \lbl};
\foreach \x/\lbl in {4/$r_1+n = r_2$, 5/$r_2+1$}
    \draw (\x,0.1) -- (\x,-0.1) node[above=5pt, red] {\small \lbl};
\filldraw (0,0) circle (2pt);
\filldraw (5,0) circle (2pt);
\end{tikzpicture}
\caption{Illustration of roots $r_1<r_2$ and their integer shifts. If $r=r_1$, then for some $n$ we may have $r_1+n=r_2$, causing the denominator in the recurrence relation to vanish.}
\end{figure}

\noindent This cannot happen, however, if we take the largest root, since in this case the values $r+n$ will lie "to the right" of both roots.\\\\
In the above example, we have
\[
p(x)=-\frac{1}{x(x+2)}, 
\qquad 
q(x)=\frac{1+x}{x^2(x+2)}.
\]
As we saw, these functions are not analytic at $x=0$. However, if we remove the problem terms $\frac{1}{x}$ from $p(x)$ and $\frac{1}{x^2}$ from $q(x)$ by multiplying them by $x$ and $x^2$, respectively, we find
\[
x\,p(x)=-\frac{1}{x+2}, 
\qquad 
x^2 q(x)=\frac{1+x}{x+2},
\]
which are analytic at $x=0$. So in particular we can take the limits
\[
\lim_{x\to 0} x p(x) = \lim_{x\to 0} \left(-\frac{1}{x+2}\right)=-\frac{1}{2}, 
\]
\[
\lim_{x\to 0} x^2 q(x) = \lim_{x\to 0} \;\frac{1+x}{x+2}=\frac{1}{2}.
\]
Let us call these values $p_0$ and $q_0$, respectively, i.e., $p_0=-\frac{1}{2}$, $q_0=\frac{1}{2}$. If we look again at the equation that determined $r$, namely
\[
2r(r-1)-r+1=0,
\]
we see that it can be written as
\[
r(r-1) - \frac{1}{2}r + \frac{1}{2} = 0
\quad \text{or} \quad
r(r-1) + p_0 r + q_0 = 0.
\]
This is \textit{not} a coincidence. We will now formalize the method of the previous example and we will see that it will always give an equation of this type for $r$.

\begin{definition}
Let $x_0$ be a singular point of the DE
\[
y'' + p(x)y' + q(x)y = 0.
\]
We say that $x_0$ is a \textbf{regular singular point} if $x p(x)$ and $x^2 q(x)$ are both analytic at $x_0$. Otherwise $x_0$ is called an \textbf{irregular singular point}.
\end{definition}

\begin{definition}
Let $x_0$ be a regular singular point of 
\[
y'' + p(x)y' + q(x)y = 0.
\]
The \textbf{indicial equation} for this point is
\[
r(r-1) + p_0 r + q_0 = 0,
\]
where
\[
p_0 = \lim_{x \to x_0} (x - x_0)p(x), \quad
q_0 = \lim_{x \to x_0} (x - x_0)^2 q(x).
\]
The roots of the indicial equation are called the \textbf{exponents} or \textbf{indices} of $x_0$.
\end{definition}

\subsection{Summary of the method of Frobenius.} Let $x_0$ be a regular singular point of the DE
\[
a_2(x) y'' + a_1(x) y' + a_0(x) y = 0, \qquad x > x_0.
\]
To find a power series solution about $x_0$, proceed as follows.\\\\
(a) Set
\[
p(x) = \frac{a_1(x)}{a_2(x)}, \quad q(x) = \frac{a_0(x)}{a_2(x)}.
\]
Compute
\[
p_0 = \lim_{x \to x_0} x p(x), \quad
q_0 = \lim_{x \to x_0} x^2 q(x)
\]
(if one of these limits does not exist then $x_0$ is not a regular singular point and this method cannot be applied).\\

\noindent (b) Set
\[
y(x) = (x - x_0)^r \sum_{n=0}^{\infty} a_n (x - x_0)^n
= \sum_{n=0}^{\infty} a_n (x - x_0)^{n+r},
\]
where $r$ is to be determined.\\\\
(c) Compute $y'(x)$ and $y''(x)$, and plug $y''(x)$, $y'(x)$, and $y(x)$ into the DE. Shift the summation index and/or rearrange the terms if necessary in order to obtain an equation of the form
\[
\sum_{n=0}^{\infty} A_n (x - x_0)^{n+r+J} = 0,
\]
where $J$ is some fixed number that comes from the procedure of shifting the summation index and/or rearranging the terms. Each $A_n$ is an expression involving $r$, $n$, and $a_n$. Explicitly,
\[
A_0 (x - x_0)^{r+J}
+ A_1 (x - x_0)^{r+J+1}
+ A_2 (x - x_0)^{r+J+2}
+ \cdots = 0.
\]
(d) Set $A_n = 0$, $n=0,1,\dots$. Note that $A_0 = 0$ is just a multiple of the indicial equation:
\[
A_0 = M\bigl(r(r-1) + p_0 r + q_0\bigr) = 0,
\]
where $M$ is a constant.
(In particular if $A_0 = 0$ does not reproduce the indicial equation there is a mistake.)\\\\
(e) Use the equations $A_n = 0$, $n=0,1,\dots$, to find a recurrence relation for the coefficients $a_n$. Note that at this point the recurrence relation involves $r$, which has not yet been determined.\\\\
(f) Solve the indicial equation and take $r = r_1$, where $r_1$ is the larger root of the indicial equation. Use then $r = r_1$ into the recurrence relation of part (e) to determine a recurrence relation for the coefficients $a_n$. If possible, find a pattern for the $a_n$'s.\\\\
(g) A series solution to the DE is given by
\[
y(x) = (x - x_0)^{r_1} \sum_{n=0}^{\infty} a_n (x - x_0)^n
= \sum_{n=0}^{\infty} a_n (x - x_0)^{n+r_1}, \qquad x > x_0,
\]
where $a_0$ is arbitrary. Note that here $r$ is replaced by $r_1$.

\begin{remark}
The above gives one solution to the DE. We will see how to get a second linearly independent solution later on. We will also investigate the convergence of the power series later on. Finally, we will explain why in step (e) we find a recurrence relation for general $r$ and only after that, in step (f), we replace $r$ by $r_1$.
\end{remark}

\begin{example}
Find a power series solution about $x=0$ to the DE
\[
x y'' + 4y' - xy = 0, \qquad x>0.
\]
Let us follow the steps (a)--(g) from above. First, set
\[
p(x) = \frac{4}{x}, \quad q(x) = -\frac{x}{x} = -1,
\]
and consider
\[
x p(x) = 4, \quad x^2 q(x) = -x^2.
\]
These are analytic functions so $x=0$ is a regular singular point. Set
\[
p_0 = \lim_{x \to 0} x p(x) = 4, \quad
q_0 = \lim_{x \to 0} x^2 q(x) = 0.
\]
Set
\[
y(x) = x^r \sum_{n=0}^{\infty} a_n x^n = \sum_{n=0}^{\infty} a_n x^{n+r}.
\]
Compute
\[
y'(x) = \sum_{n=0}^{\infty} (n+r)a_n x^{n+r-1}, \qquad
y''(x) = \sum_{n=0}^{\infty} (n+r)(n+r-1)a_n x^{n+r-2}.
\]
Plugging in:
\[
x \sum_{n=0}^{\infty} (n+r)(n+r-1)a_n x^{n+r-2}
+ 4 \sum_{n=0}^{\infty} (n+r)a_n x^{n+r-1}
- x \sum_{n=0}^{\infty} a_n x^{n+r} = 0,
\]
i.e.,
\[
\sum_{n=0}^{\infty} (n+r)(n+r-1)a_n x^{n+r-1}
+ \sum_{n=0}^{\infty} 4(n+r)a_n x^{n+r-1}
- \sum_{n=0}^{\infty} a_n x^{n+r+1} = 0.
\]
Expanding the first two sums:
\[
r(r-1)a_0 x^{r-1} + (r+1)r a_1 x^r
+ \sum_{n=2}^{\infty} (n+r)(n+r-1)a_n x^{n+r-1}
\]
\[
+ 4r a_0 x^{r-1} + 4(r+1)a_1 x^r
+ \sum_{n=2}^{\infty} 4(n+r)a_n x^{n+r-1}
- \sum_{n=0}^{\infty} a_n x^{n+r+1} = 0.
\]
Shift the summation index in the last sum and group terms in $x^{r-1}$ and $x^r$:
\[
\bigl(r(r-1) + 4r\bigr)a_0 x^{r-1}
+ (r+1)(4+r)a_1 x^r
\]
\[
+ \sum_{n=2}^{\infty} \Bigl[(n+r)(n+r-1) + 4(n+r)\Bigr] a_n x^{n+r-1}
- \sum_{n=2}^{\infty} a_{n-2} x^{n+r-1} = 0.
\]
Grouping the sums:
\[
\bigl(r(r-1) + 4r\bigr)a_0 x^{r-1}
+ (r+1)(4+r)a_1 x^r
+ \sum_{n=2}^{\infty} \Bigl[(n+r)(n+r+3)a_n - a_{n-2}\Bigr] x^{n+r-1} = 0.
\]
Set coefficients to zero to find:
\[
(r(r-1) + 4r)a_0 = 0,
\]
\[
(r+1)(4+r)a_1 = 0,
\]
\[
(n+r)(n+r+3)a_n - a_{n-2} = 0, \qquad n \ge 2.
\]
Since $a_0$ is arbitrary, the first equation gives the indicial equation
\[
r(r-1) + 4r = 0.
\]
Note that this is simply the indicial equation $r(r-1) + p_0r + q_0 = 0$ (as it must be, otherwise there is a mistake). Solving $r(r-1) + 4r = 0$ we find $r=0$ and $r=-3$. Since $(r+1)(4+r) \neq 0$ for both $r=0$ and $r=-3$, the second equation gives $a_1=0$. The third equation gives 
\[
a_n = \frac{a_{n-2}}{(n+r)(n+r+3)}, \qquad n \ge 2.
\]
We now choose r to be the largest root, i.e., $r=0$, so that
\[
a_n = \frac{a_{n-2}}{n(n+3)}, \qquad n \ge 2.
\]
Since $a_1=0$, this recurrence relation implies that all odd coefficients vanish. For even indices:
\[
a_2 = \frac{1}{2\cdot 5} a_0, \quad
a_4 = \frac{1}{4\cdot 7} a_2 = \frac{1}{2\cdot 4 \cdot 5 \cdot 7} a_0,
\]
\[
a_6 = \frac{1}{6\cdot 9} a_4 = \frac{1}{2\cdot 4\cdot 6 \cdot 5 \cdot 7 \cdot 9} a_0, \quad a_8 = \frac{1}{8\cdot 11} a_6 = \frac{1}{2\cdot 4 \cdot 6 \cdot 8 \cdot5 \cdot 7 \cdot 9 \cdot 11} a_0
\]
and so on. We observe the pattern:
\[
a_{2n} = \frac{1}{2\cdot 4 \cdots (2n)} \cdot \frac{1}{5\cdot 7 \cdots (2n+3)} \, a_0
= \frac{1}{2^n n! \, (5\cdot 7 \cdots (2n+3))} a_0, \qquad n \ge 1.
\]
Since $a_{2n+1} = 0, n \geq 0$, we find
\[
y(x) = \sum_{n=0}^{\infty} a_n x^{n}
= a_0 \left(1 + \sum_{n=1}^{\infty} \frac{1}{2^n n! \, (5\cdot 7 \cdots (2n+3))} x^{2n} \right).
\]
\end{example}
The next theorem gives information about the radius of convergence of a solution found via the Frobenius method.

\begin{theorem}
Let $x_0$ be a regular singular point of the DE
\[
a_2(x)y'' + a_1(x)y' + a_0(x)y = 0, \qquad x > x_0.
\]
Let $r_1$ be the largest root of the indicial equation. Then there exists a power series solution of the form
\[
y(x) = \sum_{n=0}^{\infty} a_n (x - x_0)^{n+r_1}
\]
which converges for all $x$ such that
\[
0 < x - x_0 < R,
\]
where $R$ is the distance from $x_0$ to the nearest other singular point (real or complex) of the DE.
\end{theorem}

\section{Finding a second linearly independent solution in the method of Frobenius}

The method of Frobenius seen above gives one solution to the DE. Since the general solution involves two linearly independent solutions, a second linearly independent solution needs to be found.

\begin{theorem}
Let $x_0$ be a regular singular point of the DE
\[
y'' + p(x)y' + q(x)y = 0.
\]
Let $r_1$ and $r_2$ be the roots of the indicial equation, with $r_1 \ge r_2$.

\begin{enumerate}
\item[(a)] If $r_1 - r_2$ is not an integer, then there exist two linearly independent solutions of the form:
\[
y_1(x) = \sum_{n=0}^{\infty} a_n (x-x_0)^{n+r_1}, \qquad a_0 \neq 0,
\]
\[
y_2(x) = \sum_{n=0}^{\infty} b_n (x-x_0)^{n+r_2}, \qquad b_0 \neq 0.
\]

\item[(b)] If $r_1 = r_2$, then there exist two linearly independent solutions of the form
\[
y_1(x) = \sum_{n=0}^{\infty} a_n (x-x_0)^{n+r_1}, \qquad a_0 \neq 0,
\]
\[
y_2(x) = y_1(x)\ln(x-x_0) + \sum_{n=1}^{\infty} b_n (x-x_0)^{n+r_1}.
\]

\item[(c)] If $r_1 - r_2$ is a positive integer, then there exist two linearly independent solutions of the form
\[
y_1(x) = \sum_{n=0}^{\infty} a_n (x-x_0)^{n+r_1}, \qquad a_0 \neq 0,
\]
\[
y_2(x) = A\,y_1(x)\ln(x-x_0) + \sum_{n=0}^{\infty} b_n (x-x_0)^{n+r_2}, \qquad b_0 \neq 0,
\]
where $A$ is a constant (that needs to be determined, i.e., $A$ is not an arbitrary constant, $A$ could turn out to be zero).
\end{enumerate}
\end{theorem}

\begin{remark}
Note that $y_1$ takes the same form in all three cases. $y_1$ is the solution found by the method of Frobenius seen above.
\end{remark}

\begin{remark}
In case (b), the sum in $y_2$ starts at $n=1$ (and not at $n=0$). Also, it is not said that the first coefficient in the series, $b_1$, cannot be zero.
\end{remark}

\begin{remark}
Because any multiple of a solution will also be a solution, $c_1y_1$ and $c_2y_2$, where $c_1$ and $c_2$ are non-zero constants, are two linearly independent solutions as well. The general solution is then $c_1y_1 + c_2y_2$, with $c_1$ and $c_2$ arbitrary constants. Since we can always multiply by arbitrary constants later on, it is sometimes useful to set $a_0$ and $b_0$ to some fixed value (say, $a_0 = 1$, $b_0 = 1$), especially in cases (b) and (c) where we seek to use $y_1$ into $y_2$. Examples below clarify this point.
\end{remark}

\begin{example}
Find the general solution to
\[
(x+2)x^2 y'' - x y' + (1+x)y = 0, \qquad x>0.
\]
We found a power solution to this equation in a previous example. Referring to that example, we had $p_0 = -\tfrac12$ and $q_0 = \tfrac12$, so that the indicial equation is
\[
r(r-1) - \tfrac12 r + \tfrac12 = 0,
\]
giving $r_1 = 1$ and $r_2 = \tfrac12$. We had also found the recurrence relation:
\[
a_n = -\frac{(n-1+r)(n+r-2) + 1}{2(n+r)(n+r-1) - (n+r) + 1}\,a_{n-1}, \qquad n \ge 1.
\]
Because $r_1 - r_2 = 1 - \tfrac12 = \tfrac12$ is not an integer, we are in case (a). The solution corresponding to $r_1 = 1$ was in the retrieved example and reads:
\[
y_1(x) = a_0\left(x - \tfrac13 x^2 + \tfrac1{10}x^3 - \tfrac1{30}x^4 + \cdots\right), \qquad x>0.
\]
Because we can multiply $y_1$ and $y_2$ by arbitrary constants to form the general solution, we can set $a_0 = 1$ above, so
\[
y_1(x) = x - \tfrac13 x^2 + \tfrac1{10}x^3 - \tfrac1{30}x^4 + \cdots.
\]
To find $y_2$, we put $r = r_2 = \tfrac12$ in the recurrence relation to find
\[
b_n = -\frac{(n-\tfrac12)(n-\tfrac32) + 1}{2(n+\tfrac12)(n-\tfrac12) - (n+\tfrac12) + 1}\,b_{n-1}, \qquad n \ge 1,
\]
where we now call the coefficients $b_n$ since they are the coefficients for $r=r_2=\tfrac12$ (the $a_n$'s were the coefficients for $r=r_1=1$).\\\\
Computing the $b_n$'s we find
\[
b_1 = -\tfrac34 b_0, \qquad b_2 = \tfrac{7}{32} b_0, \qquad b_3 = -\tfrac{133}{1920} b_0, \dots,
\]
thus
\[
y_2(x) = \sum_{n=0}^{\infty} b_n x^{n+r_2}
= b_0\left(x^{1/2} - \tfrac34 x^{3/2} + \tfrac{7}{32}x^{5/2} - \tfrac{133}{1920}x^{7/2} + \cdots\right), \qquad x>0.
\]
As with $a_0$, we can set $b_0 = 1$ so
\[
y_2(x) = x^{1/2} - \tfrac34 x^{3/2} + \tfrac{7}{32}x^{5/2} - \tfrac{133}{1920}x^{7/2} + \cdots.
\]
The general solution is then
\[
y(x) = c_1 y_1(x) + c_2 y_2(x), \qquad x>0.
\]
\end{example}
\begin{remark}
The previous example shows why it is advantageous to first derive the recurrence relation for a general $r$, plugging a specific value of $r$ only later on: we already have a formula that we can use for $r_1$ and $r_2$. If we replace $r_1$ at the very beginning, and thus we need a recurrence relation for $r_2$, we have to rederive it again.
\end{remark}

\begin{example}
Find the general solution to
\[
x y'' + 4y' - xy = 0, \qquad x>0.
\]
We studied this equation in a previous example, finding $r_1 = 0$, $r_2 = -3$, and
\[
y_1(x) = a_0\left(1 + \sum_{n=1}^{\infty} \frac{1}{2^n n! \, 5\cdot 7 \cdots (2n+3)} x^{2n}\right).
\]
Because $r_1 - r_2 = 0 - (-3) = 3$ is a positive integer, we are in case (c). Therefore, $y_2$ has the form
\begin{align*}
y_2(x) = A y_1(x)\ln x + \sum_{n=0}^{\infty} b_n x^{n+r_2}\\
= A y_1(x)\ln x + \sum_{n=0}^{\infty} b_n x^{n-3}.
\end{align*}
To find $y_2$ we need to determine the coefficients $A$ and $b_n$. This is done by plugging $y_2$ into the equation to find recurrence relations between $A$ and the $b_n$'s. Because $y_2$ involves $y_1$, and $y_1$ has the arbitrary constant $a_0$, it is convenient to set $a_0 = 1$ to simplify the computations. As we said above, we can always multiply $y_1$ by an arbitrary constant later on.\\\\
Computing,
\[
y_2' = A y_1'\ln x + A y_1 \frac{1}{x} + \sum_{n=0}^{\infty} (n-3)b_n x^{n-4},
\]
\[
y_2'' = A y_1''\ln x + 2A y_1'\frac{1}{x} - A y_1 \frac{1}{x^2} + \sum_{n=0}^{\infty} (n-3)(n-4)b_n x^{n-5}.
\]
Plugging in:
\[
x\Big(\color{blue}A y_1''\ln x \color{black}+ 2A y_1'\frac{1}{x} - \color{orange}A y_1 \frac{1}{x^2} \color{black}+ \sum_{n=0}^{\infty} (n-3)(n-4)b_n x^{n-5}\Big)
\]
\[
+ 4\Big(\color{blue}A y_1'\ln x \color{black}+\color{orange} A y_1 \frac{1}{x} \color{black}+ \sum_{n=0}^{\infty} (n-3)b_n x^{n-4}\Big)
- x\Big(\color{blue}A y_1\ln x \color{black}+ \sum_{n=0}^{\infty} b_n x^{n-3}\Big) = 0.
\]
Rearranging the terms:
\[
A\ln x (x y_1'' + 4y_1' - x y_1)
+ 2A y_1' + 3A \frac{y_1}{x}
+ x \sum_{n=0}^{\infty} (n-3)(n-4)b_n x^{n-5}
\]
\[
+ 4 \sum_{n=0}^{\infty} (n-3)b_n x^{n-4}
- x\sum_{n=0}^{\infty} b_n x^{n-3} = 0, \text{ or}
\]
\[
A\ln x (x y_1'' + 4y_1' - x y_1)
+ 2A y_1' + 3A \frac{y_1}{x}
+ \sum_{n=0}^{\infty} (n-3)(n-4)b_n x^{n-4}
\]
\[
+ \sum_{n=0}^{\infty} 4(n-3)b_n x^{n-4}
- \sum_{n=0}^{\infty} b_n x^{n-2} = 0.
\]
The parenthesis in the first term vanishes because $y_1$ is a solution, i.e.,
\[
x y_1'' + 4y_1' - x y_1 = 0,
\]
so
\[
2A y_1' + 3A \frac{y_1}{x}
+ \sum_{n=0}^{\infty} (n-3)(n-4)b_n x^{n-4}
+ \sum_{n=0}^{\infty} 4(n-3)b_n x^{n-4}
- \sum_{n=0}^{\infty} b_n x^{n-2} = 0.
\]
Expanding the first two sums:
\[
2A y_1' + 3A \frac{y_1}{x}
+ 12 b_0 x^{-4} + 6 b_1 x^{-3} + \sum_{n=2}^{\infty} (n-3)(n-4)b_n x^{n-4}
\]
\[
- 12 b_0 x^{-4} - 8 b_1 x^{-3} + \sum_{n=2}^{\infty} 4(n-3)b_n x^{n-4}
- \sum_{n=0}^{\infty} b_n x^{n-2} = 0.
\]
Shifting the summation index in the first two sums and grouping the terms in $b_1x^{-3}$:
\[
2A y_1' + 3A \frac{y_1}{x} - 2 b_1 x^{-3}
+ \sum_{n=0}^{\infty} (n-1)(n-2)b_{n+2} x^{n-4}
\]
\[
+ \sum_{n=0}^{\infty} 4(n-1)b_{n+2} x^{n-4}
- \sum_{n=0}^{\infty} b_n x^{n-2} = 0,
\]
or, grouping the sums,
\[
2A y_1' + 3A \frac{y_1}{x} - 2 b_1 x^{-3}
+ \sum_{n=0}^{\infty} \big[(n-1)(n+2)b_{n+2} - b_n\big] x^{n-2} = 0.
\]
Next, we plug in $y_1$ (recall that we set $a_0 = 1$):
\[
2A\left(1 + \sum_{n=1}^{\infty} \frac{1}{2^n n! \, 5\cdot 7 \cdots (2n+3)} x^{2n}\right)'
+ 3A\left(1 + \sum_{n=1}^{\infty} \frac{1}{2^n n! \, 5\cdot 7 \cdots (2n+3)} x^{2n}\right)\frac{1}{x}
\]
\[
- 2 b_1 x^{-3}
+ \sum_{n=0}^{\infty} \big[(n-1)(n+2)b_{n+2} - b_n\big] x^{n-2} = 0.
\]

\[
2A \sum_{n=1}^{\infty} \frac{2n}{2^n n! \, 5\cdot 7 \cdots (2n+3)} x^{2n-1}
+ \frac{3A}{x}
+ \sum_{n=1}^{\infty} \frac{3A}{2^n n! \, 5\cdot 7 \cdots (2n+3)} x^{2n-1}
\]
\[
- 2 b_1 x^{-3}
+ \sum_{n=0}^{\infty} \big[(n-1)(n+2)b_{n+2} - b_n\big] x^{n-2} = 0.
\]
Combining the first two sums,
\[
- 2 b_1 x^{-3} + 3A x^{-1}
+ \overbrace{\sum_{n=1}^{\infty} \frac{(4n+3)A}{2^n n! \, 5\cdot 7 \cdots (2n+3)} x^{2n-1}}
+ \sum_{n=0}^{\infty} \big[(n-1)(n+2)b_{n+2} - b_n\big] x^{n-2} = 0.
\]
We need to combine powers of $x$, so we expand the sums:
\begin{align*}
- 2 b_1 x^{-3} + \color{orange}3A x^{-1}\color{black}
+ \overbrace{\color{red}\frac{7A}{2\cdot 1! \cdot 5} x
\color{black}+\color{green} \frac{11A}{2^2 \cdot 2! \cdot 5\cdot 7} x^3 \color{black}+ \cdots}\\
+ (-2b_2 - b_0)x^{-2}
+ \color{orange}(0b_3 - b_1)x^{-1}
\color{black} + (4b_4 - b_2)x^{0}
+ \color{red}(10b_5 - b_3)x^{1}\\
+ (18b_6 - b_4)x^{2}
+ \color{green}(28b_7 - b_5)x^{3} + \cdots  
\end{align*}
Combining the same powers of $x$ and setting the coefficients equal to zero, we find:
\begin{align*}
x^{-3}&:\quad -2b_1 = 0\\
x^{-2}&:\quad -2b_2 - b_0 = 0\\
x^{-1}&:\quad 3A + 0b_3 - b_1 = 3A - b_1 = 0\\
x^{0}&:\quad 4b_4 - b_2 = 0\\
x^{1}&:\quad \frac{7A}{2^1 \cdot 1! \cdot 5} + 10b_5 - b_3 = \frac{7A}{10} + 10b_5 - b_3 = 0\\
x^{2}&:\quad 18b_6 - b_4 = 0\\
x^{3}&:\quad \frac{11A}{2^2 \cdot 2! \cdot 5 \cdot 7} + 28b_7 - b_5
= \frac{11A}{280} + 28b_7 - b_5 = 0
\end{align*}
Solving these equations we find
\[
b_1 = 0
\]
\[
b_2 = -\frac{1}{2}b_0
\]
\[
3A - b_1 = 3A = 0 \;\Rightarrow\; A = 0
\]
\[
b_4 = \frac{1}{4}b_2 = -\frac{1}{8}b_0
\]
\[
\frac{7A}{10} + 10b_5 - b_3 = 10b_5 - b_3 = 0 \;\Rightarrow\; b_5 = \frac{1}{10}b_3
\]
\[
b_6 = \frac{1}{18}b_4 = -\frac{1}{144}b_0
\]
\[
\frac{11A}{280} + 28b_7 - b_5 = 28b_7 - b_5 = 0 \;\Rightarrow\; b_7 = \frac{1}{28}b_5 = \frac{1}{280}b_3
\]
We know that $b_0$ is arbitrary, but note that the above relations do not determine $b_3$ either, so $b_3$ is also arbitrary. We conclude
\[
y_2 = \underbrace{A}_{=0} y_1 \ln x + \sum_{n=0}^{\infty} b_n x^{n-3}
= b_0 x^{-3} + \underbrace{b_1}_{=0} x^{-2} + b_2 x^{-1} + b_3 x^0
\]
\[
+ b_4 x + b_5 x^2 + b_6 x^3 + b_7 x^4 + \cdots
\]
\[
= b_0 x^{-3} - \frac{1}{2}b_0 x^{-1} + b_3 x^0 - \frac{1}{8}b_0 x + \frac{1}{10}b_3 x^2 - \frac{1}{144}b_0 x^3
+ \frac{1}{280}b_3 x^4 + \cdots
\]
\[
= b_0\left(x^{-3} - \frac{1}{2}x^{-1} - \frac{1}{8}x - \frac{1}{144}x^3 - \cdots\right)
+ b_3\left(1 + \frac{1}{10}x^2 + \frac{1}{280}x^4 + \cdots\right).
\]
The general solution is then given by
\[
y(x) = c_1 y_1(x) + c_2 y_2(x).
\]
\end{example}

\begin{remark}
Because $b_0$ and $b_3$ in $y_2$ are arbitrary, it seems that we ended up with three arbitrary constants in $y$ ($c_1$, $c_2b_0$, and $c_2b_3$), while we know that we should have only two arbitrary constants. Upon closer inspection we see that
\[
1 + \frac{1}{10}x^2 + \frac{1}{280}x^4 + \cdots = y_1(x),
\]
so this term in $y_2$ can be grouped with $y_1$ (alternatively, we can set $b_3 = 0$).
\end{remark}

\begin{example}
Knowing that
\[
y_1(x) = \sum_{n=0}^{\infty} \frac{1}{(n!)^2} x^{n+1}
\]
is a solution to
\[
x^2 y'' - x y' + (1-x)y = 0, \quad x>0,
\]
find a second, linearly independent solution.\\\\
First we need to verify that the method given above can be applied. Set
\[
p(x) = -\frac{x}{x^2} = -\frac{1}{x}, \quad q(x) = \frac{1-x}{x^2}.
\]
Because $y_1$ is given as a power series centered at $x=0$, we want to find $y_2$ also as a power series centered at $x=0$. $p(x)$ and $q(x)$ are not analytic at zero, but
\[
xp(x) = -1, \quad x^2 q(x) = 1-x
\]
are, so zero is a regular singular point and the above method can be applied.\\\\
Compute
\[
p_0 = \lim_{x\to 0} x p(x) = -1, \quad q_0 = \lim_{x\to 0} x^2 q(x) = 1,
\]
so the indicial equation reads
\[
r(r-1) + p_0 r + q_0 = r(r-1) - r + 1 = 0,
\]
which has $r=1$ as a double root. We are therefore in case (b) and we seek $y_2$ in the form
\[
y_2(x) = y_1(x)\ln x + \sum_{n=1}^{\infty} b_n x^{n+1}.
\]
Compute
\[
y_2' = y_1' \ln x + y_1 \frac{1}{x} + \sum_{n=1}^{\infty} (n+1)b_n x^n,
\]
\[
y_2'' = y_1'' \ln x + 2y_1' \frac{1}{x} - y_1 \frac{1}{x^2} + \sum_{n=1}^{\infty} n(n+1)b_n x^{n-1}=0
\]
Plugging in:
\[
x^2\left(y_1'' \ln x + 2y_1' \frac{1}{x} - y_1 \frac{1}{x^2} + \sum_{n=1}^{\infty} n(n+1)b_n x^{n-1}\right)
\]
\[
- x\left(y_1' \ln x + y_1 \frac{1}{x} + \sum_{n=1}^{\infty} (n+1)b_n x^n\right)
+ (1-x)\left(y_1(x)\ln x + \sum_{n=1}^{\infty} b_n x^{n+1}\right)=0.
\]
\[
\ln x \left( \underbrace{x^2 y_1'' - x y_1' + (1-x)y_1}_{=0} \right) + 2x y_1' - 2y_1 + \sum_{n=1}^{\infty} n(n+1)b_n x^{n+1}
\]
\[
- \sum_{n=1}^{\infty} (n+1)b_n x^{n+1} + \sum_{n=1}^{\infty} b_n x^{n+1} - \sum_{n=1}^{\infty} b_n x^{n+2} = 0.
\]
Expanding the first three sums:
\[
2x y_1' - 2y_1 + 2b_1 x^2 + \sum_{n=2}^{\infty} n(n+1)b_n x^{n+1}
- 2b_1 x^2 - \sum_{n=2}^{\infty} (n+1)b_n x^{n+1}
\]
\[
+ b_1 x^2 + \sum_{n=2}^{\infty} b_n x^{n+1}
- \sum_{n=1}^{\infty} b_n x^{n+2} = 0.
\]
We combine the first three sums:
\[
2x y_1' - 2y_1 + b_1 x^2 + \sum_{n=2}^{\infty} n^2 b_n x^{n+1}
- \sum_{n=1}^{\infty} b_n x^{n+2} = 0.
\]
Shifting the summation index in the first sum:
\[
2x y_1' - 2y_1 + b_1 x^2 + \sum_{n=1}^{\infty} (n+1)^2 b_{n+1} x^{n+2}
- \sum_{n=1}^{\infty} b_n x^{n+2} = 0,
\]
or
\[
2x y_1' - 2y_1 + b_1 x^2 + \sum_{n=1}^{\infty} \left[(n+1)^2 b_{n+1} - b_n \right] x^{n+2} = 0.
\]
Plugging $y_1$:
\[
2x \left(\sum_{n=0}^{\infty} \frac{1}{(n!)^2} x^{n+1}\right)' - 2 \sum_{n=0}^{\infty} \frac{1}{(n!)^2} x^{n+1}
+ b_1 x^2
\]
\[
+ \sum_{n=1}^{\infty} \left[(n+1)^2 b_{n+1} - b_n \right] x^{n+2} = 0.
\]
\[
\sum_{n=0}^{\infty} \frac{2(n+1)}{(n!)^2} x^{n+1}
- \sum_{n=0}^{\infty} \frac{2}{(n!)^2} x^{n+1}
+ b_1 x^2
+ \sum_{n=1}^{\infty} \left[(n+1)^2 b_{n+1} - b_n \right] x^{n+2} = 0.
\]
Combining the first two sums:
\[
\sum_{n=0}^{\infty} \frac{2n}{(n!)^2} x^{n+1}
+ b_1 x^2
+ \sum_{n=1}^{\infty} \left[(n+1)^2 b_{n+1} - b_n \right] x^{n+2} = 0.
\]
Expanding the first sum:
\[
\frac{2\cdot 0}{(0!)^2}x + \frac{2}{(1!)^2}x^2 + \sum_{n=2}^{\infty} \frac{2n}{(n!)^2} x^{n+1}
+ b_1 x^2
+ \sum_{n=1}^{\infty} \left[(n+1)^2 b_{n+1} - b_n \right] x^{n+2} = 0.
\]
Grouping the terms in $x^2$ and shifting the summation index in the first sum:
\[
(2 + b_1)x^2 + \sum_{n=1}^{\infty} \frac{2(n+1)}{((n+1)!)^2} x^{n+2}
+ \sum_{n=1}^{\infty} \left[(n+1)^2 b_{n+1} - b_n \right] x^{n+2} = 0,
\]
or
\[
(2 + b_1)x^2 + \sum_{n=1}^{\infty} \left[
\frac{2(n+1)}{((n+1)!)^2} + (n+1)^2 b_{n+1} - b_n
\right] x^{n+2} = 0.
\]
Setting the coefficients equal to zero:
\[
2 + b_1 = 0 \;\Rightarrow\; b_1 = -2,
\]
\[
\frac{2(n+1)}{((n+1)!)^2} + (n+1)^2 b_{n+1} - b_n = 0
\;\Rightarrow\;
b_{n+1} = \frac{b_n}{(n+1)^2} - \frac{2}{(n+1)((n+1)!)^2}, \quad n \ge 1.
\]
Computing:
\[
b_2 = -\frac{2}{2^2} - \frac{2}{2(2!)^2} = -\frac{3}{4}, \quad
b_3 = -\frac{3}{4}\cdot\frac{1}{3^2} - \frac{2}{3(3!)^2} = -\frac{11}{108}, \;\text{and so on.}
\]
Thus
\[
y_2(x) = y_1(x)\ln x + \sum_{n=1}^{\infty} b_n x^{n+1}
= y_1(x)\ln x - 2x^2 - \frac{3}{4}x^3 - \frac{11}{108}x^4 + \cdots.
\]
\end{example}

\section{Special functions}

There are a few equations that occur frequently in physics and engineering and whose solutions, given as power series, are studied in detail. Such solutions are known as \textit{special functions}. Here we briefly investigate some of them.

\subsection{Legendre's equation}

The DE
\[
(1 - x^2)y'' - 2xy' + \ell(\ell+1)y = 0,
\]
where $\ell \in \{0,1,2,\dots\}$ is a fixed parameter, is called Legendre's equation. We can verify that $x=1$ is a regular singular point, thus we can find power series solutions about $x=1$. The indicial equation is
\[
r(r-1) + r = 0
\]
which has $r_1 = r_2 = 0$ as roots. To find a solution $y_1(x)$, we write
\[
y_1(x) = \sum_{n=0}^{\infty} a_n (x-1)^{n+0} = \sum_{n=0}^{\infty} a_n (x-1)^n.
\]
Applying the Frobenius method we find
\[
y_1(x) = 1 + \sum_{n=1}^{\infty}
\frac{(-\ell)_n (\ell+1)_n}{n!(1)_n}
\left(\frac{x-1}{2}\right)^n,
\]
where for a non-negative integer $\ell$
\[
(\ell)_n = \ell(\ell+1)(\ell+2)\cdots(\ell+n-1), \quad n \ge 1,
\]
\[
(\ell)_0 = 1, \quad \ell \ne 0,
\]
\[
(-\ell)_n = (-\ell)(-\ell+1)(-\ell+2)\cdots(-\ell+n-1),
\]
and we set $a_0 = 1$.\\\\
Note that $(-\ell)_n$ will be zero for $n \ge \ell + 1$. Thus $y_1(x)$ is a \textit{polynomial of degree} $\ell$. For each $\ell$, the solution $y_1(x)$ is known as the \textbf{Legendre polynomial} of degree $\ell$, denoted $P_\ell(x)$:
\[
P_\ell(x) = 1 + \sum_{n=1}^{\ell} \frac{(-\ell)_n (\ell+1)_n}{n!(1)_n} \left(\frac{x-1}{2}\right)^n.
\]
We can rewrite $P_\ell$ in powers of $x$, obtaining:
\[
P_\ell(x) = 2^{-\ell} \sum_{n=0}^{\lfloor \ell/2 \rfloor}
\frac{(-1)^n (2\ell - 2n)!}{(\ell-n)! \, n! \, (\ell-2n)!} x^{\ell-2n},
\]
where $\lfloor \ell/2 \rfloor$ is the greatest integer less than or equal to $\ell/2$. E.g.,
\[
\left\lfloor \frac{7}{2} \right\rfloor = 3, \quad \left\lfloor \frac{8}{2} \right\rfloor = 4.
\]
The first Legendre polynomials are
\[
P_0(x) = 1, \quad P_1(x) = x, \quad P_2(x) = \frac{3}{2}x^2 - \frac{1}{2}.
\]
The Legendre polynomials enjoy the following property, known as \textbf{orthogonality condition}, often used in applications:
\[
\int_{-1}^{1} P_\ell(x) P_m(x)\, dx = 0 \quad \text{for } \ell \ne m.
\]
To prove this, we first rewrite Legendre's equation for $P_\ell$ and $P_m$ as
\[
\big((1-x^2)P_\ell'(x)\big)' + \ell(\ell+1)P_\ell(x) = 0,
\]
\[
\big((1-x^2)P_m'(x)\big)' + m(m+1)P_m(x) = 0.
\]
Multiplying the first equation by $P_m(x)$, the second by $P_\ell(x)$, and subtracting:
\[
P_m(x)\big((1-x^2)P_\ell'(x)\big)' - P_\ell(x)\big((1-x^2)P_m'(x)\big)'
+ \ell(\ell+1)P_\ell(x)P_m(x) - m(m+1)P_\ell(x)P_m(x) = 0.
\]
We have that
\[
\big((1-x^2)(P_m(x)P_\ell'(x) - P_\ell(x)P_m'(x))\big)' 
= P_m(x)\big((1-x^2)P_\ell'(x)\big)' - P_\ell(x)\big((1-x^2)P_m'(x)\big)',
\]
so that
\[
\big((1-x^2)(P_m(x)P_\ell'(x) - P_\ell(x)P_m'(x))\big)'
= \underbrace{(m^2 - \ell^2 + m - \ell)}_{= (m-\ell)(m+\ell+1) } P_\ell(x)P_m(x).
\]
Thus
\[
\big((1-x^2)(P_m(x)P_\ell'(x) - P_\ell(x)P_m'(x))\big)'
= (m-\ell)(m+\ell+1) P_\ell(x)P_m(x).
\]
We now integrate from $-1$ to $1$:
\[
\int_{-1}^{1} \big((1-x^2)(P_m(x)P_\ell'(x) - P_\ell(x)P_m'(x))\big)' dx
= (m-\ell)(m+\ell+1)\int_{-1}^{1} P_\ell(x)P_m(x)\, dx.
\]
The integral on the left hand side gives
\[
(1-x^2)(P_m(x)P_\ell'(x) - P_\ell(x)P_m'(x))\Big|_{-1}^{1} = 0,
\]
so
\[
(m-\ell)(m+\ell+1)\int_{-1}^{1} P_\ell(x)P_m(x)\, dx = 0.
\]
If $m \ne \ell$, then $(m-\ell)(m+\ell+1) \ne 0$ (recall that $m,\ell \ge 0$), thus
\[
\int_{-1}^{1} P_\ell(x)P_m(x)\, dx = 0, \quad m \ne \ell,
\]
as desired.\\\\
One can show that the Legendre polynomials also satisfy the following recurrence formula:
\[
(\ell+1)P_{\ell+1}(x) = (2\ell+1)xP_\ell(x) - \ell P_{\ell-1}(x),
\]
and the following formula, known as Rodrigues' formula:
\[
P_\ell(x) = \frac{1}{2^\ell \ell!} \frac{d^\ell}{dx^\ell}(x^2 - 1)^\ell.
\]
\subsection{Bessel's equation}

The DE
\[
x^2 y'' + x y' + (x^2 - \nu^2)y = 0,
\]
where $\nu \ge 0$ is a fixed parameter, is known as \textbf{Bessel's equation}.
$x=0$ is a regular singular point and the indicial equation is
\[
r(r-1) + r - \nu^2 = 0,
\]
with roots $r_1 = \nu$, $r_2 = -\nu$. If $r_1 - r_2 = 2\nu$ is not an integer, two
linearly independent solutions are
\[
y_1(x) = a_0 \sum_{n=0}^{\infty} \frac{(-1)^n}{2^{2n} n!(1+\nu)_n} x^{2n+\nu},
\]
\[
y_2(x) = b_0 \sum_{n=0}^{\infty} \frac{(-1)^n}{2^{2n} n!(1-\nu)_n} x^{2n-\nu}.
\]
Using the relation
\[
(t)_n = \frac{\Gamma(t+n)}{\Gamma(t)},
\]
where $\Gamma$ is the Gamma function, and choosing
\[
a_0 = \frac{1}{2^\nu \Gamma(1+\nu)}, \qquad
b_0 = \frac{1}{2^{-\nu} \Gamma(1-\nu)},
\]
we can write the two linearly independent solutions as
\[
J_\nu(x) = \sum_{n=0}^{\infty} \frac{(-1)^n}{n! \, \Gamma(1+\nu+n)} \left(\frac{x}{2}\right)^{2n+\nu},
\]
and
\[
J_{-\nu}(x) = \sum_{n=0}^{\infty} \frac{(-1)^n}{n! \, \Gamma(1-\nu+n)} \left(\frac{x}{2}\right)^{2n-\nu}.
\]
These expressions converge for all $0 < x < \infty$. $J_\nu$ is known as
the \textbf{Bessel function of the first kind of order $\nu$}. $J_{-\nu}$ is then the Bessel
function of the first kind of order $-\nu$.\\\\
If $r_1 - r_2 = 2\nu$ is not an integer, or if $r_1 - r_2 = 2\nu$ is an
integer but $r_1 = \nu$ is not, then $J_\nu$ and $J_{-\nu}$ are linearly independent.\\\\
It remains to analyze the case when $\nu = \ell$ is a non-negative
integer. In this case, plugging $\nu = \ell$ in $J_\nu$ and $J_{-\nu}$ we find
\[
J_{-\ell}(x) = (-1)^\ell J_\ell(x),
\]
so they are linearly dependent. We can find a second linearly
independent solution using the methods we have learned, but here we present
an alternative approach. For $\nu$ not an integer, we define
\[
Y_\nu(x) = \frac{\cos(\nu\pi) J_\nu(x) - J_{-\nu}(x)}{\sin(\nu\pi)}, \quad x>0.
\]
$Y_\nu$ is known as the \textbf{Bessel function of the second kind of order $\nu$}.
Note that $J_\nu$ and $Y_\nu$ are linearly independent.\\\\
The above definition is for $\nu$ not an integer. If $\nu$ is
an integer, both the denominator and the numerator of $Y_\nu(x)$ vanish.
Thus, we expect that we can use L'Hôpital's rule to define $Y_\ell$,
$\ell$ a non-negative integer, by
\[
Y_\ell(x) = \lim_{\nu \to \ell}
\frac{\cos(\nu\pi) J_\nu(x) - J_{-\nu}(x)}{\sin(\nu\pi)}.
\]
Since $Y_\nu$ and $J_\nu$ are linearly independent, we expect that $Y_\ell$
will give a second linearly independent solution when $\nu = \ell$. One can show
that this is indeed the case, i.e., $Y_\ell(x)$ given by the above limit
is well-defined and is a second, linearly independent solution.\\\\
Special functions, such as the Legendre polynomials and Bessel's
functions, are of great importance in physics and engineering. Here
we only mentioned them for general knowledge. See the textbook for
more details.

\bibliographystyle{plain}
\end{document}

