amsmath and use pmatrix or bmatrix.
Use pmatrix for parentheses, bmatrix for square brackets, vmatrix for determinants, and smallmatrix for inline math. When you need vertical separators for an augmented matrix or custom alignment, switch to array.
This guide starts with the common matrix environments, then covers augmented matrices, block matrices, spacing, and alignment.
pmatrix for ( ), bmatrix for [ ], and vmatrix for determinants.Package required: Most matrix environments need \usepackage{amsmath}. Some advanced layouts also use array or mathtools.Related topics: Mathematical equations | Subscripts & superscripts | Brackets & parentheses | LaTeX symbolsLast updated: April 2026 | Reading time: 15 min | Difficulty: Beginner to IntermediateWhat You’ll Learn
- ✅ All LaTeX matrix environments (pmatrix, bmatrix, vmatrix, Bmatrix, Vmatrix)
- ✅ Creating arrays with custom delimiters and column alignment
- ✅ Block matrices and augmented matrix notation
- ✅ Matrix operations, determinants, and transpose notation
- ✅ Small inline matrices with smallmatrix environment
- ✅ Advanced matrix formatting, spacing, and decorations
- ✅ Troubleshooting common LaTeX matrix issues
Frequently Asked Questions
What is the difference between pmatrix and bmatrix in LaTeX?
What is the difference between pmatrix and bmatrix in LaTeX?
pmatrix and bmatrix is the type of delimiters (brackets) they use:- pmatrix uses parentheses ( ) - most common for general matrices in mathematics
- bmatrix uses square brackets [ ] - preferred for numerical data and engineering
amsmath package and work identically in terms of syntax:When to use each:- Use pmatrix for: linear transformations, general matrices, mathematical proofs
- Use bmatrix for: numerical data, matrices in data science, engineering applications
- Use vmatrix for: determinants (single vertical bars)
How do I create a matrix with vertical lines between columns (augmented matrix)?
How do I create a matrix with vertical lines between columns (augmented matrix)?
array environment with the pipe symbol | in the column specification:How it works:{cc|c}means: column-center, column-center, vertical line, column-center- Use
cfor centered,lfor left-aligned,rfor right-aligned - The pipe
|symbol creates the vertical separator line - Use
\left[and\right]to automatically scale brackets
What is the amsmath package and why do I need it for LaTeX matrices?
What is the amsmath package and why do I need it for LaTeX matrices?
pmatrix(parentheses)bmatrix(square brackets)vmatrix(determinant notation)Vmatrix(norm notation)Bmatrix(curly braces)smallmatrix(inline matrices)
array environment with manual delimiter management.How do I fix alignment issues with numbers in LaTeX matrices?
How do I fix alignment issues with numbers in LaTeX matrices?
How do I create a small inline matrix in LaTeX?
How do I create a small inline matrix in LaTeX?
smallmatrix environment:Regular pmatrix environments are too large for inline use and disrupt line spacing. The smallmatrix environment uses smaller fonts and tighter spacing.What does the array column specifier mean in LaTeX matrices?
What does the array column specifier mean in LaTeX matrices?
How do I calculate and display a determinant in LaTeX?
How do I calculate and display a determinant in LaTeX?
vmatrix environment for determinant notation with vertical bar delimiters:For 3×3 matrices:How do I increase spacing between elements in a LaTeX matrix?
How do I increase spacing between elements in a LaTeX matrix?
\renewcommand{\arraystretch}{factor} to control matrix element spacing:Recommended values:1.0- Default compact spacing1.2- Standard matrices1.5- Matrices with fractions or subscripts2.0- Matrices with tall expressions
Basic Matrix Environments
LaTeX provides six standard matrix environments through theamsmath package, each with different delimiters:
Matrix Environment Overview
Matrix Environment Summary Table
Creating Your First Matrix
Simple 2×2 Matrix
Matrix Elements and Structure
Matrix with Subscripts
Using Dots in Matrices
LaTeX provides three types of dots for indicating patterns in matrices:Special Matrix Types
Identity and Zero Matrices
Triangular Matrices
Arrays - The Foundation of Matrices
Thearray environment provides the most flexibility for creating custom matrix-like structures:
Basic Array Usage
Array Column Specifiers
Block Matrices
Block matrices are used to partition large matrices into smaller submatrices:Basic Block Matrices
Augmented Matrices
Augmented matrices are commonly used for solving systems of linear equations:Matrix Operations
Basic Operations Notation
Determinants and Traces
Small Inline Matrices
For matrices within text, use thesmallmatrix environment:
Advanced Techniques
Matrices with Labels
Matrix Decorations
Common Pitfalls and Solutions
My matrix delimiters are too small
My matrix delimiters are too small
\left and \right with array:Or use the pre-defined environments like pmatrix which handle this automatically.Alignment issues in matrices
Alignment issues in matrices
- Use
arraywith explicit alignment:{rrr}for right-aligned - For decimals, use the
siunitxpackage withScolumns - Add spacing with
\phantom{}for consistent widths
Matrix too wide for page
Matrix too wide for page
- Use
\smallor\footnotesizebefore the matrix - Use
bmatrix*}[r]frommathtoolsfor right-aligned entries - Split into block matrices
- Consider using
arrayenvironment with custom column spacing
Spacing between matrix elements
Spacing between matrix elements
Best Practices
Package Recommendations
Essential Packages
Loading Order
Quick Reference Card
Matrix Environments Summary
Common Patterns
Practice in LaTeX Cloud Studio
Try matrices in the editor
pmatrix, bmatrix, and augmented matrices in a live document and inspect the rendered output directly.Tables vs matrices
Related Topics
Subscripts & Superscripts
Mathematical Equations
LaTeX Symbols Reference
Advanced Mathematics
Further Reading & References
For authoritative documentation on LaTeX matrix environments and mathematical typesetting:- amsmath Package Documentation - The standard package providing all matrix environments (pmatrix, bmatrix, vmatrix)
- mathtools Package - Extended features for matrices including starred versions and additional options
- The LaTeX Companion (3rd Edition) - Comprehensive reference for mathematical typesetting best practices
- Linear Algebra Done Right by Sheldon Axler - Standard textbook demonstrating matrix notation conventions
- Learn about Creating figures and images
- Explore Advanced mathematics
- Master Table creation for data presentation
