3 deleted 9 characters in body edited Mar 28 '12 at 8:36 Oleksandr R. 21.1k44 gold badges8080 silver badges122122 bronze badges We can construct this matrix directly as a SparseArray. This allows some classes of numerical matrices to be stored as packed arrays while being combined with symbolic or exact vectors (or vice versa), so there can be storage and run-time efficiency reasons for using a SparseArray, in addition to the obvious benefit of direct construction. On the other hand, the function needed to construct a sparse block matrix is undocumented. Define: f[A_?MatrixQ, t_?VectorQ] /; Last@Dimensions[A]Length[A] == Length[t] := SparseArraySparseBlockMatrix[{ {1, 1} -> A, {1, 2} -> Transpose[{t}], {2, 2} -> {{1}} }, Dimensions[A] + 1];  Now: f[IdentityMatrix[5], Array[a, 5]]  gives (as a sparse array; if you want exactly this output you must first use Normal): We can construct this matrix directly as a SparseArray. This allows some classes of numerical matrices to be stored as packed arrays while being combined with symbolic or exact vectors (or vice versa), so there can be storage and run-time efficiency reasons for using a SparseArray, in addition to the obvious benefit of direct construction. On the other hand, the function needed to construct a sparse block matrix is undocumented. Define: f[A_?MatrixQ, t_?VectorQ] /; Last@Dimensions[A] == Length[t] := SparseArraySparseBlockMatrix[{ {1, 1} -> A, {1, 2} -> Transpose[{t}], {2, 2} -> {{1}} }, Dimensions[A] + 1];  Now: f[IdentityMatrix[5], Array[a, 5]]  gives (as a sparse array; if you want exactly this output you must first use Normal): We can construct this matrix directly as a SparseArray. This allows some classes of numerical matrices to be stored as packed arrays while being combined with symbolic or exact vectors (or vice versa), so there can be storage and run-time efficiency reasons for using a SparseArray, in addition to the obvious benefit of direct construction. On the other hand, the function needed to construct a sparse block matrix is undocumented. Define: f[A_?MatrixQ, t_?VectorQ] /; Length[A] == Length[t] := SparseArraySparseBlockMatrix[{ {1, 1} -> A, {1, 2} -> Transpose[{t}], {2, 2} -> {{1}} }, Dimensions[A] + 1];  Now: f[IdentityMatrix[5], Array[a, 5]]  gives (as a sparse array; if you want exactly this output you must first use Normal): 2 Being too glib about undocumented functions seems to have earned me a downvote, so I edited the answer to better motivate this solution. edited Mar 28 '12 at 8:28 Oleksandr R. 21.1k44 gold badges8080 silver badges122122 bronze badges Let's try usingWe can construct this matrix directly as a SparseArray. This allows some classes of numerical matrices to be stored as packed arrays while being combined with symbolic or exact vectors (or vice versa), so there can be storage and run-time efficiency reasons for using a SparseArray, in addition to the obvious benefit of direct construction. On the other hand, the function needed to construct a sparse block matrix is undocumented functions. Define: f[A_?MatrixQ, t_?VectorQ] /; Length[A]Last@Dimensions[A] == Length[t] := SparseArraySparseBlockMatrix[{ {1, 1} -> A, {1, 2} -> Transpose[{t}], {Length[A] + 12, 2} -> {{1}} }];, Dimensions[A] + 1];  Now: f[IdentityMatrix[5], Array[a, 5]]  gives (as a sparse array; if you want exactly this output you must first use Normal): Let's try using some undocumented functions. Define: f[A_?MatrixQ, t_?VectorQ] /; Length[A] == Length[t] := SparseArraySparseBlockMatrix[{ {1, 1} -> A, {1, 2} -> Transpose[{t}], {Length[A] + 1, 2} -> {{1}} }];  Now: f[IdentityMatrix[5], Array[a, 5]]  gives (as a sparse array; if you want exactly this output you must first use Normal): We can construct this matrix directly as a SparseArray. This allows some classes of numerical matrices to be stored as packed arrays while being combined with symbolic or exact vectors (or vice versa), so there can be storage and run-time efficiency reasons for using a SparseArray, in addition to the obvious benefit of direct construction. On the other hand, the function needed to construct a sparse block matrix is undocumented. Define: f[A_?MatrixQ, t_?VectorQ] /; Last@Dimensions[A] == Length[t] := SparseArraySparseBlockMatrix[{ {1, 1} -> A, {1, 2} -> Transpose[{t}], {2, 2} -> {{1}} }, Dimensions[A] + 1];  Now: f[IdentityMatrix[5], Array[a, 5]]  gives (as a sparse array; if you want exactly this output you must first use Normal): 1 answered Mar 27 '12 at 10:12 Oleksandr R. 21.1k44 gold badges8080 silver badges122122 bronze badges Let's try using some undocumented functions. Define: f[A_?MatrixQ, t_?VectorQ] /; Length[A] == Length[t] := SparseArraySparseBlockMatrix[{ {1, 1} -> A, {1, 2} -> Transpose[{t}], {Length[A] + 1, 2} -> {{1}} }];  Now: f[IdentityMatrix[5], Array[a, 5]]  gives (as a sparse array; if you want exactly this output you must first use Normal`):