Underleaf Logo
Underleaf
PricingBlogInstall for OverleafStart for free

Learn LaTeX

Text Formatting

  • Bold Text in LaTeX
  • Italics in LaTeX
  • Subscript and Superscript
  • Greek Letters and Symbols

Matrices and Arrays in LaTeX

LaTeX provides several environments for creating matrices and arrays. This guide covers the different types of matrices, their syntax, and advanced formatting options.

Basic Matrix Types

LaTeX offers various matrix environments, each with different delimiters:

  1. matrix Environment (no delimiters)

    \egin{matrix} a & b \\ c & d \end{matrix}

  2. pmatrix Environment (parentheses)

    \egin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix}

  3. bmatrix Environment (square brackets)

    \egin{bmatrix} x & y \\ z & w \end{bmatrix}

  4. vmatrix Environment (vertical bars)

    \egin{vmatrix} a & b \\ c & d \end{vmatrix}

Matrix with Alignment

You can control column alignment using the array environment:

\egin{array}{lcr} \ ext{left} & \ ext{center} & \ ext{right} \\ 1 & 2 & 3 \\ 4 & 5 & 6 \end{array}

The {lcr} specifies left, center, and right alignment for each column.

Augmented Matrices

For systems of equations, you can create augmented matrices using the array environment:

\left[\begin{array}{cc|c} 1 & 2 & 3 \\ 4 & 5 & 6 \end{array}\right]

The vertical line in {cc|c} creates the augmentation line.

Small Matrices

For inline matrices, use the smallmatrix environment:

A = \egin{pmatrix*}[r] -1 & 2 \\ 3 & -4 \end{pmatrix*}

Advanced Matrix Features

  • Dots in Matrices

    \egin{pmatrix} 1 & \cdots & n \\ \ dots & \ddots & \ dots \\ m & \cdots & mn \end{pmatrix}

  • Nested Matrices

    \egin{bmatrix} A & \egin{bmatrix} x \\ y \end{bmatrix} \\ 0 & 1 \end{bmatrix}

  • Matrix with Text

    \egin{pmatrix} \ ext{row 1} & x_1 \\ \ ext{row 2} & x_2 \end{pmatrix}

Best Practices

  • Use \begin{array} when you need precise control over column alignment
  • Use \begin{pmatrix} or \begin{bmatrix} for standard matrices
  • Use \begin{smallmatrix} for inline matrices to maintain proper line spacing
  • Use \vdots, \ddots, and \cdots for professional-looking ellipses
Underleaf Logo
Underleaf

Empowering students and researchers with AI-powered tools for academic writing.

Company

PricingGuideBlogLearn

© 2025 Underleaf. All rights reserved.