Inline math (inside a sentence): wrap in single dollar signs $x^2 + 1$ → $x^2 + 1$
Display math (centered on its own line): wrap in double dollar signs $$x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}$$
This syntax works in Obsidian, MathJax (your HTML files), Overleaf, Jupyter, and MATLAB Live Editor.
| LaTeX Code | Renders As | Description |
|---|---|---|
| a + b | $a + b$ | Addition |
| a - b | $a - b$ | Subtraction |
| a \cdot b | $a \cdot b$ | Multiplication (centered dot) |
| a \times b | $a \times b$ | Multiplication (cross) |
| a \div b | $a \div b$ | Division sign |
| \pm | $\pm$ | Plus or minus |
| \mp | $\mp$ | Minus or plus |
| (a + b) | $(a + b)$ | Parentheses |
| [a + b] | $[a + b]$ | Square brackets |
| \{a, b, c\} | $\{a, b, c\}$ | Curly braces (set notation) |
Curly braces { } are used by LaTeX for grouping (e.g., x^{10}). To display actual braces, escape them: \{ and \}.
| LaTeX Code | Renders As | Description |
|---|---|---|
| x^{2} | $x^{2}$ | Superscript / exponent |
| x^{n} | $x^{n}$ | Variable exponent |
| x^{-1} | $x^{-1}$ | Negative exponent |
| x^{m/n} | $x^{m/n}$ | Rational exponent |
| a^{m} \cdot a^{n} | $a^{m} \cdot a^{n}$ | Product rule setup |
| (a^{m})^{n} | $(a^{m})^{n}$ | Power rule setup |
| x_{n} | $x_{n}$ | Subscript |
| x_{i}^{2} | $x_{i}^{2}$ | Both subscript and superscript |
| \sqrt{x} | $\sqrt{x}$ | Square root |
| \sqrt[3]{x} | $\sqrt[3]{x}$ | Cube root |
| \sqrt[n]{x} | $\sqrt[n]{x}$ | nth root |
| \sqrt{x^2 + y^2} | $\sqrt{x^2 + y^2}$ | Root of an expression |
x^2 works for single characters, but use braces for multi-character exponents: x^{10} gives $x^{10}$, while x^10 gives $x^10$ (only the 1 is raised).
| LaTeX Code | Renders As | Description |
|---|---|---|
| \frac{a}{b} | $\frac{a}{b}$ | Standard fraction |
| \frac{x+1}{x-2} | $\frac{x+1}{x-2}$ | Fraction with expressions |
| \frac{1}{2} | $\frac{1}{2}$ | One-half |
| \dfrac{a}{b} | $\dfrac{a}{b}$ | Display-size fraction (larger) |
| \tfrac{a}{b} | $\tfrac{a}{b}$ | Text-size fraction (smaller) |
| \frac{\frac{a}{b}}{\frac{c}{d}} | $\frac{\frac{a}{b}}{\frac{c}{d}}$ | Nested (complex) fraction |
| LaTeX Code | Renders As | Description |
|---|---|---|
| = | $=$ | Equals |
| \neq | $\neq$ | Not equal |
| \approx | $\approx$ | Approximately equal |
| \equiv | $\equiv$ | Identical / congruent |
| < | $<$ | Less than |
| > | $>$ | Greater than |
| \leq | $\leq$ | Less than or equal |
| \geq | $\geq$ | Greater than or equal |
| \ll | $\ll$ | Much less than |
| \gg | $\gg$ | Much greater than |
| \propto | $\propto$ | Proportional to |
| \sim | $\sim$ | Similar / distributed as |
| \Rightarrow | $\Rightarrow$ | Implies |
| \Leftrightarrow | $\Leftrightarrow$ | If and only if |
| \therefore | $\therefore$ | Therefore |
Lowercase: type \ + the letter name. Uppercase: capitalize the first letter.
| LaTeX Code | Renders As | LaTeX Code | Renders As | Common Use |
|---|---|---|---|---|
| \alpha | $\alpha$ | \beta | $\beta$ | Angles, coefficients |
| \gamma | $\gamma$ | \Gamma | $\Gamma$ | Gamma function |
| \delta | $\delta$ | \Delta | $\Delta$ | Change, discriminant |
| \epsilon | $\epsilon$ | \varepsilon | $\varepsilon$ | Small quantity |
| \theta | $\theta$ | \Theta | $\Theta$ | Angles |
| \lambda | $\lambda$ | \Lambda | $\Lambda$ | Eigenvalues |
| \mu | $\mu$ | \nu | $\nu$ | Mean, frequency |
| \pi | $\pi$ | \Pi | $\Pi$ | 3.14159... |
| \sigma | $\sigma$ | \Sigma | $\Sigma$ | Std dev, summation |
| \tau | $\tau$ | \phi, \varphi | $\phi, \varphi$ | Time constant, angle |
| \omega | $\omega$ | \Omega | $\Omega$ | Angular frequency, ohms |
| \rho | $\rho$ | \eta | $\eta$ | Density, efficiency |
| LaTeX Code | Renders As | Description |
|---|---|---|
| \in | $\in$ | Element of |
| \notin | $\notin$ | Not element of |
| \subset | $\subset$ | Subset |
| \subseteq | $\subseteq$ | Subset or equal |
| \cup | $\cup$ | Union (OR) |
| \cap | $\cap$ | Intersection (AND) |
| \emptyset | $\emptyset$ | Empty set |
| \mathbb{R} | $\mathbb{R}$ | Real numbers |
| \mathbb{Z} | $\mathbb{Z}$ | Integers |
| \mathbb{Q} | $\mathbb{Q}$ | Rational numbers |
| \mathbb{C} | $\mathbb{C}$ | Complex numbers |
| \mathbb{N} | $\mathbb{N}$ | Natural numbers |
| \infty | $\infty$ | Infinity |
| (-\infty, 3) | $(-\infty, 3)$ | Open interval |
| [-2, 5] | $[-2, 5]$ | Closed interval |
| (-3, 7] | $(-3, 7]$ | Half-open interval |
| \forall | $\forall$ | For all |
| \exists | $\exists$ | There exists |
| LaTeX Code | Renders As | Description |
|---|---|---|
| |x| | $|x|$ | Absolute value (simple) |
| \left| \frac{x}{y} \right| | $\left| \frac{x}{y} \right|$ | Absolute value (auto-sized) |
| \left( \frac{a}{b} \right) | $\left( \frac{a}{b} \right)$ | Parentheses (auto-sized) |
| \left[ \frac{a}{b} \right] | $\left[ \frac{a}{b} \right]$ | Brackets (auto-sized) |
| \left\{ \frac{a}{b} \right\} | $\left\{ \frac{a}{b} \right\}$ | Braces (auto-sized) |
\left and \right automatically resize delimiters to fit their content. Always use them around fractions and tall expressions. They must come in pairs.
| LaTeX Code | Renders As | Description |
|---|---|---|
| f(x) | $f(x)$ | Function notation |
| f^{-1}(x) | $f^{-1}(x)$ | Inverse function |
| (f \circ g)(x) | $(f \circ g)(x)$ | Composition |
| \sin x | $\sin x$ | Sine (upright, not italic) |
| \cos \theta | $\cos \theta$ | Cosine |
| \tan x | $\tan x$ | Tangent |
| \csc, \sec, \cot | $\csc, \sec, \cot$ | Other trig functions |
| \arcsin, \arccos, \arctan | $\arcsin, \arccos, \arctan$ | Inverse trig |
| \min, \max | $\min, \max$ | Minimum, maximum |
| \gcd(a, b) | $\gcd(a, b)$ | Greatest common divisor |
| \bmod | $a \bmod b$ | Modular arithmetic |
sin x renders as $sin x$ — LaTeX treats each letter as a separate variable (italic). \sin x renders as $\sin x$ — the function name is upright, which is the correct mathematical typesetting. Always use the backslash versions.
| LaTeX Code | Renders As | Description |
|---|---|---|
| \log x | $\log x$ | Common log (base 10) |
| \log_{b} x | $\log_{b} x$ | Log with specified base |
| \ln x | $\ln x$ | Natural log (base $e$) |
| \log_{2} n | $\log_{2} n$ | Log base 2 |
| e^{x} | $e^{x}$ | Exponential |
| e^{-x} | $e^{-x}$ | Negative exponential |
| e^{i\pi} + 1 = 0 | $e^{i\pi} + 1 = 0$ | Euler's identity |
| \exp(x) | $\exp(x)$ | exp function (for complex args) |
| 10^{n} | $10^{n}$ | Power of 10 |
| LaTeX Code | Renders As | Description |
|---|---|---|
| a + bi | $a + bi$ | Complex number |
| i^2 = -1 | $i^2 = -1$ | Definition of $i$ |
| \bar{z} | $\bar{z}$ | Conjugate |
| \overline{a + bi} | $\overline{a + bi}$ | Conjugate of expression |
| |z| | $|z|$ | Modulus / magnitude |
| \operatorname{Re}(z) | $\operatorname{Re}(z)$ | Real part |
| \operatorname{Im}(z) | $\operatorname{Im}(z)$ | Imaginary part |
Matrices use the bmatrix (brackets), pmatrix (parentheses), or vmatrix (determinant) environments. Columns are separated by &, rows by \\.
$$\begin{bmatrix} a & b \\ c & d \end{bmatrix}$$
Renders as: $\begin{bmatrix} a & b \\ c & d \end{bmatrix}$
$$\begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix}$$
Renders as: $\begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix}$
$$\begin{vmatrix} a & b \\ c & d \end{vmatrix} = ad - bc$$
Renders as: $\begin{vmatrix} a & b \\ c & d \end{vmatrix} = ad - bc$
Augmented matrix (for systems of equations):
$$\left[\begin{array}{ccc|c} 1 & 2 & -1 & 3 \\ 0 & 1 & 3 & 5 \\ 0 & 0 & 1 & 2 \end{array}\right]$$
Renders as: $\left[\begin{array}{ccc|c} 1 & 2 & -1 & 3 \\ 0 & 1 & 3 & 5 \\ 0 & 0 & 1 & 2 \end{array}\right]$
Piecewise function:
$$f(x) = \begin{cases} x^2 & \text{if } x \geq 0 \\ -x & \text{if } x < 0 \end{cases}$$
Renders as: $f(x) = \begin{cases} x^2 & \text{if } x \geq 0 \\ -x & \text{if } x < 0 \end{cases}$
System of equations (aligned):
$$\begin{cases} 2x + 3y = 7 \\ x - y = 1 \end{cases}$$
Renders as: $\begin{cases} 2x + 3y = 7 \\ x - y = 1 \end{cases}$
| LaTeX Code | Renders As | Description |
|---|---|---|
| \cdots | $\cdots$ | Centered dots (horizontal) |
| \ldots | $\ldots$ | Low dots |
| \vdots | $\vdots$ | Vertical dots |
| \ddots | $\ddots$ | Diagonal dots |
| \hat{x} | $\hat{x}$ | Hat (estimate) |
| \bar{x} | $\bar{x}$ | Bar (mean / conjugate) |
| \vec{v} | $\vec{v}$ | Vector arrow |
| \mathbf{v} | $\mathbf{v}$ | Bold vector |
| \tilde{x} | $\tilde{x}$ | Tilde |
| \dot{x} | $\dot{x}$ | Dot (time derivative) |
| \ddot{x} | $\ddot{x}$ | Double dot |
| \overbrace{a+b}^{n} | $\overbrace{a+b}^{n}$ | Overbrace with label |
| \underbrace{a+b}_{n} | $\underbrace{a+b}_{n}$ | Underbrace with label |
| \boxed{x = 5} | $\boxed{x = 5}$ | Boxed answer |
| \quad | $a \quad b$ | Large space |
| \qquad | $a \qquad b$ | Extra-large space |
| \, | $a \, b$ | Thin space |
| \text{if} | $\text{if}$ | Normal text inside math |
| LaTeX Code | Renders As | Use Case |
|---|---|---|
| \text{hello} | $\text{hello}$ | Words inside math mode |
| \textbf{bold} | $\textbf{bold}$ | Bold text in math |
| \mathbf{AB} | $\mathbf{AB}$ | Bold math (matrices, vectors) |
| \mathbb{R} | $\mathbb{R}$ | Blackboard bold (number sets) |
| \mathcal{L} | $\mathcal{L}$ | Calligraphic (Lagrangian, etc.) |
| \mathrm{pH} | $\mathrm{pH}$ | Roman (non-italic) in math |
| \color{red}{x} | $\color{red}{x}$ | Colored math |
| \cancel{x} | Strikethrough $x$ | Cancel a term (needs cancel pkg) |
These show how the commands combine into real algebra expressions. Copy these as templates for your own work.
Quadratic formula:
$$x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}$$
$x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}$
Exponent rules:
$$a^m \cdot a^n = a^{m+n} \qquad \frac{a^m}{a^n} = a^{m-n} \qquad (a^m)^n = a^{mn}$$
$a^m \cdot a^n = a^{m+n} \qquad \frac{a^m}{a^n} = a^{m-n} \qquad (a^m)^n = a^{mn}$
Distance formula:
$$d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}$$
$d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}$
Slope:
$$m = \frac{y_2 - y_1}{x_2 - x_1}$$
$m = \frac{y_2 - y_1}{x_2 - x_1}$
Compound interest:
$$A = P\left(1 + \frac{r}{n}\right)^{nt}$$
$A = P\left(1 + \frac{r}{n}\right)^{nt}$
Logarithm properties:
$$\log_b(xy) = \log_b x + \log_b y \qquad \log_b\left(\frac{x}{y}\right) = \log_b x - \log_b y \qquad \log_b(x^n) = n\log_b x$$
$\log_b(xy) = \log_b x + \log_b y \qquad \log_b\!\left(\frac{x}{y}\right) = \log_b x - \log_b y \qquad \log_b(x^n) = n\log_b x$
Ellipse:
$$\frac{(x-h)^2}{a^2} + \frac{(y-k)^2}{b^2} = 1$$
$\frac{(x-h)^2}{a^2} + \frac{(y-k)^2}{b^2} = 1$
3×3 augmented matrix:
$$\left[\begin{array}{ccc|c} 1 & 1 & 1 & 6 \\ 2 & -1 & 1 & 3 \\ 1 & 2 & -1 & 2 \end{array}\right] \xrightarrow{\text{RREF}} \left[\begin{array}{ccc|c} 1 & 0 & 0 & 1 \\ 0 & 1 & 0 & 2 \\ 0 & 0 & 1 & 3 \end{array}\right]$$
$\left[\begin{array}{ccc|c} 1 & 1 & 1 & 6 \\ 2 & -1 & 1 & 3 \\ 1 & 2 & -1 & 2 \end{array}\right] \xrightarrow{\text{RREF}} \left[\begin{array}{ccc|c} 1 & 0 & 0 & 1 \\ 0 & 1 & 0 & 2 \\ 0 & 0 & 1 & 3 \end{array}\right]$
Absolute value inequality:
$$|2x - 5| < 3 \quad \Rightarrow \quad -3 < 2x - 5 < 3 \quad \Rightarrow \quad 1 < x < 4$$
$|2x - 5| < 3 \quad \Rightarrow \quad -3 < 2x - 5 < 3 \quad \Rightarrow \quad 1 < x < 4$
Partial fraction decomposition:
$$\frac{5x + 7}{(x+1)(x-3)} = \frac{A}{x+1} + \frac{B}{x-3}$$
$\frac{5x + 7}{(x+1)(x-3)} = \frac{A}{x+1} + \frac{B}{x-3}$
| LaTeX Code | Renders As | Description |
|---|---|---|
| \lim_{x \to a} f(x) | $\lim_{x \to a} f(x)$ | Limit as $x$ approaches $a$ |
| \lim_{x \to \infty} | $\lim_{x \to \infty}$ | Limit at infinity |
| \lim_{x \to 0^+} | $\lim_{x \to 0^+}$ | Right-hand limit |
| \lim_{x \to 0^-} | $\lim_{x \to 0^-}$ | Left-hand limit |
| \lim_{h \to 0} | $\lim_{h \to 0}$ | Limit definition of derivative |
| \to | $\to$ | Approaches arrow |
| LaTeX Code | Renders As | Description |
|---|---|---|
| f'(x) | $f'(x)$ | Prime notation |
| f''(x) | $f''(x)$ | Second derivative |
| f^{(n)}(x) | $f^{(n)}(x)$ | $n$th derivative |
| \frac{dy}{dx} | $\frac{dy}{dx}$ | Leibniz notation |
| \frac{d}{dx}\left[f(x)\right] | $\frac{d}{dx}\left[f(x)\right]$ | Operator notation |
| \frac{d^2 y}{dx^2} | $\frac{d^2 y}{dx^2}$ | Second derivative (Leibniz) |
| \frac{\partial f}{\partial x} | $\frac{\partial f}{\partial x}$ | Partial derivative |
| \dot{x} | $\dot{x}$ | Time derivative (Newton) |
| \ddot{x} | $\ddot{x}$ | Second time derivative |
| \nabla f | $\nabla f$ | Gradient |
Limit definition of the derivative:
$$f'(x) = \lim_{h \to 0} \frac{f(x+h) - f(x)}{h}$$
$f'(x) = \lim_{h \to 0} \frac{f(x+h) - f(x)}{h}$
Chain rule:
$$\frac{dy}{dx} = \frac{dy}{du} \cdot \frac{du}{dx}$$
$\frac{dy}{dx} = \frac{dy}{du} \cdot \frac{du}{dx}$
| LaTeX Code | Renders As | Description |
|---|---|---|
| \int f(x)\,dx | $\int f(x)\,dx$ | Indefinite integral |
| \int_{a}^{b} f(x)\,dx | $\int_{a}^{b} f(x)\,dx$ | Definite integral |
| \int_0^\infty | $\int_0^\infty$ | Improper integral |
| \iint | $\iint$ | Double integral |
| \iiint | $\iiint$ | Triple integral |
| \oint | $\oint$ | Contour integral |
Writing \int f(x)\,dx adds a thin space before $dx$. This is standard mathematical typesetting — compare $\int f(x)dx$ (no space) with $\int f(x)\,dx$ (with \,). Always include it.
| LaTeX Code | Renders As | Description |
|---|---|---|
| \sum_{k=1}^{n} k | $\sum_{k=1}^{n} k$ | Finite sum |
| \sum_{n=0}^{\infty} a_n | $\sum_{n=0}^{\infty} a_n$ | Infinite series |
| \prod_{i=1}^{n} i | $\prod_{i=1}^{n} i$ | Product ($n$ factorial) |
| n! | $n!$ | Factorial |
| \binom{n}{k} | $\binom{n}{k}$ | Binomial coefficient |
Power rule:
$$\frac{d}{dx}\left[x^n\right] = nx^{n-1}$$
$\frac{d}{dx}\left[x^n\right] = nx^{n-1}$
Fundamental Theorem of Calculus:
$$\int_a^b f(x)\,dx = F(b) - F(a) \quad \text{where } F'(x) = f(x)$$
$\int_a^b f(x)\,dx = F(b) - F(a) \quad \text{where } F'(x) = f(x)$
Taylor series:
$$f(x) = \sum_{n=0}^{\infty} \frac{f^{(n)}(a)}{n!}(x - a)^n$$
$f(x) = \sum_{n=0}^{\infty} \frac{f^{(n)}(a)}{n!}(x - a)^n$
Euler's number from a limit:
$$e = \lim_{n \to \infty} \left(1 + \frac{1}{n}\right)^n$$
$e = \lim_{n \to \infty} \left(1 + \frac{1}{n}\right)^n$
Integration by parts:
$$\int u\,dv = uv - \int v\,du$$
$\int u\,dv = uv - \int v\,du$
L'Hôpital's rule:
$$\lim_{x \to a} \frac{f(x)}{g(x)} = \lim_{x \to a} \frac{f'(x)}{g'(x)}$$
$\lim_{x \to a} \frac{f(x)}{g(x)} = \lim_{x \to a} \frac{f'(x)}{g'(x)}$
Gaussian integral (beautiful result):
$$\int_{-\infty}^{\infty} e^{-x^2}\,dx = \sqrt{\pi}$$
$\int_{-\infty}^{\infty} e^{-x^2}\,dx = \sqrt{\pi}$
State-space equation (connects to Kalman filters):
$$\dot{\mathbf{x}} = \mathbf{A}\mathbf{x} + \mathbf{B}\mathbf{u}$$
$\dot{\mathbf{x}} = \mathbf{A}\mathbf{x} + \mathbf{B}\mathbf{u}$