Gaussian Elimination and Tridiagonal matrices, project 1

In case your system of equations leads to a tridiagonal matrix, it is clearly an overkill to employ Gaussian elimination or the standard LU decomposition.

Our algorithm starts with forward substitution with a loop over of the elements \( i \) and gives an update of the diagonal elements \( b_i \) given by the new diagonals \( \tilde{b}_i \) $$ \tilde{b}_i= b_i - \frac{a_ic_{i-1}}{\tilde{b}_{i-1}}, $$ and the new righthand side \( \tilde{f}_i \) given by $$ \tilde{f}_i= f_i - \frac{a_i\tilde{f}_{i-1}}{\tilde{b}_{i-1}}. $$ Recall that \( \tilde{b}_1=b_1 \) and \( \tilde{f}_1=f_1 \) always.