MatrixForm[list]
prints with the elements of list arranged in a regular array.
MatrixForm
MatrixForm[list]
prints with the elements of list arranged in a regular array.
Details and Options
- In StandardForm the array is shown enclosed in parentheses.
- MatrixForm prints a single‐level list in a column. It prints a two‐level list in standard matrix form. More deeply nested lists are by default printed with successive dimensions alternating between rows and columns.
- Elements in each column are by default centered.
- MatrixForm prints SparseArray objects like the corresponding ordinary lists. »
- MatrixForm has the same options as TableForm.
- The typeset form of MatrixForm[expr] is interpreted the same as expr when used in input. »
- When an input evaluates to MatrixForm[expr], MatrixForm does not appear in the output. »
-
TableAlignments Automatic how to align entries in each dimension TableDepth Infinity maximum number of levels to include TableDirections Column whether to arrange dimensions as rows or columns TableHeadings None how to label table entries TableSpacing Automatic how many spaces to put between entries in each dimension
List of all options
Examples
open all close allBasic Examples (3)
Show the matrix form of a matrix:
MatrixForm[{{1, 2}, {3, 4}}]Show the matrix form of a SparseArray:
MatrixForm[SparseArray[{{1, 1} -> 2}, {2, 2}]]Show vector, matrix, and general arrays in matrix form:
MatrixForm[Array[Subscript[a, ##]&, {2}]]MatrixForm[Array[Subscript[a, ##]&, {2, 2}]]MatrixForm[Array[Subscript[a, ##]&, {2, 2, 2}]]MatrixForm[Array[Subscript[a, ##]&, {2, 2, 2, 2}]]Scope (3)
Matrices of numbers and formulas:
MatrixForm[RandomReal[5, {3, 4}]]MatrixForm[Table[1 / (i + j), {i, 4}, {j, 4}]]MatrixForm[RotationMatrix[θ, {UnitVector[5, 2], UnitVector[5, 4]}]]Outer[List, Range[4], Range[4]]MatrixForm[%, TableDepth -> 2]Use options to control the layout directions:
MatrixForm[{{a, b}, {c, d}, {e, f}}, TableDirections -> {Row, Row}]MatrixForm[{{a, b}, {c, d}, {e, f}}, TableDirections -> {Row, Column}]Generalizations & Extensions (2)
Format a SparseArray object in matrix form:
SparseArray[RandomInteger[1, {5, 5}]]MatrixForm[%]Format a SymmetrizedArray object in matrix form:
SymmetrizedArray[i_ :> RandomInteger[5], {5, 5}, Antisymmetric[{1, 2}]]MatrixForm[%]Options (7)
TableAlignments (3)
Specify the alignment of columns:
MatrixForm[Partition[Range[15]!, 3], TableAlignments -> Right]Align columns on a decimal point or any character:
MatrixForm[0.12345 * 10 ^ Range[4], TableAlignments -> "."]Set alignments for successive dimensions:
m = Partition[Transpose@Partition[Range[18]!, 6], 3];MatrixForm[m, TableAlignments -> {Right, Top, Center}]TableDepth (1)
TableDirections (1)
TableHeadings (1)
MatrixForm[{{a, b}, {c, d}, {e, f}}, TableHeadings -> {{"r1", "r2", "r3"}, None}]MatrixForm[{{a, b}, {c, d}, {e, f}}, TableHeadings -> {None, {"c1", "c2"}}]Specify headings for rows and columns:
MatrixForm[{{a, b}, {c, d}, {e, f}}, TableHeadings -> {{"r1", "r2", "r3"}, {"c1", "c2"}}]Applications (4)
Display special matrices with matrix formatting:
MatrixForm /@ Table[RotationMatrix[θ, UnitVector[3, i]], {i, 3}]MatrixForm /@ Table[DiagonalMatrix[Range[4 - i], i], {i, 0, 3}]Matrices from a matrix decomposition:
MatrixForm /@ JordanDecomposition[{{29, 1, -21}, {3, 15, -3}, {4, 4, 4}}]Formula for a matrix multiplication:
A = Array[Subscript[a, ##]&, {3, 2}];
B = Array[Subscript[b, ##]&, {2, 2}];MatrixForm[A].MatrixForm[B] == MatrixForm[A.B, TableSpacing -> {1, 2}]Display a block matrix as a matrix of matrices:
t = Partition[Map[{{Subscript[#, 11], Subscript[#, 12]}, {Subscript[#, 21], Subscript[#, 22]}}&, {a, b, c, d}], 2]MatrixForm[t]The array flattened to a matrix:
MatrixForm[ArrayFlatten[t]]Properties & Relations (7)
MatrixForm formats arrays using standard matrix formatting:
m = {{a, b, c}, {d, e, f}};MatrixForm[m]TableForm formats arrays in a tabular form:
TableForm[m]Grid formats two-dimensional arrays as a grid:
Grid[m]Use MatrixPlot to visualize the structure of large matrices:
b[i_] := Table[Binomial[n, k], {n, 0, i}, {k, 0, i}]MatrixForm[b[5]]MatrixPlot[b[99]]Use ArrayPlot to visualize the structure of large discrete matrices:
b[i_] := CellularAutomaton[30, {{1}, 0}, i]MatrixForm[b[5]]ArrayPlot[b[100]]Use Style to affect the display of MatrixForm:
b[i_] := Table[Binomial[n, k], {n, 0, i}, {k, 0, i}]Style[MatrixForm[b[20]], Tiny]Style[MatrixForm[b[3]], {Large, Bold, Orange}]Use any number form such as ScientificForm or BaseForm to affect the display of numbers:
ScientificForm[MatrixForm[RandomReal[10 ^ 5, {4, 4}]], 3]PaddedForm[BaseForm[MatrixForm[RandomInteger[{0, 127}, {4, 4}]], 2], 8, NumberPadding -> {"0", ""}]The typeset form of MatrixForm[expr] is interpreted the same as expr when used in input:
f[MatrixForm[{{1, 2}, {3, 4}}]]Copy the output and paste it into an input cell. The (
) is interpreted as {{1,2},{3,4}}:1 2 3 4
f[(| | |
| - | - |
| 1 | 2 |
| 3 | 4 |)]When an input evaluates to MatrixForm[expr], MatrixForm does not appear in the output:
MatrixForm[{{1, 2}, {3, 4}}]Out is assigned the value {{1,2},{3,4}}, not MatrixForm[{{1,2},{3,4}}]:
%Possible Issues (1)
Even when an output omits MatrixForm from the top level, it is not stripped from subexpressions:
e = MatrixForm[{{1, 2}, {3, 4}}]The output does not have MatrixForm in it:
%However, the variable e does have MatrixForm in it, which may affect subsequent evaluations:
FullForm[e]The determinant is not evaluated due to the intervening MatrixForm:
Det[e]Assign variables first and then apply MatrixForm to the result to maintain computability:
(f = {{1, 2}, {3, 4}})//MatrixFormDet[f]See Also
Tech Notes
Related Guides
Related Workflows
- Create a Matrix
History
Introduced in 1988 (1.0) | Updated in 1996 (3.0) ▪ 2003 (5.0)
Text
Wolfram Research (1988), MatrixForm, Wolfram Language function, https://reference.wolfram.com/language/ref/MatrixForm.html (updated 2003).
CMS
Wolfram Language. 1988. "MatrixForm." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2003. https://reference.wolfram.com/language/ref/MatrixForm.html.
APA
Wolfram Language. (1988). MatrixForm. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/MatrixForm.html
BibTeX
@misc{reference.wolfram_2026_matrixform, author="Wolfram Research", title="{MatrixForm}", year="2003", howpublished="\url{https://reference.wolfram.com/language/ref/MatrixForm.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_matrixform, organization={Wolfram Research}, title={MatrixForm}, year={2003}, url={https://reference.wolfram.com/language/ref/MatrixForm.html}, note=[Accessed: 13-June-2026]}