Inverse of a symmetric matrix consisting of submatrices is desired.
21 views (last 30 days)
Show older comments
Inverse of a symmetric matrix consisting of submatrices is desired.
N(12x12) and its determinant are non-zero, B1(12x5), B1(12x4), C1(2x5) C1(2x4) are dimensional submatrices. Can someone inverse this matrix? T denotes transpose of matrix
N 0 B1 B2
0 0 C1 C2
B1T C1T 0 0
B2T C2T 0 0
14 Comments
Torsten
on 8 Mar 2024
Moved: John D'Errico
on 9 Mar 2024
No, it's just the problem from above rephrased. And the reasons why it makes no sense trying to solve it symbolically are sufficiently explained.
Accepted Answer
John D'Errico
on 4 Mar 2024
Edited: John D'Errico
on 5 Mar 2024
This makes little sense as you write it, AND it will be essentially impossible to perform in MATLAB using symbolic tools. syms CANNOT compute (in a finite time, measured in our lifeltimes) matrix inverses for large matrices in fully symbolic form.
You say this:
N(12x12) and its determinant are non-zero, B1(12x5), B1(12x4), C1(2x5) C1(2x4)
First, we are not told what the B2 and C2 sizes are. I'll assume the second arrays you gave as B1 and C1 are actually B2 and C2.
I'll make that assumption then, and as a test case, I want to point out the result will be a full matrix in general. Just to give you a feeling, consider this example:
N = randn(12); N = N+N';
B1 = randn(12,5);C1 = randn(2,5);
B2 = randn(12,4); C2 = randn(2,4);
A = [N,zeros(12,2),B1,B2; ...
zeros(2,12),zeros(2,2),C1,C2; ...
B1',C1',zeros(5,5),zeros(5,4); ...
B2',C2',zeros(4,5),zeros(4,4)];
You can see the non-zeros in the A matrix here:
spy(A)
And see that inv(A) will be a full matrix, completely filled in.
spy(inv(A))
Can you compute the matrix inverse, using these block matrices? I suppose there is no reason why you could not just perform a simple Gaussian Elimination on those blocks, as long as the necessary elements will be non-singular. However, MATLAB does not have that capability, at least not today.
It might seem you could try. That is, just create a 4x4 symmetric matrix, with variables representing those blocks, then compute the symbolic inverse. The problem is, MATLAB would need to know that the matrix products in that result do NOT commute. And this is why the above scheme will fail. The symbolic toolbox will assume commutativity.
And if you try to generate the entire matrix as a symbolic 23x23 array where all elements are symbolic (not numeric) then the symbolic inverse will never terminate, as it would involve on the order of factorial(23) terms.
As such, your question cannot be solved using MATLAB. You would be best off just doing the linear algebra yourself. I expect it will get a bit nasty looking, but you could in theory survive. Just not using MATLAB.
0 Comments
More Answers (2)
Walter Roberson
on 7 Mar 2024
N = symmatrix('N', [12 12]);
B1 = symmatrix('B1', [12,5]); C1 = symmatrix('C1', [2,5]);
B2 = symmatrix('B2', [12,4]); C2 = symmatrix('C2', [2,4]);
A = [N,zeros(12,2),B1,B2; ...
zeros(2,12),zeros(2,2),C1,C2; ...
B1',C1',zeros(5,5),zeros(5,4); ...
B2',C2',zeros(4,5),zeros(4,4)]
invA = inv(A)
Paul
on 8 Mar 2024
Edited: Paul
on 9 Mar 2024
I wasn't going to post this as it didn't seem like a useful answer, but, since @Torsten raised the idea of using the block matrix inversion formula ....
A = symmatrix('A',[12 12]);
B = symmatrix('B',[12 11]);
C = symmatrix('C',[11 12]);
D = symmatrix('D',[11 11]);
% M = [A B;C D]
invM = [ ...
inv(A) + inv(A)*B*inv(D-C*inv(A)*B)*C*inv(A) , -inv(A)*B*inv(D-C*inv(A)*B);
-(inv(D-C*inv(A)*B))*C*inv(A) , inv(D-C*inv(A)*B) ]
invM = subs(invM,C,B.')
N = symmatrix('N',[12 12]);
Z = symmatrix('Z',[12 2]);
B1 = symmatrix('B1', [12,5]); C1 = symmatrix('C1', [2,5]);
B2 = symmatrix('B2', [12,4]); C2 = symmatrix('C2', [2,4]);
invM = subs(invM,inv(A),inv(N))
Hmm, not all of the inv(A) terms are subbed with inv(N). Don't know what that's all about.
On my local installation of R2021b, the substitution worked the way I intended and thought it would.
I guess the workwaround would be to start the problem with N instead of A for the upper left block. Or just subs A for N (instead of their inverses).
invM = subs(invM,A,N)
invM = subs(invM,B,[Z B1 B2])
invM = subs(invM,D,[zeros(2) , C1 , C2;[C1';C2'],zeros(9)])
invM = subs(invM,Z,sym(zeros(12,2)))
At this point, I couldn't get much further. Coudn't even figure out how to subs in values for N, B1, B2, C1, and C2.
See Also
Categories
Find more on Number Theory in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!