# What is meant by tridiagonal linear equation system?

I have to implement the SOR (Successive Over-Relaxation) method, using sparse matrices, to find the solution vector of these linear equations systems (for quite huge matrices):

What does that tridiag(-1,3,-1) or tridiag(1,2,1) mean? For the 1st example, what are the -1, 3 and -1? For the 2nd, what does the 1, 2 and 1 mean? Is it a matrix with a diagonal of (-1,3,1) or what could that be?

A tridiagonal $$(a,b,c)$$ is a matrix with upper diagonal terms $$a$$ and the diagonal terms $$b$$ and lower diagonal terms $$c$$
A tridiagonal matrix $$(a,b,c)$$ very probably denotes a matrix with $$b$$s on the diagonal,$$a$$s on the first underdiagonal, $$c$$ on the first overdiagonal and $$0$$ everywhere else, like this: $$\begin{pmatrix} b&c&0&\dots &0&0&0 \\ a&b&c&\dots&0 &0&0\\ 0&a&b&\ddots&0&0 &0\\[-1ex] \vdots&\ddots&\ddots&\ddots&\ddots&\ddots&\vdots \\[-3ex] 0&0&0&\ddots&b&c&0 \\ 0&0&0&\dots&a&b&c \\ 0&0&0&\dots&0&a&b \end{pmatrix}$$
• @ZelelB In your case, the triples $(-1,3,-1)$ and $(1,2,1)$ are symmetric so it's more likely that the $3$ and $2$ (respectively) are intended to go on the diagonal. – Misha Lavrov May 20 at 18:18