(bvp-chapter)=

# Boundary Value Problems

The ordinary differential equations (ODEs) considered so far have been initial value problems (IVPs), where the value of the solution and, for higher-order equations, its derivatives are specified at a single point in the domain. Another important class of problems are **boundary value problems (BVPs)**, where conditions are specified at the endpoints of the interval. In this chapter, we consider two-point boundary value problems governed by second-order ODEs.

````{prf:definition} General two-point boundary value problem
:label: bvp-definition

A two-point boundary value problem is a second-order ODE together with boundary conditions specified at two distinct points of the domain

$$ y' = f(t,y),\qquad  t\in [t_{0}, t_{\max}],\qquad y(t_{0}) = a ,\qquad y(t_{\max}) = b, $$(bvp-equation)

for some known values $a$ and $b$.
````

(existence-and-uniqueness-of-bvp-solutions-section)=

## Existence and uniqueness of solutions to boundary value problems

For well-posed linear initial value problems satisfying the conditions of the existence and uniqueness theorem, a solution is unique. Boundary value problems behave differently and may possess a unique solution, no solution, or infinitely many solutions. 

To illustrate the different possibilities, consider the following examples.

$$ y'' + 4y = 0, \qquad y(0) = 1, \qquad y\left(\dfrac{\pi}{4}\right) = 2. $$

The general solution to the ODE $y'' + 4y = 0$ is 

$$ y = c_1 \cos(2 t) + c_2 \sin(2 t). $$(bvp-general-solution)

Substituting the boundary values we have 

$$ \begin{align*}
    1 &= c_1 \cos(0) + c_2 \sin(0) = c_1, \\
    2 &= c_1 \cos\left(2\left(\frac{\pi}{4}\right)\right) + c_2 \sin\left(2\left(\frac{\pi}{4}\right)\right) = c_2.
\end{align*} $$

Here we can determine the values of $c_1$ and $c_2$ so this boundary value problem has the unique solution

$$ \begin{align*}
    y = \cos(2t) + 2\sin(2t).
\end{align*} $$

Changing the boundary conditions produces a very different outcome.

$$ \begin{align*}
    y'' + 4y = 0, \qquad y(0) = 1, \qquad y(\pi) = 1.
\end{align*} $$

Substituting the boundary values into equation {eq}`bvp-general-solution` we have

$$ \begin{align*}
    1 &= c_1 \cos(0) + c_2 \sin(0) = c_1, \\
    1 &= c_1 \cos(2\pi) + c_2 \sin(2\pi) = c_1.
\end{align*} $$

Here we have a solution for $c_1$ but we cannot determine the value of $c_2$ so the solution to the boundary value problem is

$$ \begin{align*}
    y = \cos(2t) + c_2 \sin(2t),
\end{align*} $$

where $c_2$ can be any value. So we have infinitely many solutions. 

Finally, a slight modification of the upper boundary condition leads to an inconsistent system

$$ \begin{align*}
    y'' + 4y = 0, \qquad y(0) = 1, \qquad y(\pi) = 2.
\end{align*} $$

and substituting the boundary values equation {eq}`bvp-general-solution` we have

$$ \begin{align*}
    1 &= c_1 \cos(0) + c_2 \sin(0) = c_1, \\
    2 &= c_1 \cos(2\pi) + c_2 \sin(2\pi) = c_1.
\end{align*} $$

Here we have $c_1 = 1$ and $c_1 = 2$ which is a contradiction, so this boundary value problem does not have a solution.


```{prf:theorem} Uniqueness of the solution to boundary value problems
A linear boundary value problem of the form

$$ y'' = p(t)y' + q(t)y + r(t), \qquad t \in [t_0,t_{\max}], \qquad y(t_0) = a , \qquad y(t_{\max}) = b , $$(bvp-uniqueness-equation)

where $p(t)$, $q(t)$ and $r(t)$ are continuous functions on the interval. The boundary value problem has a unique solution provided that the following conditions are satisfied

- $p(t)$, $q(t)$ and $r(t)$ are continuous on $[t_0, t_{\max}]$;
- $q(t) > 0$ for all $t\in [t_0,t_{\max}]$.
```

````{prf:example}
:label: bvp-uniqueness-example

Show that the following boundary value problem has a unique solution

$$ y'' = (t^3 +5)y + \sin (t), \qquad t \in [0,1], \qquad y(0) = 0, \qquad y(1) = 1. $$

```{dropdown} Solution

Comparing this boundary value problem to equation {eq}`bvp-uniqueness-equation` we have

$$ \begin{align*}
    p(t) &= 0,\\
    q(t) &= t^3 + 5,\\
    r(t) &= \sin(t),
\end{align*} $$

which are all continuous on $[0,1]$ and $q(t) > 0$ for all $t\in [0,1]$ so this boundary value problem has a unique solution.
```
````