## Boundary value problems: not all explicit solutions are useful

Consider this linear differential equation: ${y''(t) + 4y'(t) + 2t y(t) = 7}$ with boundary conditions ${y(0)=1}$ and ${y(1)=0}$. Nothing looks particularly scary here. Just one nonconstant coefficient, and it’s a simple one. Entering this problem into Wolfram Alpha produces the following explicit solution: I am not sure how anyone could use this formula for any purpose.

Let us see what simple linear algebra can do here. The differential equation can be discretized by placing, for example, ${4}$ equally spaces interior grid points on the interval: ${t_k = k/5}$, ${k=1, \dots, 4}$. The yet-unknown values of ${y}$ at these points are denoted ${y_1,\dots, y_4}$. Standard finite-difference formulas provide approximate values of ${y'}$ and ${y''}$: $y'(t) \approx \frac{y(t+h) - y(t-h)}{2h}$ $y''(t) \approx \frac{y(t+h) - 2y(t) + y(t-h)}{h^2}$

where ${h}$ is the step size, ${1/5}$ in our case. Stick all this into the equation: we get 4 linear equations, one for each interior point. Namely, at ${t_1 = 1/5}$ it is $\frac{y_2 - 2y_1 + 1}{(1/5)^2} + 4 \frac{y_2 - 1}{2/5} + 2\cdot \frac15 y_1 = 7$

(notice how the condition ${y(0)=1}$ is used above), at ${t_2 = 2/5}$ it is $\frac{y_3 - 2y_2 + y_1}{(1/5)^2} + 4 \frac{y_3 - y_1}{2/5} + 2 \cdot \frac25 y_2 = 7$

and so on. Clean up this system and put it in matrix form: $\begin{pmatrix} -49.6 & 35 & 0 & 0 \\ 15 & -49.2 & 35 & 0 \\ 0 & 15 & -48.8 & 35 \\ 0 & 0 & 15 & -48.4 \end{pmatrix} \vec y = \begin{pmatrix} -8 \\ 7 \\ 7 \\ 7 \end{pmatrix}$

This isn’t too hard to solve even with pencil and paper. The solution is $y = \begin{pmatrix} -0.2859 \\ -0.6337\\ -0.5683\\ -0.3207 \end{pmatrix}$

It can be visualized by plotting 4 points ${(t_k, y_k)}$:

Not particularly impressive is it? And why are all these negative y-values in a problem with boundary condition ${y(0)=1}$? They do not really look like they want to approach ${1}$ at the left end of the interval. But let us go ahead and plot them together with the boundary conditions, using linear interpolation in between: