# Inverse of a symmetric matrix consisting of submatrices is desired.

6 vues (au cours des 30 derniers jours)
ayeser le 2 Mar 2024
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 commentairesAfficher 12 commentaires plus anciensMasquer 12 commentaires plus anciens
Torsten le 8 Mar 2024
Déplacé(e) : John D'Errico le 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.
Walter Roberson le 9 Mar 2024
Eventually, MATLAB crashed while trying to process the above A\B

Connectez-vous pour commenter.

### Réponse acceptée

John D'Errico le 4 Mar 2024
Modifié(e) : John D'Errico le 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 commentairesAfficher -2 commentaires plus anciensMasquer -2 commentaires plus anciens

Connectez-vous pour commenter.

### Plus de réponses (2)

Walter Roberson le 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)]
A =
invA = inv(A)
invA =
##### 4 commentairesAfficher 2 commentaires plus anciensMasquer 2 commentaires plus anciens
Torsten le 7 Mar 2024
Modifié(e) : Torsten le 7 Mar 2024
MATLAB can't see it either.
It just writes that inv(A) = A^(-1) which doesn't help much.
Torsten le 7 Mar 2024
Modifié(e) : Torsten le 7 Mar 2024
You could split your matrix into a matrix of the form [A B;C D] where A is 12x12 (invertible), B is 12x11, C is 11x12 and D is 11x11 and apply
I don't know if this leads to anything useful.

Connectez-vous pour commenter.

Paul le 8 Mar 2024
Modifié(e) : Paul le 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 =
invM = subs(invM,C,B.')
invM =
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))
invM =
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 =
invM = subs(invM,B,[Z B1 B2])
invM =
invM = subs(invM,D,[zeros(2) , C1 , C2;[C1';C2'],zeros(9)])
invM =
invM = subs(invM,Z,sym(zeros(12,2)))
invM =
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.
##### 1 commentaireAfficher -1 commentaires plus anciensMasquer -1 commentaires plus anciens
ayeser le 9 Mar 2024
thanks

Connectez-vous pour commenter.

### Catégories

En savoir plus sur Number Theory dans Help Center et File Exchange

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by