Gaussian Elimination and Tridiagonal matrices, project 1

Suppose we want to solve the following boundary value equation $$ -\frac{d^2u(x)}{dx^2} = f(x,u(x)), $$ with \( x\in (a,b) \) and with boundary conditions \( u(a)=u(b) = 0 \). We assume that \( f \) is a continuous function in the domain \( x\in (a,b) \). Since, except the few cases where it is possible to find analytic solutions, we will seek after approximate solutions, we choose to represent the approximation to the second derivative from the previous chapter $$ f''=\frac{f_h -2f_0 +f_{-h}}{h^2} +O(h^2). $$ We subdivide our interval \( x\in (a,b) \) into \( n \) subintervals by setting \( x_i = ih \), with \( i=0,1,\dots,n+1 \). The step size is then given by \( h=(b-a)/(n+1) \) with \( n\in {\mathbb{N}} \). For the internal grid points \( i=1,2,\dots n \) we replace the differential operator with the above formula resulting in $$ u''(x_i) \approx \frac{u(x_i+h) -2u(x_i) +u(x_i-h)}{h^2}, $$ which we rewrite as $$ u^{''}_i \approx \frac{u_{i+1} -2u_i +u_{i-i}}{h^2}. $$