Math with KaTeX
This blog supports mathematical notation using KaTeX. You can use LaTeX syntax to render math equations.
Inline Math
You can write inline math by wrapping your equation in single dollar signs $.
For example, $E = mc^2$ renders as .
Block Math
For larger equations that should be displayed on their own line, use double dollar signs $$.
$$\int_{0}^{\infty} x^2 e^{-x} \, dx = 2!$$Renders as:
Common Notations Reference
Here is a quick reference for the most commonly used mathematical notations.
Roots and Exponents
| Notation | LaTeX Code | Result |
|---|---|---|
| Square Root | \sqrt{x} | |
| Complex Root | \sqrt{x^2 + y^2} | |
| N-th Root | \sqrt[3]{x} | |
| Superscript | x^2 | |
| Subscript | x_i |
Trigonometry
| Notation | LaTeX Code | Result |
|---|---|---|
| Sine | \sin(x) | |
| Cosine | \cos(x) | |
| Tangent | \tan(x) | |
| Theta | \theta | |
| Identity | \sin^2(\theta) + \cos^2(\theta) = 1 |
Logarithms and Calculus
| Notation | LaTeX Code | Result |
|---|---|---|
| Logarithm | \log(x) | |
| Natural Log | \ln(x) | |
| Limit | \lim_{x \to \infty} | |
| Integral | \int_{a}^{b} |
Operators and Logic
| Notation | LaTeX Code | Result |
|---|---|---|
| Plus/Minus | \pm | |
| Multiply | \times or \cdot | or |
| Divide | \div | |
| Approx | \approx | |
| Not Equal | \neq | |
| Infinity | \infty | |
| For All | \forall | |
| Exists | \exists |
Boolean Logic
| Notation | LaTeX Code | Result |
|---|---|---|
| AND | \land | |
| OR | \lor | |
| NOT | \neg | |
| Implies | \implies | |
| Equivalent | \iff | |
| XOR | \oplus | |
| True | \top | |
| False | \bot |
Example:
$(P \land Q) \implies R$
Functions
You can define functions using standard algebraic notation.
Simple Function:
$f(x) = \sin(x) + \cos(x)$
Piecewise Function:
$$f(x) = \begin{cases} x^2 & \text{if } x > 0 \\ -x & \text{if } x \le 0\end{cases}$$Derivatives
Express derivatives using prime notation or Leibniz notation.
Prime Notation:
$f'(x) = 2x + 1$
Leibniz Notation:
$\frac{dy}{dx} = 3x^2$
Limit Definition:
$$\frac{df}{dx} = \lim_{h \to 0} \frac{f(x+h) - f(x)}{h}$$Polynomials
Polynomials are straightforward to write using superscripts ^ for exponents.
General Form:
$P(x) = a_n x^n + a_{n-1} x^{n-1} + \cdots + a_1 x + a_0$
Cubic Polynomial:
$y = 4x^3 - 2x^2 + 7x - 5$
Roots (Quadratic Formula):
$x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}$
Matrices
$$\begin{pmatrix}a & b \\c & d\end{pmatrix}$$Enjoy writing math in your posts!