Matrices and Advanced LaTeX Structures: A Complete Tutorial
Beyond basic equations, LaTeX excels at complex mathematical structures. This tutorial covers matrices, piecewise functions, aligned equations, and more.
Matrix Types
LaTeX offers several matrix environments:
pmatrix— Parentheses:\begin{pmatrix} a & b \\ c & d \end{pmatrix}bmatrix— Square brackets:\begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix}vmatrix— Vertical bars:\begin{vmatrix} a & b \\ c & d \end{vmatrix}matrix— No brackets:\begin{matrix} a & b \\ c & d \end{matrix}
Piecewise Functions (Cases)
Use the cases environment: \begin{cases} x^2 & \text{if } x > 0 \\ 0 & \text{otherwise} \end{cases}.
Aligned Equations
For multi-line equations with alignment: \begin{aligned} x &= a + b \\ y &= c + d \end{aligned}. The & marks alignment points.
Combining Structures
You can nest these structures: a matrix inside a case, or an aligned equation inside a matrix. This power makes LaTeX ideal for complex mathematical notation.
Using the Editor's Tools
Our symbol toolbar includes dedicated buttons for matrices, cases, and aligned environments. Just click to insert the template and fill in your values.
✏️ Try it now — open the MathEditor and experiment with these formulas!