Solving a tridiagonal linear system