Matrix in LaTeX (\begin{bmatrix} a & b \\ c & d \end{bmatrix})

[abcd]\begin{bmatrix} a & b \\ c & d \end{bmatrix}
LaTeX command
\begin{bmatrix} a & b \\ c & d \end{bmatrix}
Package
Add to your preamble:\usepackage{amsmath}
Mode
Math mode only

Try Matrix in a real LaTeX document

Open a ready-to-compile document that already uses \begin{bmatrix} a & b \\ c & d \end{bmatrix}, with the right packages loaded. Edit it and see the PDF, no install needed.

Where it is used

bmatrix environment typesetting a matrix in square brackets, with & between columns.

Entries in a row are separated by &, rows end with \\, and the brackets size themselves to the content, so no \left[ is required. Sibling environments change only the delimiters: pmatrix uses parentheses, vmatrix vertical bars for determinants, Vmatrix double bars, and plain matrix none at all. The array environment is the older alternative; it needs a column specification like {cc} but allows vertical rules and per-column alignment. For generic matrices, fill gaps with \cdots, \vdots and \ddots, as in a_{11} & \cdots & a_{1n}. Inline, smallmatrix inside \bigl[ \bigr] avoids stretching the line.

Minimal compilable example

Paste this into an empty .tex file and compile it with pdfLaTeX, XeLaTeX or LuaLaTeX.

[1234]\begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix}
\documentclass{article}
\usepackage{amsmath}
\begin{document}
Matrix: $\begin{bmatrix} a & b \\ c & d \end{bmatrix}$

\[ \begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix} \]
\end{document}

Related symbols

All Aljabar Linear →

Frequently asked questions

How do I write Matrix in LaTeX?
Type \begin{bmatrix} a & b \\ c & d \end{bmatrix} in math mode, for example $\begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix}$. Load amsmath first with \usepackage{amsmath}.
Which package do I need for \begin{bmatrix} a & b \\ c & d \end{bmatrix}?
\begin{bmatrix} a & b \\ c & d \end{bmatrix} needs amsmath: add \usepackage{amsmath} to your preamble before the document starts.
Can I use \begin{bmatrix} a & b \\ c & d \end{bmatrix} in text mode, or only in math mode?
Only in math mode. Outside $...$ LaTeX stops with "Missing $ inserted", so write $\begin{bmatrix} a & b \\ c & d \end{bmatrix}$ in running text.
Math poweredTulis LaTeX menggunakan AI

Editor LaTeX AI Terbaik, Alternatif Overleaf

Octree membantu peneliti dari 15+ universitas menulis makalah penelitian lebih cepat menggunakan AI

  • Hasilkan diagram TikZ yang indah menggunakan AI
  • Unggah gambar dan konversi ke LaTeX dengan mulus
  • Dapatkan bantuan instan untuk menulis dan memformat makalah penelitian