Markdown Math Formulas
LaTeX Math Formula Basics
In Markdown, mathematical formulas are represented using LaTeX syntax. LaTeX is a powerful typesetting system, especially suitable for documents containing complex mathematical formulas.
Basic Syntax Structure
- Command: starting with a backslash
\at the beginning, such as\alpha、\sum - Parameter: enclosed in curly braces
{}such as\frac{a}{b} - Subscript: use
_, such asx_1 - Superscript: use
^, such asx^2 - Grouping: combining multiple characters with curly braces, such as
x_{i+1}
Common LaTeX Commands
\alpha, \beta, \gamma % 希腊字母
\sum, \prod, \int % 求和、乘积、积分
\frac{分子}{分母} % 分数
\sqrt{表达式} % 平方根
\sqrt[n]{表达式} % n次根
Inline Formulas and Block Formulas
Inline Formula
Inline formulas use a single dollar sign$to enclose; the formula is embedded in the text, e.g., the variable $x = 5$ and the function $f(x) = x^2 + 2x + 1$.
文本中的变量 $x = 5$ 和函数 $f(x) = x^2 + 2x + 1$。

Block Formula
Block formulas use double dollar signs$$to enclose; the formula is placed on its own line and centered:
E = mc^2
\int_{-\infty}^{\infty} e^{-x^2} dx = \sqrt{\pi}
$$E = mc^2$$
$$\int_{-\infty}^{\infty} e^{-x^2} dx = \sqrt{\pi}$$

Multi-line Formulas
Use thealignenvironment to create multi-line aligned formulas:
\begin{align}
f(x) &= ax^2 + bx + c \
f'(x) &= 2ax + b \
f''(x) &= 2a
\end{align}
$$
\begin{align}
f(x) &= ax^2 + bx + c \\
f'(x) &= 2ax + b \\
f''(x) &= 2a
\end{align}
$$

Common Mathematical Symbols
Basic Operation Symbols
- Addition, subtraction, multiplication, division:
+,-,\times,\div - Fractions:
\frac{a}{b}→ $\frac{a}{b}$ - Square root:
\sqrt{x},\sqrt[n]{x}→ $\sqrt{x}$, $\sqrt[n]{x}$ - Exponents:
x^2,e^{i\pi}→ $x^2$, $e^{i\pi}$
Comparison Symbols
- Equals:
=,\neq,\equiv→ $=$, $\neq$, $\equiv$ - Greater than / less than:
<,>,\leq,\geq→ $<$, $>$, $\leq$, $\geq$ - Approximately equal to:
\approx,\sim→ $\approx$, $\sim$
Set Symbols
- Belongs to:
\in,\notin→ $\in$, $\notin$ - Contains:
\subset,\supset→ $\subset$, $\supset$ - Intersection and union:
\cap,\cup→ $\cap$, $\cup$ - Empty set:
\emptyset→ $\emptyset$
Greek Letters
Common Greek letters and their LaTeX representations:
| Lowercase | Uppercase | LaTeX | Lowercase | Uppercase | LaTeX |
|---|---|---|---|---|---|
| α | Α | \alpha |
ν | Ν | \nu |
| β | Β | \beta |
ο | Ο | o |
| γ | Γ | \gamma |
π | Π | \pi |
| δ | Δ | \delta |
ρ | Ρ | \rho |
| ε | Ε | \epsilon |
σ | Σ | \sigma |
| θ | Θ | \theta |
τ | Τ | \tau |
| λ | Λ | \lambda |
φ | Φ | \phi |
| μ | Μ | \mu |
ω | Ω | \omega |
Special Functions and Symbols
- Trigonometric functions:
\sin,\cos,\tan - Logarithms:
\log,\ln - Limits:
\lim_{x \to 0} - Summation:
\sum_{i=1}^{n} - Integrals:
\int_{a}^{b} - Infinity:
\infty
Matrix Representation
Use thematrixenvironment:
\begin{pmatrix}
a & b \
c & d
\end{pmatrix}
$$
\begin{pmatrix}
a & b \\
c & d
\end{pmatrix}
$$
Matrices with different bracket types:
pmatrix: parentheses $\begin{pmatrix} a & b \ c & d \end{pmatrix}$bmatrix: square brackets $\begin{bmatrix} a & b \ c & d \end{bmatrix}$vmatrix: determinant $\begin{vmatrix} a & b \ c & d \end{vmatrix}$