Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Example: I have a matrix $R = \left( \begin{array}{cc} A & \mathbf{t} \\ 0 & 1 \end{array} \right) $ where $A$ is 3-by-3 and $\mathbf{t}$ is 3 by 1. Or in Mathematica

 A={{1,0,0},{0,0,1},{0,-1,0}};
 t={1,1,1}

I would like to be able to use a form of block matrix notation / entry and subsequently find the inverse of R.

Question: Is this possible?

share|improve this question
    
Well darn, I was in such an all-fired hurry I didn't read the question. Let me take another look at this. lol –  Mr.Wizard Jan 26 '12 at 16:21
    
To be honest I don't know what the desired output is; would you humor me and include it? –  Mr.Wizard Jan 26 '12 at 16:24
add comment

2 Answers

up vote 23 down vote accepted

You're looking for ArrayFlatten. For your example matrices,

 R = ArrayFlatten[ {{A, {t}\[Transpose]},{0, 1}} ]
 (*
 => {{1, 0, 0, 1}, {0, 0, 1, 1}, {0, -1, 0, 1}, {0, 0, 0, 1}}
 *)

The construct {t}\[Transpose] is necessary for ArrayFlatten to treat t as a column matrix.

Mathematica graphics

Then to find $\boldsymbol{R}^{-1}$, you run

Inverse[R]
(* 
=> {{1, 0, 0, -1}, {0, 0, -1, 1}, {0, 1, 0, -1}, {0, 0, 0, 1}}
*)
share|improve this answer
    
beat me by 5s... –  acl Jan 26 '12 at 16:25
    
He was also asking for the inverse - could add this for completeness. –  Vitaliy Kaurov Jan 26 '12 at 16:31
    
@VitaliyKaurov, done! –  rcollyer Jan 26 '12 at 16:36
    
@acl, it's a testament to how much we've been waiting for these types of questions when 3 of the top users jump on it within seconds of each other. –  rcollyer Jan 26 '12 at 16:38
add comment

The keyboard commands Ctrl+Enter, Ctrl+, and Tab can be used to enter this format.

You can also use the menu Insert > Table/Matrix to create a table of specified size with placeholders.

See Entering Tables and Matrices.


Depending on the meaning of the question, this may have some bearing:

Mathematica graphics

share|improve this answer
1  
beat you to it. :P –  rcollyer Jan 26 '12 at 16:23
    
LOL at the pity vote. –  Mr.Wizard Jan 26 '12 at 16:27
    
I meant, I beat you to posting the "correct" answer. Although, I posted the result he wanted, and you posted the entry method. Win for both of us. –  rcollyer Jan 26 '12 at 16:28
    
Not a pity vote. If you don't post this, I would have edited it into @rcollyer's answer. It's much more convenient to enter matrices like this (see my screenshot). –  Szabolcs Jan 26 '12 at 16:29
3  
@rcollyer Recently I saw someone give input to NDSolve that way, and I really liked it --> i.stack.imgur.com/bgWJ3.png –  Szabolcs Jan 26 '12 at 16:47
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.