# testing linear independence for an unknown number of matrices

I would like to test if 16 matrices (4X4) that I created are linearly independent. The straight-forward solution would be to check if the equation

$$\sum_{k=1}^N \alpha_k A_k = 0$$ (1) (N=16 in the current settings)

has a non-trivial solution. The problem is now that these 16 matrices are stored in one matrix with dimennsions 4x64, e.g. the first matrix is saved in colums 1-4, the second in 5-8 and so on. Later, I would like to test the linear independence for a set of 64 8x8 matrices and maybe even for 256 16x16 matrices. Therefore, simply writing down the equation and using a function like Solve is not a solution. Therefore, I would like to be able to somehow generate this equation (1) dynamically, e.g. with a variable N.

I don't even have an idea on how I could implement this.

EDIT: Ok, I tried now to save all the matrices in one list, e.g.

The 16 matrices are saved in NewMatrices

MatrixList= ConstantArray[0, {16, 1}];
For [ii = 1, ii <= 16, ii++,
MatrixList[[ii]] = NewMatrices[[ All, 4*(ii - 1) + 1 ;; 4*ii]];
]

I then tried treating MatrixList as a vector and tried to solve it using

LinearSolve[MatrixList,ConstantArray[0,{4,4}]]

Somehow, this does now work.

• It is enough, ist it? 16x16=256 entries, same as 4x64=256 entries. Apr 15, 2021 at 16:03
• It would help if your provided the matrices in the question. I wasn't entirely sure of the dimensions. Apr 15, 2021 at 16:09
• NullSpace[Flatten/@matrices]=!={} will tell you if there is a dependency. Apr 15, 2021 at 19:22