# 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?

Thank you in advance!

## 2 Answers

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}$$

• Thank you for the answer. But the matrix you've posted isn't what you described with text before: "𝑏's on the diagonal,𝑎's on the first underdiagonal, 𝑐's on the first overdiagonal and 0 everywhere else". What should I take as answer, the text or the matrix posted (the one posted says that a's are on the diagonal, b's on the underdiagonal and c's on the upperdiagonal)? – ZelelB May 20 at 18:16
• @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
• @MishaLavrov Thanks, it makes sense! And same as what Mohammad Riazi said above. However, Bernard text and posted matrix are not concordant.. Just to be sure.. – ZelelB May 20 at 18:23
• Oh! yes. I messed up typing. I'll fix it within seconds. – Bernard May 20 at 18:36