2

If I try to get an inverse of a matrix:

a | b | c
b | d | 0
c | 0 | 0

Inverse[{{a, b, c}, {b, d, 0}, {c, 0, 0}}]

I get the answer:

{{0, 0, c^(-1)}, {0, d^(-1), -(b/(c d))}, {c^(-1), -(b/(c d)), (b^2 - a d)/(c^2 d)}}

which is

  0 | 0        | 1/c
  0 | 1/d      | -b/(c d)
1/c | -b/(c d) | (b^2-a d)/(c^2 d))

Now, suppose I want to the inverse of a matrix

 A  | b  | c
 b' | d  | 0
 c' | 0  | 0

where say $A$ is a symbol matrix of size N x N, $b$ is a vector of size N x 1, $c$ is a vector of size N x 1, $d$ is a scalar of size 1 x 1.

How can I write a formula for Inverse of the above matrix such that I get answers back in terms that use matrix inverse instead of scalar division, e.g. say $(cc')^{-1}c$ instead of $1/c$, and other forms like $A^{-1}$ instead of $1/A$ etc.

J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574
uday
  • 121
  • 2

1 Answers1

2

I am not sure what the ultimate aim is here. I post this in case it motivates the desired approach. Anything above N=2 is unwieldy:

Setup:

matg[n_, s_, col_] := Table[Style[Unique[s], col, Bold], {n}]
smat[n_, s_, col_] := 
 SparseArray[{i_, j_} :> Style[Unique[s], col, Bold], {n, n}]

Example:

a = smat[2, "a", Red];
b = List /@ matg[2, "b", Darker[Green]];
c = List /@ matg[2, "c", Blue];
mat = ArrayFlatten[{{a, b, c}, {Transpose[b], 
     Style[Unique["d"], Bold], 0}, {Transpose[c], 0, 0}}];
mat // MatrixForm
With[{det = Det[mat]}, 
 Inverse[mat] /. det -> 1 // 
  Column[{Row[{1/Det, 
       Grid[#, Frame -> All, Alignment -> Left, ItemSize -> 10, 
        Background -> LightYellow]}], Row[{"where Det =", det}]}, 
    ItemSize -> 50, Alignment -> Center] &]

original matrix:

enter image description here

inverse:

enter image description here

ubpdqn
  • 60,617
  • 3
  • 59
  • 148
  • I think the OP is asking about https://en.wikipedia.org/wiki/Block_matrix#Block_matrix_inversion. It would be nice if Mathematica was able to manipulate symbolic block matrices like this. – a06e Feb 03 '21 at 15:23