Beautiful math on Quora
[math]\LaTeX[/math] in less than 10 minutes
IntroductionArithmeticText, Style and SpacingEqualitiesGeometryFunctionsSums and SeriesInfinityLogicSetsCombinatoricsComplex NumbersCalculusVectorsMatrices

Introduction

To enter math mode, click on show more …
Click on the three dots in the edit bar
… then click on the sigma button
Click on the Sigma button
Press Σ again to end math mode
Closing math mode
Keyboard shortcuts are often easier to use
Cmd + Shift + L or Ctrl + Shift + L
For question titles, you can use [math] and [/math]
Surround your math with `[math]` and `[/math]` (without the quotes)
Click on ‘Suggest Edits’ to see others’ [math]\LaTeX[/math] code
Click on the three dots on the right of an answer, then click on suggest edits
De[math]\TeX[/math]ify helps you with finding the name of a symbol
Draw the symbol you want, and DeTeXify find the name for you
Code editors like [math]\TeX[/math]paste can speed up your work
Code editors come with buttons that will insert special characters

Arithmetic

Basic Operators

Basic operators work as expected
1 + 2 - 3 = 0
[math]1 + 2 - 3 = 0[/math]
Division can be done as follows
1/2 = 1 \div 2 = \frac{1}{2}
[math]1/2 = 1 \div 2 = \frac{1}{2}[/math]
To typeset bigger fractions, use
\dfrac{1}{2}
[math]\dfrac{1}{2}[/math]
Or use \displaystyle.
\displaystyle \frac{1}{3}
[math]\displaystyle \frac{1}{3}[/math]
Multiplication
2 \cdot 3 = 2 \times 3
[math]2 \cdot 3 = 2 \times 3[/math]
Avoid using * for multiplication
2 * 3
[math]2 * 3[/math]
Repeated decimals can be denoted by a bar
\frac{1}{3} = 0.\bar 3
[math]\frac{1}{3} = 0.\bar 3[/math]

Exponents and Indexes

Exponents can by typeset with a caret
2^3 = 8
[math]2^3 = 8[/math]
Use braces to group exponents …
2^{10}
[math]2^{10}[/math]
… to avoid
2^10
[math]2^10[/math]
Subscripts, like indices, can by typeset as follows
a_n = 2 \cdot a_{n-1}
[math]a_n = 2 \cdot a_{n-1}[/math]

Square Roots

A square root can be typeset with
\sqrt{16} = 4
[math]\sqrt{16} = 4[/math]
To take the [math]n^\text{th}[/math] root, use
\sqrt[3]{27} = 3
[math]\sqrt[3]{27} = 3[/math]
\pm becomes a plus-minus.
x^2 = 4 \implies x = \pm \sqrt{4}
[math]x^2 = 4 \implies x = \pm \sqrt{4}[/math]
Braces can be omitted if the argument is only 1 symbol
\sqrt 2
[math]\sqrt 2[/math]

Delimiters

For large parentheses, use \left and \right
\left( \dfrac{1}{x} \right)
[math]\left( \dfrac{1}{x} \right)[/math]
… to avoid the following
(\dfrac{1}{x})
[math](\dfrac{1}{x})[/math]
This can also be used with |, [, …
\left| \frac{x + 1}{x - 1} \right|
[math]\left| \frac{x + 1}{x - 1} \right|[/math]
Floor can be obtained with \lfloor and \rfloor
\left\lfloor \frac{1}{2} \right\rfloor
[math]\left\lfloor \frac{1}{2} \right\rfloor[/math]
\| becomes a double bar
\left\| \frac{z}{a} \right\|
[math]\left\| \frac{z}{a} \right\|[/math]
Angle brackets can be typeset as follows
\langle x^2 + 1 \rangle
[math]\langle x^2 + 1 \rangle[/math]
To make them automatically grow, use
\left< \dfrac{1}{2} \right>
[math]\left< \dfrac{1}{2} \right>[/math]

Text, Style and Spacing

Text

Use \text
\text{Area 1}
[math]\text{Area 1}[/math]
… to avoid the following
Area 1
[math]Area 1[/math]
This can be useful for ordinals
5^\text{th}
[math]5^\text{th}[/math]

Style

From small …
\tiny 2
\scriptsize 2
\small 2
\normalsize 2
\large 2
[math]\tiny 2 \scriptsize 2 \small 2 \normalsize 2 \large 2[/math]
… to big
\Large 2
\LARGE 2
\huge 2
\Huge 2
[math]\Large 2 \LARGE 2 \huge 2 \Huge 2[/math]
Add some color
\huge
\color{green}{\ddot \smile}
[math]\huge \color{green}{\ddot \smile}[/math]
HTML colors are valid too
\huge
\color{#0f0}{\checkmark}
[math]\huge \color{#0f0}{\checkmark}[/math]

Spacing

adds a space with the width of a space
\blacksquare \ \blacksquare
[math]\blacksquare \ \blacksquare[/math]
\quad and \qquad are bigger spaces
\blacksquare \quad
\blacksquare \qquad
\blacksquare
[math]\blacksquare \quad \blacksquare \qquad \blacksquare[/math]
\: and \, are small spaces
\blacksquare \:
\blacksquare \,
\blacksquare
[math]\blacksquare \: \blacksquare \, \blacksquare[/math]
Small spaces are useful to group digits
54\,321
[math]54\,321[/math]

Equalities

(In)equalities
1 + 1 = 2 \ne 3 \approx \pi
[math]1 + 1 = 2 \ne 3 \approx \pi[/math]
Adding a tag will add a number and center your equation
A = b \cdot h \tag 1
[math]A = b \cdot h \tag 1[/math]
Using tag* will remove the parentheses
A = b \cdot h \tag* 2
[math]A = b \cdot h \tag* 2[/math]
To center an equation without a tag, the following works
A = b \cdot h \tag*{}
[math]A = b \cdot h \tag*{}[/math]
\lt stands for less than
3 \lt x \le 4
[math]3 \lt x \le 4[/math]
\gt stands for greater than
x \gt 3
[math]x \gt 3[/math]
\ge stands for greater than or equal to
x \ge 3
[math]x \ge 3[/math]
\not can be used to negate anything, but is often ugly
x \not\gt 4
[math]x \not\gt 4[/math]
[math]T[/math] is proportional to [math]p[/math]
T \propto p \text{ or } T \sim p
[math]T \propto p \text{ or } T \sim p[/math]

Alignment of Equal Signs

Align equal signs as follows
\begin{align}
    2 + 2 &= 4 \\
    2     &= 4 - 2
\end{align}
[math]\begin{align} 2 + 2 &= 4 \\ 2 &= 4 - 2 \end{align}[/math]
You can also give a tag to a line
\begin{align}
    2 + 2 &= 4     \tag 1 \\
    2     &= 4 - 2        \\
    2     &= 2     \tag a
\end{align}
[math]\begin{align} 2 + 2 &= 4 \tag 1 \\ 2 &= 4 - 2 \\ 2 &= 2 \tag a \end{align}[/math]
To give some more explanation, add some text
\begin{align}
    2 + 2 &= 4                             \tag 1 \\
    2     &= 4 - 2 && \text{subtracting 2}        \\
    2     &= 2                             \tag a
\end{align}
[math]\begin{align} 2 + 2 &= 4 \tag 1 \\ 2 &= 4 - 2 && \text{subtracting 2} \\ 2 &= 2 \tag a \end{align}[/math]
System of equations
S = \left\{
\begin{align}
    a + b     &= 4\\
    a \cdot b &= 4
    \end{align}
\right.
[math]S = \left\{ \begin{align} a + b &= 4\\ a \cdot b &= 4 \end{align} \right.[/math]

Annotating Equalities

Overset can be used to stack symbols
2 \overset{?}{=} 3
[math]2 \overset{?}{=} 3[/math]
Arrows are sometimes too short
\overset{\text{some text}}{\rightarrow}
[math]\overset{\text{some text}}{\rightarrow}[/math]
Use \xrightarrow instead
\xrightarrow{\text{some text}}
[math]\xrightarrow{\text{some text}}[/math]
Underbrace and overbrace in action
(\cos x + \sin x)^2 =
    \underbrace{\cos^2 x + \sin^2 x}_{1} +
    \overbrace{2 \sin x \cos x}^{\sin 2x}
[math](\cos x + \sin x)^2 = \underbrace{\cos^2 x + \sin^2 x}_{1} + \overbrace{2 \sin x \cos x}^{\sin 2x}[/math]

Modulo

If [math]\text{mod}[/math] is used as a binary operator
7 \bmod 4 = 3
[math]7 \bmod 4 = 3[/math]
If it's used after an equation
7 \equiv 3 \pmod 4
[math]7 \equiv 3 \pmod 4[/math]
Without parentheses
7 \equiv 3 \mod 4
[math]7 \equiv 3 \mod 4[/math]

Geometry

Angles

Use \angle to denote an angle
\angle A = 90^\circ
[math]\angle A = 90^\circ[/math]
\hat and \widehat are another possibility
\hat A = \widehat{BAC} = 90^\circ
[math]\hat A = \widehat{BAC} = 90^\circ[/math]
For radians, the following works
\angle A = \frac{\pi}{2} \text{ radians}
[math]\angle A = \frac{\pi}{2} \text{ radians}[/math]

Greek Letters

Some Greek letters
\alpha \beta \gamma \delta
[math]\alpha \beta \gamma \delta[/math]
Greek uppercase letters
\Gamma \Delta \Theta \Xi \Lambda
[math]\Gamma \Delta \Theta \Xi \Lambda[/math]
Phi and epsilon have variants
\phi, \varphi \quad \epsilon, \varepsilon
[math]\phi, \varphi \quad \epsilon, \varepsilon[/math]
Likewise for theta, kappa …
\theta, \vartheta \quad \kappa, \varkappa
[math]\theta, \vartheta \quad \kappa, \varkappa[/math]
… pi and rho
\pi, \varpi \quad \rho, \varrho
[math]\pi, \varpi \quad \rho, \varrho[/math]

Other Symbols

Useful shapes
\triangle, \square, \bigcirc
[math]\triangle, \square, \bigcirc[/math]
Perpendicular
AB \perp BC
[math]AB \perp BC[/math]
Parallel
AB \parallel CD
[math]AB \parallel CD[/math]
Similarity
\triangle ABC \sim \triangle CEF
[math]\triangle ABC \sim \triangle CEF[/math]
Congruence
\triangle ABC \cong \triangle CEF
[math]\triangle ABC \cong \triangle CEF[/math]

Functions

Standard Functions

Write standard functions with a backslash
\log x
[math]\log x[/math]
Not doing so gives bad results
log x
[math]log x[/math]
Lots of functions are available …
\exp x, \sin x, \arccos x, \cosh x, \max x
[math]\exp x, \sin x, \arccos x, \cosh x, \max x[/math]

Introducing Functions

Some functions aren't available.
Use operatorname
\operatorname{arccosh} x
[math]\operatorname{arccosh} x[/math]
Another way of defining a function
\begin{align}
    f\colon \mathbb R &\to \mathbb R^+\\
    x                 &\mapsto x^2
\end{align}
[math]\begin{align} f\colon \mathbb R &\to \mathbb R^+\\ x &\mapsto x^2 \end{align}[/math]
Piecewise functions
f(x) = \begin{cases}
    x   & \text{if $x \gt 0$}\\
    x^2 & \text{else}
\end{cases}
[math]f(x) = \begin{cases} x & \text{if $x \gt 0$}\\ x^2 & \text{else} \end{cases}[/math]

Operations with Functions

Derivative
f'(x) = \frac{df}{dx}
[math]f'(x) = \frac{df}{dx}[/math]
Composition
(f \circ g)(x) = f(g(x))
[math](f \circ g)(x) = f(g(x))[/math]
Inverse
f^{-1}(x)
[math]f^{-1}(x)[/math]

Sums and Series

Summation and Products

Typesetting sums is easy
\sum_{n=1}^\infty x^n
[math]\sum_{n=1}^\infty x^n[/math]
\displaystyle makes it breathe some more
\displaystyle \sum_{n=1}^\infty x^n
[math]\displaystyle \sum_{n=1}^\infty x^n[/math]
\limits maintains the small style, but shifts
the limits to the bottom of the sum
\sum\limits_{n=1}^\infty x^n
[math]\sum\limits_{n=1}^\infty x^n[/math]
Products can be typeset in a similar fashion
\displaystyle \prod_{n=1}^\infty x^n
[math]\displaystyle \prod_{n=1}^\infty x^n[/math]

Continuation Dots

Never use to make dots
1 + 2 - 3 + 4 ...
[math]1 + 2 - 3 + 4 ...[/math]
\ldots gives low dots
1, 2, \ldots, 10
[math]1, 2, \ldots, 10[/math]
\cdots gives centered dots
f(x) = x + x^2 + x^3 + \cdots
[math]f(x) = x + x^2 + x^3 + \cdots[/math]
Vertical and diagonal dots are useful in matrices
\begin{pmatrix}
    1 & 1 & \cdots & 1 \\
    0 & 1 & \cdots & 1 \\
    0 & 0 & \ddots & \vdots \\
    0 & 0 & 0      & 1
\end{pmatrix}
[math]\begin{pmatrix} 1 & 1 & \cdots & 1 \\ 0 & 1 & \cdots & 1 \\ 0 & 0 & \ddots & \vdots \\ 0 & 0 & 0 & 1 \end{pmatrix}[/math]

Infinity

The inf(ini)ty symbol
\infty
[math]\infty[/math]
Cardinal infinity
|\mathbb N| = \aleph_0
[math]|\mathbb N| = \aleph_0[/math]
Ordinal infinity
\omega^\omega = \text{big}
[math]\omega^\omega = \text{big}[/math]
Complex infinity
\tilde\infty
[math]\tilde\infty[/math]

Logic

Logical or, logical and
a \lor b \land c
[math]a \lor b \land c[/math]
Negation
\bar{c} \equiv \lnot c
[math]\bar{c} \equiv \lnot c[/math]
True and false
\top \land \bot \equiv \bot
[math]\top \land \bot \equiv \bot[/math]
Implications
(a \implies b) \iff (b \impliedby a)
[math](a \implies b) \iff (b \impliedby a)[/math]
Quantifiers
\forall A, \exists B : A \lt B
[math]\forall A, \exists B : A \lt B[/math]

Sets

Braces

{} don't work, as they group objects
{1, 2, 3}
[math]{1, 2, 3}[/math]
Escape them with a backslash
\{1, 2, 3\}
[math]\{1, 2, 3\}[/math]
Use \mathbb to get double stroked letters
\mathbb{N} = \{0, 1, 2, 3, \ldots \}
[math]\mathbb{N} = \{0, 1, 2, 3, \ldots \}[/math]
\mid inserts a vertical bar
\{n^2 \mid n \in \mathbb{N}\}
[math]\{n^2 \mid n \in \mathbb{N}\}[/math]

Cup and Cap

Unify and intersect
A \cup B = C \cap D
[math]A \cup B = C \cap D[/math]
Element of a set
x \in A
[math]x \in A[/math]
Superset and subset are self-explanatory
A \subset B \iff B \supset A
[math]A \subset B \iff B \supset A[/math]
Add eq to get
A \subseteq B
[math]A \subseteq B[/math]
To subtract a set, write
\mathbb N_0 = \mathbb N \setminus \{0\}
[math]\mathbb N_0 = \mathbb N \setminus \{0\}[/math]

Others

Empty set
\emptyset = \varnothing
[math]\emptyset = \varnothing[/math]
Powerset
\mathcal P \{1, 2\} = \{\{\}, \{1\}, \{2\}, \{1,2\} \}
[math]\mathcal P \{1, 2\} = \{\{\}, \{1\}, \{2\}, \{1,2\} \}[/math]

Combinatorics

Factorial
4! = 4 \cdot 3 \cdot 2 \cdot 1
[math]4! = 4 \cdot 3 \cdot 2 \cdot 1[/math]
Binomial notation
{n \choose r} = \binom{n}{r} = \frac{n!}{(n-r)!r!}
[math]{n \choose r} = \binom{n}{r} = \frac{n!}{(n-r)!r!}[/math]
Other ways
{}^n\text{C}_r = {}_n\text{C}_r = \text{C}_r^n
[math]{}^n\text{C}_r = {}_n\text{C}_r = \text{C}_r^n[/math]

Complex Numbers

The complex set
a + ib \in \mathbb C
[math]a + ib \in \mathbb C[/math]
The real part
\Re \left( e^{ix} \right) = \cos x
[math]\Re \left( e^{ix} \right) = \cos x[/math]
The imaginary part
\Im \left( e^{ix} \right) = \sin x
[math]\Im \left( e^{ix} \right) = \sin x[/math]
The conjugate of a number
\overline z = \Re (z) - i \Im (z)
[math]\overline z = \Re (z) - i \Im (z)[/math]
The magnitude
|z| = \| z \|
[math]|z| = \| z \|[/math]
The argument
\arg z
[math]\arg z[/math]

Calculus

Limits

Limits can be typeset with a subscript
\lim_{x \to \infty} x^2 = \infty
[math]\lim_{x \to \infty} x^2 = \infty[/math]
Displaystyle makes it breathe more
\displaystyle\lim_{x \to \infty} x^2 = \infty
[math]\displaystyle\lim_{x \to \infty} x^2 = \infty[/math]

Derivatives

Typeset derivatives using fractions
\dfrac{dy}{dx}
[math]\dfrac{dy}{dx}[/math]
If you want [math]\mathrm d[/math] to be upright, use
\dfrac{\mathrm dy}{\mathrm dx}
[math]\dfrac{\mathrm dy}{\mathrm dx}[/math]
Derivative at a point
\left. \dfrac{dy}{dx} \right|_{x=0}
[math]\left. \dfrac{dy}{dx} \right|_{x=0}[/math]
Partial derivatives
\dfrac{\partial f(x,y)}{\partial x} = f_x
[math]\dfrac{\partial f(x,y)}{\partial x} = f_x[/math]
Difference quotients
\dfrac{\Delta y}{\Delta x}
[math]\dfrac{\Delta y}{\Delta x}[/math]
Derivates w.r.t. time
\dot x, \ddot x
[math]\dot x, \ddot x[/math]

Integrals

Here, \, adds a small space
\int x \, dx = \frac{x^2}{2}
[math]\int x \, dx = \frac{x^2}{2}[/math]
For an upright [math]\mathrm d[/math], use
\int x \, \mathrm dx = \frac{x^2}{2}
[math]\int x \, \mathrm dx = \frac{x^2}{2}[/math]
Never use consecutive \ints
\int \int x^2 + y^2 \,dx \,dy
[math]\int \int x^2 + y^2 \,dx \,dy[/math]
Use \iint instead
\iint x^2 + y^2 \,dx \, dy
[math]\iint x^2 + y^2 \,dx \, dy[/math]
Lower and upper bounds
\int_a^b x \, dx
[math]\int_a^b x \, dx[/math]
Displaystyle makes it breathe more
\displaystyle\int_a^b x \, dx
[math]\displaystyle\int_a^b x \, dx[/math]
Evaluating integrals. \left. is an invisible bracket
\displaystyle
\int_0^1 x \, dx = \left. \frac{x^2}{2} \right|_0^1
[math]\displaystyle \int_0^1 x \, dx = \left. \frac{x^2}{2} \right|_0^1[/math]
Closed path integral
\displaystyle
\oint_C \mathbf F \cdot d \mathbf r
[math]\displaystyle \oint_C \mathbf F \cdot d \mathbf r[/math]
\limits places the boundaries under the integral sign
\displaystyle\oint\limits_C \mathbf F \cdot d \mathbf r
[math]\displaystyle\oint\limits_C \mathbf F \cdot d \mathbf r[/math]

Vectors

Choose one of the following
\mathbf{u} = \vec u
[math]\mathbf{u} = \vec u[/math]
Use \imath and \jmath for unit vectors …
\hat \imath, \hat \jmath, \hat k
[math]\hat \imath, \hat \jmath, \hat k[/math]
… to avoid
\hat i, \hat j, \hat k
[math]\hat i, \hat j, \hat k[/math]
Take the cross product with \times
\vec u \times \vec v
[math]\vec u \times \vec v[/math]
Take the dot product with \cdot
\vec u \cdot \vec v
[math]\vec u \cdot \vec v[/math]
Angle brackets can be used
\vec u = \left< u_x, u_y, u_z \right>
[math]\vec u = \left< u_x, u_y, u_z \right>[/math]
The nabla operator
\nabla f = \operatorname{grad} f
[math]\nabla f = \operatorname{grad} f[/math]
Divergence of a vector field
\nabla \cdot \mathbf F
 = \operatorname{div} \mathbf F
[math]\nabla \cdot \mathbf F = \operatorname{div} \mathbf F[/math]
For repeated use, add this once …
\DeclareMathOperator{\div}{div}
\div \mathbf F
[math]\DeclareMathOperator{\div}{div} \div \mathbf F[/math]
… and use it as many times as you want.
\div \mathbf A = \div \mathbf B
[math]\div \mathbf A = \div \mathbf B[/math]
Curl of a vector field
\nabla \times \mathbf F
 = \operatorname{curl} \mathbf F
[math]\nabla \times \mathbf F = \operatorname{curl} \mathbf F[/math]

Matrices

Make a matrix with parentheses
\begin{pmatrix}
    0 & 1\\
    1 & 1
\end{pmatrix}
[math]\begin{pmatrix} 0 & 1\\ 1 & 1 \end{pmatrix}[/math]
Make a matrix with brackets
\begin{bmatrix}
    0 & 1\\
    1 & 1
\end{bmatrix}
[math]\begin{bmatrix} 0 & 1\\ 1 & 1 \end{bmatrix}[/math]
The adjugate matrix
\operatorname{adj} A
[math]\operatorname{adj} A[/math]
Transposing a matrix
A^\top \text{ or } A^\intercal
[math]A^\top \text{ or } A^\intercal[/math]
The determinant
\det A = \begin{vmatrix}
    0 & 1\\
    1 & 1
\end{vmatrix} = -1
[math]\det A = \begin{vmatrix} 0 & 1\\ 1 & 1 \end{vmatrix} = -1[/math]
Add some centered, vertical and diagonal dots
\begin{bmatrix}
    1      & 0      & \cdots & 0     \\
    0      & 1      & \cdots & 0     \\
    \vdots & \vdots & \ddots & \vdots\\
    0      & 0      & \cdots & 1     \\
\end{bmatrix}
[math]\begin{bmatrix} 1 & 0 & \cdots & 0 \\ 0 & 1 & \cdots & 0 \\ \vdots & \vdots & \ddots & \vdots\\ 0 & 0 & \cdots & 1 \\ \end{bmatrix}[/math]