# matrix

Used for ordinary matrices without surrounding delimiters inside equations and derivations

https://texform.dev/latex/environments/matrix

## Metadata

| Field | Value |
| --- | --- |
| Topic | [Matrices](https://texform.dev/latex/topics/matrices) |
| Packages | ams |
| Allowed mode | math |
| Tags | matrix, nestable |
| Commonality | high |
| Body mode | math |

## Syntax

### ams

Argument specification: ``

Used for ordinary matrices without surrounding delimiters inside equations and derivations

## Common tasks

### How to write a matrix with no fences

```latex
\begin{matrix} a & b \\ c & d \end{matrix}
```

[Open in Playground](https://play.texform.dev/?input=%5Cbegin%7Bmatrix%7D+a+%26+b+%5C%5C+c+%26+d+%5Cend%7Bmatrix%7D)

### How to wrap a bare matrix in your own delimiters

matrix is the unfenced building block behind pmatrix and friends.

```latex
\left\lVert \begin{matrix} a & b \\ c & d \end{matrix} \right\rVert
```

[Open in Playground](https://play.texform.dev/?input=%5Cleft%5ClVert+%5Cbegin%7Bmatrix%7D+a+%26+b+%5C%5C+c+%26+d+%5Cend%7Bmatrix%7D+%5Cright%5CrVert)

## Examples

```latex
\begin{matrix} a & b \\ c & d \end{matrix}
```

[Open in Playground](https://play.texform.dev/?input=%5Cbegin%7Bmatrix%7D+a+%26+b+%5C%5C+c+%26+d+%5Cend%7Bmatrix%7D)

## Renderer support

| Package | MathJax | KaTeX | XeTeX |
| --- | --- | --- | --- |
| ams | full | full | full |

## Usage frequency

0.21% of formulas in the measured corpus contain this entry, rank 17 of 31 entries with frequency data.

## In TeXForm

TeXForm reads the environment body in math mode.

## See also

- [bmatrix](https://texform.dev/latex/environments/bmatrix)
- [Bmatrix](https://texform.dev/latex/environments/Bmatrix)
- [cases](https://texform.dev/latex/environments/cases)
- [pmatrix](https://texform.dev/latex/environments/pmatrix)
- [smallmatrix](https://texform.dev/latex/environments/smallmatrix)
- [subarray](https://texform.dev/latex/environments/subarray)
- [vmatrix](https://texform.dev/latex/environments/vmatrix)
- [Vmatrix](https://texform.dev/latex/environments/Vmatrix)

## Test cases

### ams

| Input | Case | MathJax | KaTeX | XeTeX |
| --- | --- | --- | --- | --- |
| \begin{matrix} a & b \\\\ c & d \end{matrix} | Positive: baseline | Pass | Pass | Pass |
