# Variable matrices If I type

sage: M = matrix(SR, 2, var('a,b,c,d'))
sage: show(~M)


it gives me the inverse of the matrix M with entries in terms of a, b, c, d.

Now what I want is to set four variable matrices A, B, C, D, each of size 2x2, and then I want to create the block matrix

sage: N = block_matrix([[A, B], [C, D]])


Finally I want some functions of N in terms of A, B, C, D.

For example, how can I get det(N) in terms of A, B, C, D?

edit retag close merge delete

You want $\det N$ in terms of $\det A$, ..., $\det D$? SageMath is unable to give you this to the best of my knowledge. Note that it is not suprising: There is no such expression in a very general case. Only if some matrix is known to be invertible, or some matrices commute, etc. See on Wikipedia.
Now in your case of $2\times 2$ blocks, you may of course define $16$ variables $a_{11}$, ..., $a_{22}$, ..., $d_{22}$ and ask for this $16\times 16$ determinant. Then, you can try to reconstruct some expression based on the four $2\times 2$ determinants. But you'll need to have some assumptions at some point I guess.