Adding one row and column to a matrix
rm = RotationMatrix[θ, {0, 0, 1}];
rm2 = RotationMatrix[I θ, {0, 0, 1}];
1. ArrayFlatten
ArrayFlatten[{{1, 0}, {0, rm}}] // MatrixForm
ArrayFlatten[{{rm2, 0}, {0, 1}}] // MatrixForm
2. PadRight + PadLeft
PadRight[{{1}}, {4, 4}] + PadLeft[rm, {4, 4}] // MatrixForm
PadLeft[{{1}}, {4, 4}] + PadRight[rm2, {4, 4}] // MatrixForm
You can also do
MatrixForm /@ {Prepend[UnitVector[4, 1]] @ PadLeft[rm, {3, 4}],
Append[UnitVector[4, 4]] @ PadRight[rm2, {3, 4}]} // Row
or
MatrixForm /@ {MapAt[1 &, {1, 1}]@PadLeft[rm, {4, 4}],
MapAt[1 &, {-1, -1}]@PadRight[rm2, {4, 4}]} // Row
or
MatrixForm /@ {ReplacePart[ {1, 1} -> 1] @ PadLeft[rm, {4, 4}],
ReplacePart[ {-1, -1} -> 1] @ PadRight[rm2, {4, 4}]} // Row
to get
3. ArrayPad
MatrixForm /@ {Prepend[UnitVector[4, 1]] @ ArrayPad[rm, {{0}, {1, 0}}],
Append[UnitVector[4, 4]] @ ArrayPad[rm2, {{0}, {0, 1}}]} // Row
4. SparseArray`SparseBlockMatrix
SparseArray`SparseBlockMatrix[{{1, 1} -> {{1}}, {2, 2} -> rm}] // MatrixForm
SparseArray`SparseBlockMatrix[{{1, 1} -> rm2, {2, 2} -> {{1}}}] // MatrixForm
matrix = RotationMatrix[θ, {0, 0, 1}];
matrix1 = SparseArray[{Band[{1, 1}] -> {matrix, {{1}}}}];
matrix2 = SparseArray[{Band[{1, 1}] -> {{{1}}, matrix}}];
matrix // MatrixForm
matrix1 // MatrixForm
matrix2 // MatrixForm