How to write matrix in LaTeX
Use \begin{pmatrix} a & b \\ c & d \end{pmatrix} in math mode — between $…$ in a document, or directly in the editor above.
| LaTeX command | \begin{pmatrix} a & b \\ c & d \end{pmatrix} |
|---|---|
| Notes | amsmath; brackets: bmatrix, vmatrix (determinant) |
Some forms need a package — add \usepackage{amsmath, amssymb} to your preamble; MathJax, Notion, Obsidian and most Markdown editors already include them.
Example
A = \begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix}
The editor above is pre-filled with this example — tweak it and export it as PNG, SVG or a Word equation.
More structures
| Symbol | Command |
|---|---|
| Cases (piecewise function) | \begin{cases} a & x > 0 \\ b & x \le 0 \end{cases} |
| Binomial coefficient | \binom{n}{k} |
| Absolute value | \lvert x \rvert |
| ⌊⌋ | \lfloor x \rfloor |
| Subscripts and superscripts | x_{i}^{2} |


