Matrices, cases and aligned equations in PDF
Matrices, cases, aligned derivations and ruled arrays are typeset with delimiters that grow to fit. Elsewhere these environments often print as raw source.
pmatrix, bmatrix and vmatrix, piecewise cases, aligned derivations, ruled arrays, growing delimiters, braces under and over terms, and boxed results. Toggle: math.
Markdown source
Markdown · 41 lines# Math structures
## Matrices
$ A = \begin{pmatrix} a & b \\ c & d \end{pmatrix}, \qquad \det A = \begin{vmatrix} a & b \\ c & d \end{vmatrix} = ad - bc, \qquad A^{-1} = \frac{1}{ad - bc} \begin{pmatrix} d & -b \\ -c & a \end{pmatrix} $
$ R_z(\theta) = \begin{bmatrix} \cos\theta & -\sin\theta & 0 \\ \sin\theta & \cos\theta & 0 \\ 0 & 0 & 1 \end{bmatrix} \qquad A = \begin{pmatrix} a_{11} & a_{12} & \cdots & a_{1n} \\ a_{21} & a_{22} & \cdots & a_{2n} \\ \vdots & \vdots & \ddots & \vdots \\ a_{m1} & a_{m2} & \cdots & a_{mn} \end{pmatrix} $
A small matrix inline, $\left(\begin{smallmatrix} 1 & 0 \\ 0 & 1 \end{smallmatrix}\right)$, keeps the line height.
## Piecewise definitions
$ |x| = \begin{cases} x & \text{if } x \geq 0 \\ -x & \text{otherwise} \end{cases} \qquad f(n) = \begin{cases} n/2 & n \equiv 0 \pmod{2} \\ 3n + 1 & n \equiv 1 \pmod{2} \end{cases} $
$ \operatorname{sgn}(x) = \begin{dcases} \dfrac{x}{|x|} & x \neq 0 \\ 0 & x = 0 \end{dcases} $
## Aligned derivations
$ \begin{aligned} (x + y)^3 &= (x + y)(x + y)^2 \\ &= (x + y)(x^2 + 2xy + y^2) \\ &= x^3 + 3x^2 y + 3x y^2 + y^3 \end{aligned} $
$ \begin{aligned} \int_0^{\pi} \sin^2 x \,\mathrm{d}x &= \int_0^{\pi} \frac{1 - \cos 2x}{2} \,\mathrm{d}x \\ &= \frac{\pi}{2} - \frac{1}{4}\Big[\sin 2x\Big]_0^{\pi} = \frac{\pi}{2} \end{aligned} $
Systems of equations, with a phantom to align the signs:
$ \begin{aligned} 2x + 3y - z &= \phantom{-}5 \\ x - y + 4z &= -2 \\ 3x + 2y + 2z &= \phantom{-}9 \end{aligned} \qquad \Longrightarrow \qquad \begin{pmatrix} 2 & 3 & -1 \\ 1 & -1 & 4 \\ 3 & 2 & 2 \end{pmatrix} \begin{pmatrix} x \\ y \\ z \end{pmatrix} = \begin{pmatrix} 5 \\ -2 \\ 9 \end{pmatrix} $
## Ruled arrays
$ \begin{array}{|l|c|r|} \hline \text{Grade} & \text{Count} & \text{Share} \\ \hline \text{A} & 12 & 24\,\% \\ \text{B} & 23 & 46\,\% \\ \text{C} & 15 & 30\,\% \\ \hline \end{array} \qquad \begin{array}{c|cc} & 0 & 1 \\ \hline 0 & 0 & 1 \\ 1 & 1 & 0 \end{array} $
## Growing delimiters
$ \left( \frac{\frac{a}{b}}{\frac{c}{d}} \right) \qquad \left[ \sum_{i=1}^{n} \frac{1}{i^2} \right]^{2} \qquad \left\{ x \in \mathbb{R} \;\middle|\; x^2 < 2 \right\} \qquad \left. \frac{\mathrm{d}y}{\mathrm{d}x} \right|_{x = 0} \qquad \left\langle \psi \middle| \phi \right\rangle $
$ \Bigg\langle \left\{ \left[ \left( \frac{\frac{\frac{a}{b}}{c}}{d} \right) \right] \right\} \Bigg\rangle \qquad \big( x \big) \; \Big( x \Big) \; \bigg( x \bigg) \; \Bigg( x \Bigg) $
## Braces, stacks and boxes
$ \underbrace{1 + 2 + \cdots + n}_{n \text{ terms}} = \frac{n(n+1)}{2} \qquad \overbrace{x \cdot x \cdots x}^{k \text{ factors}} = x^k \qquad a \overset{\text{def}}{=} b \qquad A \stackrel{f}{\longrightarrow} B $
$ \boxed{E = mc^2} \qquad \boxed{\int_{-\infty}^{\infty} e^{-x^2}\,\mathrm{d}x = \sqrt{\pi}} \qquad {\color{teal} \text{colored}} \quad \textcolor{red}{x} + \textcolor{blue}{y} $
Rendered pages
PDF · 2 pages · 36 KBThe sample documents describe invented organizations in several countries. All names and figures are illustrative.
LaTeX math in Markdown to PDF: every sampleIn the Markdown reference

