# Construct a matrix from blocks of matrices [closed]

I am trying to find eigen values of a matrix system where entries of the matrix are also matrix. This is how my matrix looks:

$$M=\begin{bmatrix} H[j,j] & T[j,j+1] & 0 &0 &...\\ T[j+1,j] & H[j+1,j+1] & T[j+1,j+2] & 0&...\\ 0 &T[j+2,j+1]&H[j+2,j+2]&T[j+2,j+3]&...\\ \vdots&\vdots&\vdots&\vdots&\ddots \end{bmatrix}$$

Here $$H[j,j]=\cos(j)I_{4\times4}$$ is a $$4\times4$$ matrix,

$$I_{4\times4}$$ is a $$4\times4$$ identity matrix, and $$T[j,j+1]=T[j+1,j]=\sin(j)I_{4\times4}$$ ... is also a four by four matrix where $$j$$ goes from $$0$$ to $$10$$. Any help will be appreciated.

• Note that M is the Kronecker product of I (4x4) and a 10x10 matrix of cos and sin terms. Consequently, the eigenvalues are the product of the eigenvalues of the 2 matrices – mikado Aug 6 at 5:44
• Dear @mikado the choices of matrices are just a simplified assumption. My problem is not that simple. In my case the entries are even in off diagonal terms of the matrices. But I have put it there to ask it in a most simplest way. I am expecting to see concatenating type solution of this problem. – Hazoor Imran Aug 6 at 6:14
• What is the Dimensions of M? – Αλέξανδρος Ζεγγ Aug 6 at 6:26
• @ Αλέξανδρος Ζεγγ the dimension of M is $$40\times40$$. – Hazoor Imran Aug 6 at 7:54
• @HazoorImran Now that M is 40-by-40, isn't j from 1 to 10 rather than from 0 to 10? – Αλέξανδρος Ζεγγ Aug 6 at 8:05

I am not sure if I have got your attention properly, but you can see if code below works for you or not,

matM = Module[{block, n = 4, jup = 10},
block[i_, j_] := Which[i == j, Cos[i],
Abs[i - j] == 1, Sin[Min[i, j]],
True, 0
] IdentityMatrix[n];
SparseArray @ ArrayFlatten[Table[block[i, j], {i, (*0,*) jup}, {j, (*0,*) jup}]]
]

• No this does not create the right entries. I have checked it by matrix form. – Hazoor Imran Aug 6 at 7:55
• @HazoorImran So what is not correct? – Αλέξανδρος Ζεγγ Aug 6 at 7:56
• This is creating first four column with entries 1 along diagonal. – Hazoor Imran Aug 6 at 17:46
• @HazoorImran According to the dimension you spoke about, I guess it that j does not take 0 value. How about the code now? – Αλέξανδρος Ζεγγ Aug 7 at 14:31