# Finite difference basic operation to solve boundary value problem

I got a question regarding finite difference method to solve boundary value problem on second order derivative equation. This is taken from the "Numerical Methods using MATLAB" by Mathews & Fink. This is the problem from the book:

Solve the boundary value problem:

$$x^{''}(t) = \frac{2t}{1+t^2}x^{'}(t)-\frac{2}{1+t^2}x(t)+1$$

with $$x(0)=1.25$$ and $$x(4)=−0.95$$ over the interval $$[0, 4]$$.

We're supposed to use the following equations to solve it:

$$x^{''}(t) = p(t)x^{'}(t) + q(t)x(t) + r(t)$$

$$(\frac{-h}{2}p_j -1)x_{j-1}+(2+h^2q_j)x_j+(\frac{h}{2}p_j -1)x_{j+1}=-h^2 r_j$$

The book only gives the $$x_j$$ calculation result in a table without any step-by-step calculation. I understand that $$x_1=1.25$$ but I cannot get the result for $$x_2$$, $$x_3$$, etc.

How do we calculate $$x_j$$ using the formula, if we don't know $$x_{j+1}$$ ? The information given is only for the initial and end value of $$x$$, but we need $$x_{3}$$ to calculate $$x_{2}$$.

Please find the screenshot from the book below: • A more detailed screenshot of the book & formula can be seen here imgur.com/a/GR7yiCJ – JIM BOY Oct 31 '18 at 17:13