My program works with tridiagonal matrices (calculates its LU decomposition) so before doing anythig, it stores the matrix in 3 vectors: the three diagonals only. So far my conclusion was, a tridiagonal matrix can only be square because of this storage method, however, any rectangular or square matrix can be diagonal so what about tridiagonal matrices? The existence of the LU decomposition only depends on whether the matrix has an n×n minor that has a determinant that's not 0 so that doesn't exclude rectangular matrices.
I tried searching for some relevant examples but i couldn't find anything; people always show square tridiagonal matrices without explicitly saying in the defnition that a tridiagonal matrix is square.
So can a tridiagonal matrix be rectangular or is it okay if I only work with square matrices in this case?
There's no reason to restrict tridiagonality to square matrices, but you will have a hard time guessing the size of a nonsquare matrix given just the three diagonals. All nonsquare matrices that have the same number of rows and more columns than rows have the same three diagonals, and ditto in the other direction (columns).