# Problem with ArrayFlatten to concatenate matrix

I would like to concatenate 2 matrix : - the first which is a line of 2 elements - the second which is a matrix of 2-2 elements

I use the following code :

B = ArrayFlatten[{{Simplify[
Inverse[Subscript[\[Phi], Subscript[q, d]]].Subscript[\[Phi],
Subscript[q, i]]]}, {IdentityMatrix[2]}}] // MatrixForm


But it doesn't work ie that I didn't manage to obtain the following matrix :

B={{1/2 l Sin[\[Gamma][t]], -(1/2) l Cos[\[Gamma][t]]}, {1, 0}, {0,
1}} // MatrixForm


May you help me to better use the ArrayFlatten function or a another function so as to concatenate 2 matrix.

Thank you

• "But it doesn't work": Actually, your expression does work, but perhaps it does not produce what you want. If you don't tell us what you need, we can't help you. Commented Nov 12, 2015 at 15:40
• As a side note, you probably don't want to store the MatrixForm of your matrix in B, as MatrixForm is intended for formatting only, and no good for further calculations; rewrite your expression as (B = ...) // MatrixForm. Commented Nov 12, 2015 at 15:42
• Simplify[Inverse[Subscript[[Phi], Subscript[q, d]]].Subscript[[Phi], Subscript[q, i]]]={{1/2 l Sin[[Gamma][t]]}, {-(1/2) l Cos[[Gamma][t]]}} in order to help for the troubleshooting and I would like to obtain a matrix with 3 lines of 3 columns : Line 1 : 1/2 l Sin[[Gamma][t]], -(1/2) l Cos[[Gamma][t]] Line 2: 1, 0 Line 3: 0,1 Commented Nov 12, 2015 at 15:46

Join[{{1/2 l Sin[γ[t]], -(1/2) l Cos[γ[t]]}}, IdentityMatrix[2]] // MatrixForm


Observe the double brackets around the first argument of Join

Many more possibilities like Insert, Prepend

• OK. Great. Does it also possible with ArrayFlatten function ? Commented Nov 12, 2015 at 16:08
• ArrayFlatten is not possible here
– eldo
Commented Nov 12, 2015 at 16:15
• Huh? Isn't this the same as a = {{1/2 l Sin[\[Gamma][t]], -(1/2) l Cos[\[Gamma][t]]}}; b = IdentityMatrix[2]; ArrayFlatten[{{a}, {b}}] // MatrixForm? @Bendesarts Why do you insist on ArrayFlatten? Commented Nov 12, 2015 at 17:28
• It was just because it seems to me that the notations are a bit more simple. Thank you for your help Commented Nov 12, 2015 at 17:33
• Somebody can remind me the rule about the double brackets around the first argument of Join ? Commented Nov 12, 2015 at 17:35

ArrayFlatten can be used as follows:

a = {{1/2 l Sin[γ[t]], -(1/2) l Cos[γ[t]]}};
b = IdentityMatrix[2];
ArrayFlatten[{{a}, {b}}]