# Finite difference method for boundary problem.

Consider the following boundary problem $$\begin{cases} -x''(t)+q(t)x(t)=r(t),\, t \in[t_0,T]\\ \mu x(t_0)-x'(t_0) = \alpha\\ x(T)=\beta \end{cases}$$ where $q,r \in \mathcal{C}([t_0,T]), q(t)\geq 0, \mu \geq 0$. Deduce a Finite Difference method for the problem above that is of order two and show that the system obtained has exactly one solution.

I'd like to know if what I tried is okay (I've always been struggling for BVP's with mixed conditions).

Well, first, for the method to be of order two, assume all necessary regularity conditions for $x(t)$ (I believe $x \in \mathcal{C}^2([t_0,T])$ is enough), and by Taylor we get $$x(t+h) = x(t)+hx`(t)+\frac{h^2}{2}x''(\xi),\; \xi \in (t,t+h)$$ And therefore, for all $t \in (t_0,T)$, $$x'(t) = \frac{x(t+h)-x(t)}{h}-\frac{h}{2}x''(\xi)$$ Consider now, given $N \in \mathbb{N}$ and $h = \frac{T-t_0}{N+1}$ the nodes $t_i = t_0+ih$ for $i = 0, 1, \dots , N+1$. Using the approximation above for the first node $t_0$ and the boundary condition, we get

$$\tag{1} \mu x(t_0)-\frac{x(t_1)-x(t_0)}{h}= \alpha+\frac{h}{2}x''(\xi_0), \; \xi \in (t_0,t_0+h)$$ And using the finite difference approximation $$x''(t_i)=\frac{x(t_{i-1}-2x(t_i)+x(t_{i+1}}{h^2}+\frac{h^2}{12}x^{iv)}(\xi_i),\; \xi_i \in (t_{i-1},t_{i+1})$$ we get for $i= 1, \dots, N$ $$\tag{2}-\frac{x(t_{i-1})-2x(t_i)+x(t_{i+1})}{h^2} + q(t_i)x(t_i)=r(t_i)-\frac{h^2}{12}x^{iv)}(\xi_i)$$ And finally, for the node $t_N$ and using the other boundary condition, we get $$\tag{3}-\frac{x(t_{N-1})-2x(t_N)+\beta}{h^2} + q(t_N)x(t_N)=r(t_N)-\frac{h^2}{12}x^{iv)}(\xi_N)$$ so joining $(1), (2)$ and $(3)$, the system would be as follows $$\begin{cases} \mu x(t_0)-\frac{x(t_1)-x(t_0)}{h}= \alpha+\frac{h}{2}x''(\xi_0)\\ -\frac{x(t_{i-1})-2x(t_i)+x(t_{i+1})}{h^2} + q(t_i)x(t_i)=r(t_i)-\frac{h^2}{12}x^{iv)}(\xi_i)\\ -\frac{x(t_{N-1})-2x(t_N)+\beta}{h^2} + q(t_N)x(t_N)=r(t_N)-\frac{h^2}{12}x^{iv)}(\xi_N) \end{cases}$$

Is the method obtained correct?

I'm only interested in this part even though the problem asks for more, the rest is just tedious operations to convert the system in matrix form and then check if the resulting matrix is invertible. Thank you in advance.

• Looks good to me, but I am not an expert in FDM. Why did you keep the $x''$ and $x^{(iv)}$ terms? – P. Siehr Aug 31 '17 at 7:30
• @P.Siehr Thanks! And do you mean why didn't I write those terms as $O(h)$ or $O(h^2)$? Normally I'd define some error term, say $\tau(t,h)$ and just leave it that way. I don't know what else should I be doing with that. – user313212 Aug 31 '17 at 7:53
• You can ignore that question. I just wondered as I am used to teach FDM slightly different, using an approximation, e.g. $Δ\approx Δ_h=...$. If you are not interested in Error-Estimates, then you don't care too much about these $\mathcal{O}$-terms. I mean, you don't compute them anyway, when solving the linear system. – P. Siehr Aug 31 '17 at 8:05