$\renewcommand{\Re}{\operatorname{Re}}$
$\renewcommand{\Im}{\operatorname{Im}}$
$\newcommand{\erf}{\operatorname{erf}}$
$\newcommand{\dag}{\dagger}$
$\newcommand{\const}{\mathrm{const}}$
$\newcommand{\arcsinh}{\operatorname{arcsinh}}$
##[6.A. Linear second order ODEs](id:sect-6.A)
-----------
> 1. [Introduction](#sect-6.A.1)
> 2. [Cauchy problem (aka IVP)](#sect-6.A.2)
> 3. [BVP](#sect-6.A.3)
> 4. [BVP.II](#sect-6.A.4)
###[Introduction](id:sect-6.A.1)
This is not a required reading but at some moment you would like to see how problems we discuss here for PDEs are solved for ODEs (consider it as a toy-model)
We consider ODE
\begin{equation}
Ly:=y'' + a\_1(x)y + a\_2(x)y'=f(x).
\label{eq-6.A.1}
\end{equation}
Let $\\{y\_1(x),y\_2(x)\\}$ be a fundamental system of solutions of the corresponding homogeneous equation
\begin{equation}
Ly:=y'' + a\_1(x)y + a\_2(x)y'=0).
\label{eq-6.A.2}
\end{equation}
Recall that then Wronskian
\begin{equation}
W(y\_1,y\_2; x):= \left| \begin{matrix} y\_1(x) & y\_2(x)\\\\ y'\_1(x) &y'\_2(x)\end{matrix}\right|
\label{eq-6.A.3}
\end{equation}
does not vanish.
###[Cauchy problem (aka IVP)](id:sect-6.A.2)
Consider equation (\ref{eq-6.A.1}) with the initial conditions
\begin{equation}
y(x\_0)=b\_1, \qquad y'(x\_0)=b\_2.
\label{eq-6.A.4}
\end{equation}
Without any loss of the generality one can assume that
\begin{equation}
\begin{aligned}
&y\_1(x\_0)=1, &&y'\_1(x\_0)=0,\\\\
&y\_2(x\_0)=0, &&y'\_1(x\_0)=1.
\end{aligned}
\label{eq-6.A.5}
\end{equation}
Indeed, replacing $\\{y\_1(x),y\_2(x)\\}$ by $\\{z\_1(x),z\_2(x)\\}$ with $z\_j=\alpha\_{j1}y\_1+\alpha\_{j2}y\_2$ we reach (\ref{eq-6.A.5}) by solving the systems
\begin{align\*}
&\alpha\_{11}y\_1(x\_0)+\alpha\_{12}y\_2(x\_0)=1, &&& &\alpha\_{21}y\_1(x\_0)+\alpha\_{22}y\_2(x\_0)=0\\\\
&\alpha\_{11}y'\_1(x\_0)+\alpha\_{12}y'\_2(x\_0)=0, &&& &\alpha\_{21}y'\_1(x\_0)+\alpha\_{22}y'_2(x\_0)=1
\end{align\*}
which have unique solutions because $W(y\_1,y\_2;x\_0)\ne 0$.
Then the general solution to (\ref{eq-6.A.2}) is $y=C\_1y\_1+C\_2y\_2$ with constants $C\_1,C\_2$. To find the general solution to (\ref{eq-6.A.1}) we apply method of variations of parameters; then
\begin{equation}
\begin{aligned}
&C'\_1y\_1+C'\_2y\_2=0,\\\\
&C'\_1y'\_1+C'\_2y'\_2=f(x)
\end{aligned}
\label{eq-6.A.6}
\end{equation}
and then
\begin{equation}
C'\_1= -\frac{1}{W} y\_2f,\qquad C'\_2= \frac{1}{W} y\_12f
\label{eq-6.A.7}
\end{equation}
and
\begin{equation}
\begin{aligned}
&C\_1(x)= -\int \_{x\_0}^x \frac{1}{W(x')} y\_2(x')f(x')\,dx'+c\_1,\\\\
&C\_2(x)= \ \ \int \_{x\_0}^x \frac{1}{W(x')} y\_1(x')f(x')\,dx'+c\_2
\end{aligned}
\label{eq-6.A.8}
\end{equation}
and
\begin{equation}
y(x)=\int \_{x\_0}^x G(x;x')f(x')\,dx'+b\_1y\_1(x)+b\_2y\_2(x)
\label{eq-6.A.9}
\end{equation}
with
\begin{equation}
G(x;x')=\frac{1}{W(x')} \bigl(y\_2(x)y\_1(x')-y\_1(x)y\_2(x')\bigr)
\label{eq-6.A.10}
\end{equation}
and $c\_1=b\_1$, $c\_2=b\_2$ found from initial data.
Definition 1.
$G(x,x')$ is a *Green function* (called in the case of IVP also *Cauchy function*).
This formula (\ref{eq-6.A.9}) could be rewritten as
\begin{equation}
y(x)=\int \_{x\_0}^x G(x;x')f(x')\,dx'+G'_x(x;x\_0)b\_1 +G(x;x\_0)b\_2.
\label{eq-6.A.11}
\end{equation}
####[BVP](id:sect-6.A.3)
Consider equation (\ref{eq-6.A.1}) with the boundary conditions
\begin{equation}
y(x\_1)=b\_1,\qquad y(x\_2)=b\_2
\label{eq-6.A.12}
\end{equation}
where $x\_1< x\_2$ are the ends of the segment $[x\_1,x\_2]$.
Consider first homogeneous equation (\ref{eq-6.A.2}); then $y=c\_1y\_1+c\_2y\_2$ and (\ref{eq-6.A.12}) becomes
\begin{equation\*}
\begin{aligned}
&c\_1y\_1(x\_1)+c\_2y\_2(x\_1)=b\_1,\\\\
&c\_1y\_1(x\_2)+c\_2y\_2(x\_2)=b\_2
\end{aligned}
\end{equation\*}
and this system is solvable for any $b\_1,b\_2$ and this solution is unique if and only if determinant is not $0$:
\begin{equation}
\left|\begin{matrix} y\_1(x\_1) & y\_2(x\_1)\\\\y\_1(x\_2) & y\_2(x\_2)\end{matrix}\right|\ne 0.
\label{eq-6.A.13}
\end{equation}
Assume that this condition is fulfilled. Then without any loss of the generality one can assume that
\begin{equation}
y\_1(x\_1)=1,\quad y\_1(x\_2)=0, \quad y\_2(x\_1)=0,\quad y\_2(x\_2)=1;
\label{eq-6.A.14}
\end{equation}
otherwise as before we can replace them by their linear combinations. Consider inhomogeneous equation. Solving it by method of variations of parameters we have again (\ref{eq-6.A.7}) but its solution we write in a form slightly different from
(\ref{eq-6.A.8})
\begin{equation}
\begin{aligned}
&C\_1(x)= -\int \_{x\_1}^x \frac{1}{W(x')} y\_2(x')f(x')\,dx'+c\_1,\\\\
&C\_2(x)= -\int \_x^{x\_2} \frac{1}{W(x')} y\_1(x')f(x')\,dx'+c\_2.
\end{aligned}
\label{eq-6.A.15}
\end{equation}
Then
\begin{equation}
y(x)=\int \_{x\_1}^{x\_2} G(x;x')f(x')\,dx'+c\_1y\_1(x)+c\_2y\_2(x)
\label{eq-6.A.16}
\end{equation}
where
\begin{equation}
G(x;x')=-\frac{1}{W(x')} \left\\{\begin{aligned}
&y\_2(x')y\_1(x) && x\_1