Math formulas
Produce mathematical text by putting LaTeX into math mode or display math mode (see Modes). This example shows both.

The wave equation for \( u \) is
\begin{displaymath}
  \frac{\partial^2u}{\partial t^2} = c^2\nabla^2u
\end{displaymath}
where \( \nabla^2 \) is the spatial Laplacian and \( c \) is constant.

Math mode is for inline mathematics. In the above example it is invoked by the starting \( and finished by the matching ending \). Display math mode is for displayed equations and here is invoked by the displaymath environment. Note that any mathematical text whatever, including mathematical text consisting of just one character, is handled in math mode.
When in math mode or display math mode, LaTeX handles many aspects of your input text differently than in other text modes. For example,

contrast x+y with \( x+y \)

in math mode the letters are in italics and the spacing around the plus sign is different.
There are three ways to make inline formulas, to put LaTeX in math mode.

\( mathematical material \)
$ mathematical material $
\begin{math} mathematical material \end{math}

The first form is preferred and the second is quite common, but the third form is rarely used. You can sometimes use one and sometimes another, as in \(x\) and $y$. You can use these in paragraph mode or in LR mode (see Modes).
To make displayed formulas, put LaTeX into display math mode with either:

\begin{displaymath}
  mathematical material
\end{displaymath}

or

\begin{equation}
  mathematical material
\end{equation}

(see displaymath, see equation). The only difference is that with the equation environment, LaTeX puts a formula number alongside the formula. The construct \[ math \] is equivalent to \begin{displaymath} math \end{displaymath}. These environments can only be used in paragraph mode (see Modes).
The American Mathematical Society has made freely available a set of packages that greatly expand your options for writing mathematics, amsmath and amssymb (also be aware of the mathtools package that is an extension to, and loads, amsmath). New documents that will have mathematical text should use these packages. Descriptions of these packages is outside the scope of this document; see their documentation on CTAN.

Subscripts & superscripts
Synopsis (in math mode or display math mode), one of:

base^exp
base^{exp}

or, one of:

base_exp
base_{exp}

Make exp appear as a superscript of base (with the caret character, ^) or a subscript (with underscore, _).
In this example the 0’s and 1’s are subscripts while the 2’s are superscripts.

\( (x_0+x_1)^2 \leq (x_0)^2+(x_1)^2 \)

To have the subscript or superscript contain more than one character, surround the expression with curly braces, as in e^{-2x}. This example’s fourth line shows curly braces used to group an expression for the exponent.

\begin{displaymath}
  (3^3)^3=27^3=19\,683
  \qquad
  3^{(3^3)}=3^{27}=7\,625\,597\,484\,987
\end{displaymath}

LaTeX knows how to handle a superscript on a superscript, or a subscript on a subscript, or supers on subs, or subs on supers. So, expressions such as e^{x^2} and x_{i_0} give correct output. Note the use in those expressions of curly braces to give the base a determined exp. If you enter \(3^3^3\), this interpreted as \(3^{3}^{3}\) and then you get TeX error ‘Double superscript’.
LaTeX does the right thing when something has both a subscript and a superscript. In this example the integral has both. They come out in the correct place without any author intervention.

\begin{displaymath}
  \int_{x=a}^b f'(x)\,dx = f(b)-f(a)
\end{displaymath}

Note the curly braces around x=a to make the entire expression a subscript.
To put a superscript or subscript before a symbol, use a construct like {}_t K^2. The empty curly braces {} give the subscript something to attach to and keeps it from accidentally attaching to a prior symbols.
Using the subscript or superscript character outside of math mode or display math mode, as in the expression x^2, will get you the TeX error ‘Missing $ inserted’.
A common reason to want subscripts outside of a mathematics mode is to typeset chemical formulas. There are packages for that, such as mhchem; see CTAN.

Math symbols
LaTeX provides almost any mathematical or technical symbol that anyone uses. For example, if you include $\pi$ in your source, you will get the pi symbol π. See the “Comprehensive LaTeX Symbol List” package at https://ctan.org/pkg/comprehensive.
Here is a list of commonly-used symbols. It is by no means exhaustive. Each symbol is described with a short phrase, and its symbol class, which determines the spacing around it, is given in parenthesis. Unless said otherwise, the commands for these symbols can be used only in math mode. To redefine a command so that it can be used whatever the current mode, see \ensuremath.
\| 	∥ Parallel (relation). Synonym: \parallel.
\aleph 	ℵ Aleph, transfinite cardinal (ordinary).
\alpha 	α Lowercase Greek letter alpha (ordinary).
\amalg 	⨿ Disjoint union (binary)
\angle 	∠ Geometric angle (ordinary). Similar: less-than sign < and angle bracket \langle.
\approx 	≈ Almost equal to (relation).
\ast 	∗ Asterisk operator, convolution, six-pointed (binary). Synonym: *, which is often a superscript or subscript, as in the Kleene star. Similar: \star, which is five-pointed, and is sometimes used as a general binary operation, and sometimes reserved for cross-correlation.
\asymp 	≍ Asymptotically equivalent (relation).
\backslash 	\ Backslash (ordinary). Similar: set minus \setminus, and \textbackslash for backslash outside of math mode.
\beta 	β Lowercase Greek letter beta (ordinary).
\bigcap 	⋂ Variable-sized, or n-ary, intersection (operator). Similar: binary intersection \cap.
\bigcirc 	⚪ Circle, larger (binary). Similar: function composition \circ.
\bigcup 	⋃ Variable-sized, or n-ary, union (operator). Similar: binary union \cup.
\bigodot 	⨀ Variable-sized, or n-ary, circled dot operator (operator).
\bigoplus 	⨁ Variable-sized, or n-ary, circled plus operator (operator).
\bigotimes 	⨂ Variable-sized, or n-ary, circled times operator (operator).
\bigtriangledown 	▽ Variable-sized, or n-ary, open triangle pointing down (binary). Synonym: \varbigtriangledown.
\bigtriangleup 	△ Variable-sized, or n-ary, open triangle pointing up (binary). Synonym: \varbigtriangleup.
\bigsqcup 	⨆ Variable-sized, or n-ary, square union (operator).
\biguplus 	⨄ Variable-sized, or n-ary, union operator with a plus (operator). (Note that the name has only one p.)
\bigvee 	⋁ Variable-sized, or n-ary, logical-or (operator).
\bigwedge 	⋀ Variable-sized, or n-ary, logical-and (operator).
\bot 	⊥, Up tack, bottom, least element of a partially ordered set, or a contradiction (ordinary). See also \top.
\bowtie 	⋈ Natural join of two relations (relation).
\Box 	□ Modal operator for necessity; square open box (ordinary). Not available in plain TeX. In LaTeX you need to load the amssymb package.
\bullet 	 • Bullet (binary). Similar: multiplication dot \cdot.
\cap 	∩ Intersection of two sets (binary). Similar: variable-sized operator \bigcap.
\cdot 	⋅ Multiplication (binary). Similar: Bullet dot \bullet.
\chi 	χ Lowercase Greek chi (ordinary).
\circ 	∘ Function composition, ring operator (binary). Similar: variable-sized operator \bigcirc.
\clubsuit 	♣ Club card suit (ordinary).
\complement 	∁, Set complement, used as a superscript as in $S^\complement$ (ordinary). Not available in plain TeX. In LaTeX you need to load the amssymb package. Also used: $S^{\mathsf{c}}$ or $\bar{S}$.
\cong 	≅ Congruent (relation).
\coprod 	∐ Coproduct (operator).
\cup 	∪ Union of two sets (binary). Similar: variable-sized operator \bigcup.
\dagger 	† Dagger relation (binary).
\dashv 	⊣ Dash with vertical, reversed turnstile (relation). Similar: turnstile \vdash.
\ddagger 	‡ Double dagger relation (binary).
\Delta 	Δ Greek uppercase delta, used for increment (ordinary).
\delta 	δ Greek lowercase delta (ordinary).
\Diamond 	◇ Large diamond operator (ordinary). Not available in plain TeX. In LaTeX you need to load the amssymb package.
\diamond 	⋄ Diamond operator (binary). Similar: large diamond \Diamond, circle bullet \bullet.
\diamondsuit 	♢ Diamond card suit (ordinary).
\div 	÷ Division sign (binary).
\doteq 	≐ Approaches the limit (relation). Similar: geometrically equal to \Doteq.
\downarrow 	↓ Down arrow, converges (relation). Similar: \Downarrow double line down arrow.
\Downarrow 	⇓ Double line down arrow (relation). Similar: \downarrow single line down arrow.
\ell 	ℓ Lowercase cursive letter l (ordinary).
\emptyset 	∅ Empty set symbol (ordinary). The variant form is \varnothing.
\epsilon 	ϵ Lowercase lunate epsilon (ordinary). Similar to Greek text letter. More widely used in mathematics is the script small letter epsilon \varepsilon ε. Related: the set membership relation \in ∈.
\equiv 	≡ Equivalence (relation).
\eta 	η Lowercase Greek letter (ordinary).
\exists 	∃ Existential quantifier (ordinary).
\flat 	♭ Musical flat (ordinary).
\forall 	∀ Universal quantifier (ordinary).
\frown 	⌢ Downward curving arc (ordinary).
\Gamma 	Γ uppercase Greek letter (ordinary).
\gamma 	γ Lowercase Greek letter (ordinary).
\ge 	≥ Greater than or equal to (relation). This is a synonym for \geq.
\geq 	≥ Greater than or equal to (relation). This is a synonym for \ge.
\gets 	← Is assigned the value (relation). Synonym: \leftarrow.
\gg 	≫ Much greater than (relation). Similar: much less than \ll.
\hbar 	ℏ Planck constant over two pi (ordinary).
\heartsuit 	♡ Heart card suit (ordinary).
\hookleftarrow 	↩ Hooked left arrow (relation).
\hookrightarrow 	↪ Hooked right arrow (relation).
\iff 	⟷ If and only if (relation). It is \Longleftrightarrow with a \thickmuskip on either side.
\Im 	ℑ Imaginary part (ordinary). See: real part \Re.
\imath 	 Dotless i; used when you are putting an accent on an i (see Math accents).
\in 	∈ Set element (relation). See also: lowercase lunate epsilon \epsilonϵ and small letter script epsilon \varepsilon.
\infty 	∞ Infinity (ordinary).
\int 	∫ Integral (operator).
\iota 	ι Lowercase Greek letter (ordinary).
\Join 	⨝ Condensed bowtie symbol (relation). Not available in Plain TeX.
\jmath 	 Dotless j; used when you are putting an accent on a j (see Math accents).
\kappa 	κ Lowercase Greek letter (ordinary).
\Lambda 	Λ uppercase Greek letter (ordinary).
\lambda 	λ Lowercase Greek letter (ordinary).
\land 	∧ Logical and (binary). Synonym: \wedge. See also logical or \lor.
\langle 	⟨ Left angle, or sequence, bracket (opening). Similar: less-than <. Matches \rangle.
\lbrace 	{ Left curly brace (opening). Synonym: \{. Matches \rbrace.
\lbrack 	[ Left square bracket (opening). Synonym: [. Matches \rbrack.
\lceil 	⌈ Left ceiling bracket, like a square bracket but with the bottom shaved off (opening). Matches \rceil.
\le 	≤ Less than or equal to (relation). This is a synonym for \leq.
\leadsto 	⇝ Squiggly right arrow (relation). To get this symbol outside of math mode you can put \newcommand*{\Leadsto}{\ensuremath{\leadsto}} in the preamble and then use \Leadsto instead.
\Leftarrow 	⇐ Is implied by, double-line left arrow (relation). Similar: single-line left arrow \leftarrow.
\leftarrow 	← Single-line left arrow (relation). Synonym: \gets. Similar: double-line left arrow \Leftarrow.
\leftharpoondown 	↽ Single-line left harpoon, barb under bar (relation).
\leftharpoonup 	↼ Single-line left harpoon, barb over bar (relation).
\Leftrightarrow 	⇔ Bi-implication; double-line double-headed arrow (relation). Similar: single-line double headed arrow \leftrightarrow.
\leftrightarrow 	↔ Single-line double-headed arrow (relation). Similar: double-line double headed arrow \Leftrightarrow.
\leq 	≤ Less than or equal to (relation). This is a synonym for \le.
\lfloor 	⌊ Left floor bracket (opening). Matches: \floor.
\lhd 	◁ Arrowhead, that is, triangle, pointing left (binary). For the normal subgroup symbol you should load amssymb and use \vartriangleleft (which is a relation and so gives better spacing).
\ll 	≪ Much less than (relation). Similar: much greater than \gg.
\lnot 	¬ Logical negation (ordinary). Synonym: \neg.
\longleftarrow 	⟵ Long single-line left arrow (relation). Similar: long double-line left arrow \Longleftarrow.
\longleftrightarrow 	⟷ Long single-line double-headed arrow (relation). Similar: long double-line double-headed arrow \Longleftrightarrow.
\longmapsto 	⟼ Long single-line left arrow starting with vertical bar (relation). Similar: shorter version \mapsto.
\longrightarrow 	⟶ Long single-line right arrow (relation). Similar: long double-line right arrow \Longrightarrow.
\lor 	∨ Logical or (binary). Synonym: \vee. See also logical and \land.
\mapsto 	↦ Single-line left arrow starting with vertical bar (relation). Similar: longer version \longmapsto.
\mho 	℧ Conductance, half-circle rotated capital omega (ordinary).
\mid 	∣ Single-line vertical bar (relation). A typical use of \mid is for a set \{\, x \mid x\geq 5 \,\}.
Similar: \vert and | produce the same single-line vertical bar symbol but without any spacing (they fall in class ordinary) and you should not use them as relations but instead only as ordinals, i.e., footnote symbols. For absolute value, see the entry for \vert and for norm see the entry for \Vert.
\models 	⊨ Entails, or satisfies; double turnstile, short double dash (relation). Similar: long double dash \vDash.
\mp 	∓ Minus or plus (relation).
\mu 	μ Lowercase Greek letter (ordinary).
\nabla 	∇ Hamilton’s del, or differential, operator (ordinary).
\natural 	♮ Musical natural notation (ordinary).
\ne 	≠ Not equal (relation). Synonym: \neq.
\nearrow 	↗ North-east arrow (relation).
\neg 	¬ Logical negation (ordinary). Synonym: \lnot. Sometimes instead used for negation: \sim.
\neq 	≠ Not equal (relation). Synonym: \ne.
\ni 	∋ Reflected membership epsilon; has the member (relation). Synonym: \owns. Similar: is a member of \in.
\not 	     Long solidus, or slash, used to overstrike a following operator (relation).
Many negated operators are available that don’t require \not, particularly with the amssymb package. For example, \notin is typographically preferable to \not\in.
\notin 	∉ Not an element of (relation). Similar: not subset of \nsubseteq.
\nu 	ν Lowercase Greek letter (ordinary).
\nwarrow 	↖ North-west arrow (relation).
\odot 	⊙ Dot inside a circle (binary). Similar: variable-sized operator \bigodot.
\oint 	∮ Contour integral, integral with circle in the middle (operator).
\Omega 	Ω uppercase Greek letter (ordinary).
\omega 	ω Lowercase Greek letter (ordinary).
\ominus 	⊖ Minus sign, or dash, inside a circle (binary).
\oplus 	⊕ Plus sign inside a circle (binary). Similar: variable-sized operator \bigoplus.
\oslash 	⊘ Solidus, or slash, inside a circle (binary).
\otimes 	⊗ Times sign, or cross, inside a circle (binary). Similar: variable-sized operator \bigotimes.
\owns 	∋ Reflected membership epsilon; has the member (relation). Synonym: \ni. Similar: is a member of \in.
\parallel 	∥ Parallel (relation). Synonym: \|.
\partial 	∂ Partial differential (ordinary).
\perp 	⟂ Perpendicular (relation). Similar: \bot uses the same glyph but the spacing is different because it is in the class ordinary.
\Phi 	Φ Uppercase Greek letter (ordinary).
\phi 	ϕ Lowercase Greek letter (ordinary). The variant form is \varphi φ.
\Pi 	Π uppercase Greek letter (ordinary).
\pi 	π Lowercase Greek letter (ordinary). The variant form is \varpi ϖ.
\pm 	± Plus or minus (binary).
\prec 	≺ Precedes (relation). Similar: less than <.
\preceq 	⪯ Precedes or equals (relation). Similar: less than or equals \leq.
\prime 	′ Prime, or minute in a time expression (ordinary). Typically used as a superscript: $f^\prime$; $f^\prime$ and $f'$ produce the same result. An advantage of the second is that $f'''$ produces the desired symbol, that is, the same result as $f^{\prime\prime\prime}$, but uses rather less typing. You can only use \prime in math mode. Using the right single quote ' in text mode produces a different character (apostrophe).
\prod 	∏ Product (operator).
\propto 	∝ Is proportional to (relation)
\Psi 	Ψ uppercase Greek letter (ordinary).
\psi 	ψ Lowercase Greek letter (ordinary).
\rangle 	⟩ Right angle, or sequence, bracket (closing). Similar: greater than >. Matches:\langle.
\rbrace 	} Right curly brace (closing). Synonym: \}. Matches \lbrace.
\rbrack 	] Right square bracket (closing). Synonym: ]. Matches \lbrack.
\rceil 	⌉ Right ceiling bracket (closing). Matches \lceil.
\Re 	ℜ Real part, real numbers, cursive capital R (ordinary). Related: double-line, or blackboard bold, R \mathbb{R}; to access this, load the amsfonts package.
\restriction 	↾, Restriction of a function (relation). Synonym: \upharpoonright. Not available in plain TeX. In LaTeX you need to load the amssymb package.
\revemptyset 	⦰, Reversed empty set symbol (ordinary). Related: \varnothing. Not available in plain TeX. In LaTeX you need to load the stix package.
\rfloor 	⌋ Right floor bracket, a right square bracket with the top cut off (closing). Matches \lfloor.
\rhd 	◁ Arrowhead, that is, triangle, pointing right (binary). For the normal subgroup symbol you should instead load amssymb and use \vartriangleright (which is a relation and so gives better spacing).
\rho 	ρ Lowercase Greek letter (ordinary). The variant form is \varrho ϱ.
\Rightarrow 	⇒ Implies, right-pointing double line arrow (relation). Similar: right single-line arrow \rightarrow.
\rightarrow 	→ Right-pointing single line arrow (relation). Synonym: \to. Similar: right double line arrow \Rightarrow.
\rightharpoondown 	⇁ Right-pointing harpoon with barb below the line (relation).
\rightharpoonup 	⇀ Right-pointing harpoon with barb above the line (relation).
\rightleftharpoons 	⇌ Right harpoon up above left harpoon down (relation).
\searrow 	↘ Arrow pointing southeast (relation).
\setminus 	⧵ Set difference, reverse solidus or reverse slash, like \ (binary). Similar: backslash \backslash and also \textbackslash outside of math mode.
\sharp 	♯ Musical sharp (ordinary).
\Sigma 	Σ uppercase Greek letter (ordinary).
\sigma 	σ Lowercase Greek letter (ordinary). The variant form is \varsigma ς.
\sim 	∼ Similar, in a relation (relation).
\simeq 	≃ Similar or equal to, in a relation (relation).
\smallint 	∫ Integral sign that does not change to a larger size in a display (operator).
\smile 	⌣ Upward curving arc, smile (ordinary).
\spadesuit 	♠ Spade card suit (ordinary).
\sqcap 	⊓ Square intersection symbol (binary). Similar: intersection cap.
\sqcup 	⊔ Square union symbol (binary). Similar: union cup. Related: variable-sized operator \bigsqcup.
\sqsubset 	⊏, Square subset symbol (relation). Similar: subset \subset. Not available in plain TeX. In LaTeX you need to load the amssymb package.
\sqsubseteq 	⊑ Square subset or equal symbol (binary). Similar: subset or equal to \subseteq.
\sqsupset 	⊐, Square superset symbol (relation). Similar: superset \supset. Not available in plain TeX. In LaTeX you need to load the amssymb package.
\sqsupseteq 	⊒ Square superset or equal symbol (binary). Similar: superset or equal \supseteq.
\star 	⋆ Five-pointed star, sometimes used as a general binary operation but sometimes reserved for cross-correlation (binary). Similar: the synonyms asterisk * and \ast, which are six-pointed, and more often appear as a superscript or subscript, as with the Kleene star.
\subset 	⊂ Subset (occasionally, is implied by) (relation).
\subseteq 	⊆ Subset or equal to (relation).
\succ 	≻ Comes after, succeeds (relation). Similar: is less than >.
\succeq 	⪰ Succeeds or is equal to (relation). Similar: less than or equal to \leq.
\sum 	∑ Summation (operator). Similar: Greek capital sigma \Sigma.
\supset 	⊃ Superset (relation).
\supseteq 	⊇ Superset or equal to (relation).
\surd 	√ Radical symbol (ordinary). The LaTeX command \sqrt{...} typesets the square root of the argument, with a bar that extends to cover the argument.
\swarrow 	↙ Southwest-pointing arrow (relation).
\tau 	τ Lowercase Greek letter (ordinary).
\theta 	θ Lowercase Greek letter (ordinary). The variant form is \vartheta ϑ.
\times 	× Primary school multiplication sign (binary). See also \cdot.
\to 	→ Right-pointing single line arrow (relation). Synonym: \rightarrow.
\top 	⊤ Top, greatest element of a partially ordered set (ordinary). See also \bot.
\triangle 	△ Triangle (ordinary).
\triangleleft 	◁ Not-filled triangle pointing left (binary). Similar: \lhd. For the normal subgroup symbol you should load amssymb and use \vartriangleleft (which is a relation and so gives better spacing).
\triangleright 	▷ Not-filled triangle pointing right (binary). For the normal subgroup symbol you should instead load amssymb and use \vartriangleright (which is a relation and so gives better spacing).
\unlhd 	⊴ Left-pointing not-filled underlined arrowhead, that is, triangle, with a line under (binary). For the normal subgroup symbol load amssymb and use \vartrianglelefteq (which is a relation and so gives better spacing).
\unrhd 	⊵ Right-pointing not-filled underlined arrowhead, that is, triangle, with a line under (binary). For the normal subgroup symbol load amssymb and use \vartrianglerighteq (which is a relation and so gives better spacing).
\Uparrow 	⇑ Double-line upward-pointing arrow (relation). Similar: single-line up-pointing arrow \uparrow.
\uparrow 	↑ Single-line upward-pointing arrow, diverges (relation). Similar: double-line up-pointing arrow \Uparrow.
\Updownarrow 	⇕ Double-line upward-and-downward-pointing arrow (relation). Similar: single-line upward-and-downward-pointing arrow \updownarrow.
\updownarrow 	↕ Single-line upward-and-downward-pointing arrow (relation). Similar: double-line upward-and-downward-pointing arrow \Updownarrow.
\upharpoonright 	↾, Up harpoon, with barb on right side (relation). Synonym: \restriction. Not available in plain TeX. In LaTeX you need to load the amssymb package.
\uplus 	⊎ Multiset union, a union symbol with a plus symbol in the middle (binary). Similar: union \cup. Related: variable-sized operator \biguplus.
\Upsilon 	Υ uppercase Greek letter (ordinary).
\upsilon 	υ Lowercase Greek letter (ordinary).
\varepsilon 	ε Small letter script epsilon (ordinary). This is more widely used in mathematics than the non-variant lunate epsilon form \epsilon ϵ. Related: set membership \in.
\vanothing 	∅, Empty set symbol. Similar: \emptyset. Related: \revemptyset. Not available in plain TeX. In LaTeX you need to load the amssymb package.
\varphi 	φ Variant on the lowercase Greek letter (ordinary). The non-variant form is \phi ϕ.
\varpi 	ϖ Variant on the lowercase Greek letter (ordinary). The non-variant form is \pi π.
\varrho 	ϱ Variant on the lowercase Greek letter (ordinary). The non-variant form is \rho ρ.
\varsigma 	ς Variant on the lowercase Greek letter (ordinary). The non-variant form is \sigma σ.
\vartheta 	ϑ Variant on the lowercase Greek letter (ordinary). The non-variant form is \theta θ.
\vdash 	⊢ Provable; turnstile, vertical and a dash (relation). Similar: turnstile rotated a half-circle \dashv.
\vee 	∨ Logical or; a downwards v shape (binary). Related: logical and \wedge. Similar: variable-sized operator \bigvee.
\Vert 	‖ Vertical double bar (ordinary). See Delimiters, for how to use the mathtools package to create flexibly-sized norm symbols.
\vert 	| Single line vertical bar (ordinary). For “such that”, as in the definition of a set, use \mid because it is a relation. See Delimiters, for how to use the mathtools package to create flexibly-sized absolute-value symbols.
\wedge 	∧ Logical and (binary). Synonym: \land. See also logical or \vee. Similar: variable-sized operator \bigwedge.
\wp 	℘ Weierstrass p (ordinary).
\wr 	≀ Wreath product (binary).
\Xi 	Ξ uppercase Greek letter (ordinary).
\xi 	ξ Lowercase Greek letter (ordinary).
\zeta 	ζ Lowercase Greek letter (ordinary).
The following symbols are most often used in plain text but LaTeX provides versions to use in mathematical text.
\mathdollar 	Dollar sign in math mode: $.
\mathparagraph 	Paragraph sign (pilcrow) in math mode, ¶.
\mathsection 	Section sign in math mode: §.
\mathsterling 	Sterling sign in math mode: £.
\mathunderscore 	Underscore in math mode: _.

Arrows
These are the arrows that come with standard LaTeX. The latexsym and amsfonts packages contain many more.
Symbol	Command
⇓	\Downarrow
↓	\downarrow
↩	\hookleftarrow
↪	\hookrightarrow
←	\leftarrow
⇐	\Leftarrow
⇔	\Leftrightarrow
↔	\leftrightarrow
⟵	\longleftarrow
⟸	\Longleftarrow
⟷	\longleftrightarrow
⟺	\Longleftrightarrow
⟼	\longmapsto
⟹	\Longrightarrow
⟶	\longrightarrow
↦	\mapsto
↗	\nearrow
↖	\nwarrow
⇒	\Rightarrow
→	\rightarrow, or \to
↘	\searrow
↙	\swarrow
↑	\uparrow
⇑	\Uparrow
↕	\updownarrow
⇕	\Updownarrow
An example of the difference between \to and \mapsto is: \( f\colon D\to C \) given by \( n\mapsto n^2 \).
For commutative diagrams there are a number of packages, including tikz-cd and amscd.

\boldmath & \unboldmath
Synopsis (used in paragraph mode or LR mode):

\boldmath \( math \)

or

\unboldmath \( math \)

Declarations to change the letters and symbols in math to be in a bold font, or to countermand that and bring back the regular (non-bold) default, respectively. They must be used when not in math mode or display math mode (see Modes). Both commands are fragile (see \protect).
In this example each \boldmath command takes place inside an \mbox,

we have $\mbox{\boldmath \( v \)} = 5\cdot\mbox{\boldmath \( u \)$}$

which means \boldmath is only called in a text mode, here LR mode, and explains why we must switch LaTeX into math mode to set v and u.
If you use either command inside math mode, as with Trouble: \( \boldmath x \), then you get something like ‘LaTeX Font Warning: Command \boldmath invalid in math mode’ and ‘LaTeX Font Warning: Command \mathversion invalid in math mode’.

bm: Individual bold math symbols
Specifying \boldmath is the best method for typesetting a whole math expression in bold. But to typeset individual symbols within an expression in bold, the bm package provided by the LaTeX Project team is better. Its usage is outside the scope of this document (see its documentation at https://ctan.org/pkg/bm or in your installation) but the spacing in the output of this small example will show that it is an improvement over \boldmath within an expression:

\usepackage{bm}   % in preamble
...
we have $\bm{v} = 5\cdot\bm{u}$

OpenType bold math
Unfortunately, when using the Unicode engines (XeLaTeX, LuaLaTeX), neither \boldmath nor bm usually work well, because the OpenType math fonts normally used with those engines rarely come with a bold companion, and both \boldmath and bm require this. (The implementation of bm relies on \boldmath, so the requirements are the same.) If you do have a bold math font, though, then \boldmath and bm work fine.
If no such font is available, one alternative is to construct fake bold fonts with the fontspec package’s FakeBold=1 parameter (see its documentation, https://ctan.org/pkg/fontspec). This may be acceptable for drafting or informal distribution, but the results are far from a true bold font.
Another alternative to handling bold for OpenType math fonts is to use the \symbf (bold), \symbfit (bold italic), and related commands from the unicode-math package. These do not change the current font, but rather change the (Unicode) “alphabet” used, which in practice is more widely supported than a separate bold font. Many variations are possible, and so there are subtleties to getting the desired output. As usual, see the package documentation (https://ctan.org/pkg/unicode-math).

Blackboard bold
Synopsis:

\usepackage{amssymb}   % in preamble
  ... 
\mathbb{uppercase-letter}

Provide blackboard bold symbols, sometimes also known as doublestruck letters, used to denote number sets such as the natural numbers, the integers, etc.
Here

\( \forall n \in \mathbb{N}, n^2 \geq 0 \)

the \mathbb{N} gives blackboard bold symbol ℕ, representing the natural numbers.
If the argument contains something other than an uppercase letter, you do not get an error but you do get strange results, including unexpected characters.
There are packages that give access to symbols other than just the capital letters; look on CTAN.

Calligraphic
Synopsis:

\mathcal{uppercase-letters}

Use a script-like font.
In this example the graph identifier is output in a cursive font.

Let the graph be \( \mathcal{G} \).

If you use something other than an uppercase letter then you do not get an error but you also do not get math calligraphic output. For instance, \mathcal{g} outputs a close curly brace symbol.

Delimiters
Delimiters are parentheses, braces, or other characters used to mark the start and end of subformulas. This formula has three sets of parentheses delimiting the three subformulas.

(z-z_0)^2 = (x-x_0)^2 + (y-y_0)^2

The delimiters do not need to match, so you can enter \( [0,1) \).
Here are the common delimiters:
Delimiter	Command	Name
(	(	Left parenthesis
)	)	Right parenthesis
\{	{ or \lbrace	Left brace
\}	} or \rbrace	Right brace
[	[ or \lbrack	Left bracket
]	] or \rbrack	Right bracket
⌊	\lfloor	Left floor bracket
⌋	\rfloor	Right floor bracket
⌈	\lceil	Left ceiling bracket
⌉	\rceil	Right ceiling bracket
⟨	\langle	Left angle bracket
⟩	\rangle	Right angle bracket
/	/	Slash, or forward slash
\	\backslash	Reverse slash, or backslash
|	| or \vert	Vertical bar
‖	\| or \Vert	Double vertical bar
The mathtools package allows you to create commands for paired delimiters. For instance, if you put \DeclarePairedDelimiter\abs{\lvert}{\rvert} in your preamble then you get two commands for single-line vertical bars (they only work in math mode). The starred form, such as \abs*{\frac{22}{7}}, has the height of the vertical bars match the height of the argument. The unstarred form, such as \abs{\frac{22}{7}}, has the bars fixed at a default height. This form accepts an optional argument, as in \abs[size command]{\frac{22}{7}}, where the height of the bars is given in size command, such as \Bigg. Using instead \lVert and \rVert as the symbols will give you a norm symbol with the same behavior.

\left & \right
Synopsis:

\left delimiter1 ... \right delimiter2

Make matching parentheses, braces, or other delimiters. LaTeX makes the delimiters tall enough to just cover the size of the formula that they enclose.
This makes a unit vector surrounded by parentheses tall enough to cover the entries.

\begin{equation}
  \left(\begin{array}{c}
    1   \\
    0   \\
  \end{array}\right)
\end{equation}

See Delimiters, for a list of the common delimiters.
Every \left must have a matching \right. In the above example, leaving out the \left( gets the error message ‘Extra \right’. Leaving out the \right) gets ‘You can't use `\eqno' in math mode’.
However, delimiter1 and delimiter2 need not match. A common case is that you want an unmatched brace, as below. Use a period, ‘.’, as a null delimiter.

\begin{equation}
  f(n)=\left\{\begin{array}{ll}
                1             &\mbox{--if \(n=0\)} \\
                f(n-1)+3n^2   &\mbox{--else}       
       \end{array}\right.
\end{equation}

Note that to get a curly brace as a delimiter you must prefix it with a backslash, \{ (see Reserved characters). (The packages amsmath and mathtools allow you to get the above construct through in a cases environment.)
The \left ... \right pair make a group. One consequence is that the formula enclosed in the \left ... \right pair cannot have line breaks in the output. This includes both manual line breaks and LaTeX-generated automatic ones. In this example, LaTeX breaks the equation to make the formula fit the margins.

Lorem ipsum dolor sit amet
\( (a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p+q+r+s+t+u+v+w+x+y+z) \)

But with \left and \right

Lorem ipsum dolor sit amet
\( \left(a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p+q+r+s+t+u+v+w+x+y+z\right) \)

LaTeX won’t break the line, causing the formula to extend into the margin.
Because \left ... \right make a group, all the usual grouping rules hold. Here, the value of \testlength set inside the equation will be forgotten, and the output is ‘1.2pt’.

\newlength{\testlength} \setlength{\testlength}{1.2pt}
\begin{equation}
  \left( a+b=c \setlength{\testlength}{3.4pt} \right)
  \the\testlength
\end{equation}

The \left ... \right pair affect the horizontal spacing of the enclosed formula, in two ways. The first is that in \( \sin(x) = \sin\left(x\right) \) the one after the equals sign has more space around the x. That’s because \left( ... \right) inserts an inner node while ( ... ) inserts an opening node. The second way that the pair affect the horizontal spacing is that because they form a group, the enclosed subformula will be typeset at its natural width, with no stretching or shrinking to make the line fit better.
TeX scales the delimiters according to the height and depth of the enclosed formula. Here LaTeX grows the brackets to extend the full height of the integral.

\begin{equation}
  \left[ \int_{x=r_0}^{\infty} -G\frac{Mm}{r^2}\, dr \right] 
\end{equation}

Manual sizing is often better. For instance, although below the rule has no depth, TeX will create delimiters that extend far below the rule.

\begin{equation}
  \left( \rule{1pt}{1cm} \right)
\end{equation}

TeX can choose delimiters that are too small, as in \( \left| |x|+|y| \right| \). It can also choose delimiters that are too large, as here.

\begin{equation}
  \left( \sum_{0\leq i<n} i^k \right)
\end{equation}

A third awkward case is when a long displayed formula is on more than one line and you must match the sizes of the opening and closing delimiter; you can’t use \left on the first line and \right on the last because they must be paired.
To size the delimiters manually, see \bigl & \bigr etc..

\bigl, \bigr, etc.
Synopsis, one of:

\bigldelimiter1 ... \bigrdelimiter2
\Bigldelimiter1 ... \bigrdelimiter2
\biggldelimiter1 ... \biggrdelimiter2
\Biggldelimiter1 ... \Biggrdelimiter2

(as with \bigl[...\bigr]; strictly speaking they need not be paired, see below), or one of:

\bigmdelimiter
\Bigmdelimiter
\biggmdelimiter
\Biggmdelimiter

(as with \bigm|), or one of:

\bigdelimiter
\Bigdelimiter
\biggdelimiter
\Biggdelimiter

(as with \big[).
Produce manually-sized delimiters. For delimiters that are automatically sized see \left & \right).
This produces slightly larger outer vertical bars.

  \bigl| |x|+|y| \bigr|

The commands above are listed in order of increasing size. You can use the smallest size such as \bigl...\bigr in a paragraph without causing LaTeX to spread the lines apart. The larger sizes are meant for displayed equations.
See Delimiters, for a list of the common delimiters. In the family of commands with ‘l’ or ‘r’, delimiter1 and delimiter2 need not match together.
The ‘l’ and ‘r’ commands produce open and close delimiters that insert no horizontal space between a preceding atom and the delimiter, while the commands without ‘l’ and ‘r’ insert some space (because each delimiter is set as an ordinary variable). Compare these two.

\begin{tabular}{l}
  \(\displaystyle \sin\biggl(\frac{1}{2}\biggr) \)  \\  % good
  \(\displaystyle \sin\bigg(\frac{1}{2}\bigg)  \)   \\  % bad
\end{tabular}

The traditional typographic treatment is on the first line. On the second line the output will have some extra space between the \sin and the open parenthesis.
Commands without ‘l’ or ‘r’ do give correct spacing in some circumstances, as with this large vertical line

\begin{equation}
  \int_{x=a}^b x^2\,dx = \frac{1}{3} x^3 \Big|_{x=a}^b
\end{equation}

(many authors would replace \frac with the \tfrac command from the amsmath package), and as with this larger slash.

\begin{equation}
  \lim_{n\to\infty}\pi(n) \big/ (n/\log n) = 1
\end{equation}

Unlike the \left...\right pair (see \left & \right), the commands here with ‘l’ or ‘r’ do not make a group. Strictly speaking they need not be matched so you can write something like this.

\begin{equation}
  \Biggl[ \pi/6 ] 
\end{equation}

The commands with ‘m’ are for relations, which are in the middle of formulas, as here.

\begin{equation}
  \biggl\{ a\in B \biggm| a=\sum_{0\leq i<n}3i^2+4 \biggr\}
\end{equation}

Dots, horizontal or vertical
Ellipses are the three dots (usually three) indicating that a pattern continues.

\begin{array}{cccc}
  a_{0,0}    &a_{0,1}   &a_{0,2} &\ldots \\
  a_{1,0}    &\ddots                     \\
  \vdots
\end{array}

LaTeX provides these.
\cdots 	Horizontal ellipsis with the dots raised to the center of the line, as in ⋯. Used as: \( a_0\cdot a_1\cdots a_{n-1} \).
\ddots 	Diagonal ellipsis, ⋱. See the above array example for a usage.
\ldots 	\mathellipsis 	\dots 	Ellipsis on the baseline, …. Used as: \( x_0,\ldots x_{n-1} \). Another example is the above array example. Synonyms are \mathellipsis and \dots. A synonym from the amsmath package is \hdots.
You can also use this command outside of mathematical text, as in The gears, brakes, \ldots{} are all broken.
\vdots 	Vertical ellipsis, ⋮. See the above array example for a usage.
The amsmath package has the command \dots to semantically mark up ellipses. This example produces two different-looking outputs for the first two uses of the \dots command.

\usepackage{amsmath}  % in preamble
  ...
Suppose that \( p_0, p_1, \dots, p_{n-1} \) lists all of the primes.
Observe that \( p_0\cdot p_1 \dots \cdot p_{n-1} +1 \) is not a
  multiple of any \( p_i \).
Conclusion: there are infinitely many primes \( p_0, p_1, \dotsc \).

In the first line LaTeX looks to the comma following \dots to determine that it should output an ellipsis on the baseline. The second line has a \cdot following \dots so LaTeX outputs an ellipsis that is on the math axis, vertically centered. However, the third usage has no follow-on character so you have to tell LaTeX what to do. You can use one of the commands: \dotsc if you need the ellipsis appropriate for a comma following, \dotsb if you need the ellipses that fits when the dots are followed by a binary operator or relation symbol, \dotsi for dots with integrals, or \dotso for others.
The \dots command from amsmath differs from the LaTeX kernel’s \dots command in another way: it outputs a thin space after the ellipsis. Furthermore, the unicode-math package automatically loads amsmath, so amsmath’s \dots may be active even when you did not explicitly load it, thus changing the output from \dots in both text and math mode.
Yet more about the ellipsis commands: when running under Unicode engines (lualatex, xelatex), LaTeX will use the Unicode ellipsis character (U+2026) in the font if it’s available; under traditional TeX engines (pdflatex, latex), it will typeset three spaced periods. Generally, the Unicode single-character ellipsis has almost no space between the three periods, while the spacing of the non-Unicode ellipsis is looser, more in accordance with traditional typography.

Greek letters
The upper case versions of these Greek letters are only shown when they differ from Roman upper case letters.
Symbol	Command	Name
α	\alpha	Alpha
β	\beta	Beta
γ, Γ	\gamma, \Gamma	Gamma
δ, Δ	\delta, \Delta	Delta
ε, ϵ	\varepsilon, \epsilon	Epsilon
ζ	\zeta	Zeta
η	\eta	Eta
θ, ϑ	\theta, \vartheta	Theta
ι	\iota	Iota
κ	\kappa	Kappa
λ, Λ	\lambda, \Lambda	Lambda
μ	\mu	Mu
ν	\nu	Nu
ξ, Ξ	\xi, \Xi	Xi
π, Π	\pi, \Pi	Pi
ρ, ϱ	\rho, \varrho	Rho
σ, Σ	\sigma, \Sigma	Sigma
τ	\tau	Tau
ϕ, φ, Φ	\phi, \varphi, \Phi	Phi
χ	\chi	chi
ψ, Ψ	\psi, \Psi	Psi
ω, Ω	\omega, \Omega	Omega
For omicron, if you are using LaTeX’s default Computer Modern font then enter omicron just as ‘o’ or ‘O’. If you like having the name or if your font shows a difference then you can use something like \newcommand\omicron{o}. The package unicode-math has \upomicron for upright omicron and \mitomicron for math italic.
While the set membership relation symbol ∈ generated by \in is related to epsilon, it is never used for a variable.

Math functions
These commands produce roman function names in math mode with proper spacing.
\arccos 	Inverse cosine
\arcsin 	Inverse sine
\arctan 	Inverse tangent
\arg 	Angle between the real axis and a point in the complex plane
\bmod 	Binary modulo operator, used as in \( 5\bmod 3=2 \)
\cos 	Cosine
\cosh 	Hyperbolic cosine
\cot 	Cotangent
\coth 	Hyperbolic cotangent
\csc 	Cosecant
\deg 	Degrees
\det 	Determinant
\dim 	Dimension
\exp 	Exponential
\gcd 	Greatest common divisor
\hom 	Homomorphism
\inf 	Infimum
\ker 	Kernel
\lg 	Base 2 logarithm
\lim 	Limit
\liminf 	Limit inferior
\limsup 	Limit superior
\ln 	Natural logarithm
\log 	Logarithm
\max 	Maximum
\min 	Minimum
\pmod 	Parenthesized modulus, as used in \( 5\equiv 2\pmod 3 \)
\Pr 	Probability
\sec 	Secant
\sin 	Sine
\sinh 	Hyperbolic sine
\sup 	Supremum sup
\tan 	Tangent
\tanh 	Hyperbolic tangent
The amsmath package adds improvements on some of these, and also allows you to define your own. The full documentation is on CTAN, but briefly, you can define an identity operator with \DeclareMathOperator{\identity}{id} that is like the ones above but prints as ‘id’. The starred form \DeclareMathOperator*{\op}{op} sets any superscript or subscript to be above and below, as is traditional with \lim, \sup, or \max.

Math accents
LaTeX provides a variety of commands for producing accented letters in math. These are different from accents in normal text (see Accents).
\acute 	 Math acute accent
\bar 	 Math bar-over accent
\breve 	 Math breve accent
\check 	 Math háček (check) accent
\ddot 	 Math dieresis accent
\dot 	 Math dot accent
\grave 	 Math grave accent
\hat 	 Math hat (circumflex) accent
\mathring 	 Math ring accent
\tilde 	 Math tilde accent
\vec 	 Math vector symbol
\widehat 	 Math wide hat accent
\widetilde 	 Math wide tilde accent
When you are putting an accent on an i or a j, the tradition is to use one without a dot, \imath or jmath (see Math symbols).

Over- or under math
LaTeX provides commands for putting lines, braces, and arrows over or under math material.
\underline{math} 	Underline math. For example: \underline{x+y}. The line is always completely below the text, taking account of descenders, so in \(\underline{y}\) the line is lower than in \(\underline{x}\). As of approximately 2019, this command and others in this section are robust; before that, they were fragile (see \protect).
The package ulem (https://ctan.org/pkg/uelem) does text mode underlining and allows line breaking as well as a number of other features. See also \hrulefill & \dotfill for producing a line for such things as a signature or placeholder.
\overline{math} 	Put a horizontal line over math. For example: \overline{x+y}. This differs from the accent command \bar (see Math accents).
\underbrace{math} 	Put a brace under math. For example: (1-\underbrace{1/2)+(1/2}-1/3).
You can attach text to the brace as a subscript (_) or superscript (^) as here:

\begin{displaymath}
  1+1/2+\underbrace{1/3+1/4}_{>1/2}+
       \underbrace{1/5+1/6+1/7+1/8}_{>1/2}+\cdots
\end{displaymath}

The superscript appears on top of the expression, and so can look unconnected to the underbrace.
\overbrace{math} 	Put a brace over math. For example: \overbrace{x+x+\cdots+x}^{\mbox{\(k\) times}}.
\overrightarrow{math} 	Put a right arrow over math. For example: \overrightarrow{x+y}.
\overleftarrow{math} 	Put a left arrow over math. For example: \overleftarrow{a+b}.
The package mathtools (https://ctan.org/pkg/mathtools) adds an over- and underbracket, as well as some improvements on the braces.

Spacing in math mode
When typesetting mathematics, LaTeX puts in spacing according to the normal rules for mathematics texts. If you enter y=m x then LaTeX ignores the space and in the output the m is next to the x, as y=mx.
But LaTeX’s rules occasionally need tweaking. For example, in an integral the tradition is to put a small extra space between the f(x) and the dx, here done with the \, command:

\int_0^1 f(x)\,dx

LaTeX provides the commands that follow for use in math mode. Many of these spacing definitions are expressed in terms of the math unit mu. It is defined as 1/18em, where the em is taken from the current math symbols family (see Units of length). Thus, a \thickspace is something like 5/18 times the width of a ‘M’.
\; 	 Synonym: \thickspace. Normally 5.0mu plus 5.0mu. With the amsmath package, or as of the 2020-10-01 LaTeX release, can be used in text mode as well as math mode; otherwise, in math mode only.
\negthickspace 	 Normally -5.0mu plus 2.0mu minus 4.0mu. With the amsmath package, or as of the 2020-10-01 LaTeX release, can be used in text mode as well as math mode; otherwise, in math mode only.
\: 	\> 	 Synonym: \medspace. Normally 4.0mu plus 2.0mu minus 4.0mu. With the amsmath package, or as of the 2020-10-01 LaTeX release, can be used in text mode as well as math mode; before that, in math mode only.
\negmedspace 	 Normally -4.0mu plus 2.0mu minus 4.0mu. With the amsmath package, or as of the 2020-10-01 LaTeX release, can be used in text mode as well as math mode; before that, in math mode only.
\, 	 Synonym: \thinspace. Normally 3mu, which is 1/6em. Can be used in both math mode and text mode (see \thinspace & \negthinspace).
This space is widely used, for instance between the function and the infinitesimal in an integral \int f(x)\,dx and, if an author does this, before punctuation in a displayed equation.

The antiderivative is
\begin{equation}
  3x^{-1/2}+3^{1/2}\,.
\end{equation}

\! 	 Synonym: \negthinspace. A negative thin space. Normally -3mu. With the amsmath package, or as of the 2020-10-01 LaTeX release, can be used in text mode as well as math mode; otherwise, the \! command is math mode only but the \negthinspace command has always also worked in text mode (see \thinspace & \negthinspace).
\quad 	 This is 18mu, that is, 1em. This is often used for space surrounding equations or expressions, for instance for the space between two equations inside a displaymath environment. It is available in both text and math mode.
\qquad 	 A length of 2 quads, that is, 36mu = 2em. It is available in both text and math mode.

\smash
Synopsis:

\smash{subformula}

Typeset subformula as if its height and depth were zero.
In this example the exponential is so tall that without the \smash command LaTeX would separate its line from the line above it, and the uneven line spacing might be unsightly.

To compute the tetration $\smash{2^{2^{2^2}}}$,
evaluate from the top down, as $2^{2^4}=2^{16}=65536$.

(Because of the \smash the printed expression could run into the line above so you may want to wait until the final version of the document to make such adjustments.)
This pictures the effect of \smash by using \fbox to surround the box that LaTeX will put on the line. The \blackbar command makes a bar extending from 10 points below the baseline to 20 points above.

\newcommand{\blackbar}{\rule[-10pt]{5pt}{30pt}}
\fbox{\blackbar}
\fbox{\smash{\blackbar}}

The first box that LaTeX places is 20 points high and 10 points deep. But the second box is treated by LaTeX as having zero height and zero depth, despite that the ink printed on the page still extends well above and below the line.
The \smash command appears often in mathematics to adjust the size of an element that surrounds a subformula. Here the first radical extends below the baseline while the second lies just on the baseline.

\begin{equation}
\sqrt{\sum_{0\leq k< n} f(k)}
\sqrt{\vphantom{\sum}\smash{\sum_{0\leq k< n}} f(k)}
\end{equation}

Note the use of \vphantom to give the \sqrt command an argument with the height of the \sum (see \phantom & \vphantom & \hphantom).
While most often used in mathematics, the \smash command can appear in other contexts. However, it doesn’t change into horizontal mode. So if it starts a paragraph then you should first put a \leavevmode, as in the bottom line below.

Text above.

\smash{smashed, no indent}  % no paragraph indent

\leavevmode\smash{smashed, with indent}  % usual paragraph indent

The package mathtools has operators that provide even finer control over smashing a subformula box.

\phantom & \vphantom & \hphantom
Synopsis:

\phantom{subformula}

or

\vphantom{subformula}

or

\hphantom{subformula}

The \phantom command creates a box with the same height, depth, and width as subformula, but empty. That is, this command causes LaTeX to typeset the space but not fill it with the material. Here LaTeX will put a blank line that is the correct width for the answer, but will not show that answer.

\begin{displaymath}
  \int x^2\,dx=\mbox{\underline{$\phantom{(1/3)x^3+C}$}} 
\end{displaymath}

The \vphantom variant produces an invisible box with the same vertical size as subformula, the same height and depth, but having zero width. And \hphantom makes a box with the same width as subformula but with zero height and depth.
In this example, the tower of exponents in the second summand expression is so tall that TeX places this expression further down than its default. Without adjustment, the two summand expressions would be at different levels. The \vphantom in the first expression tells TeX to leave as much vertical room as it does for the tower, so the two expressions come out at the same level.

\begin{displaymath}
    \sum_{j\in\{0,\ldots\, 10\}\vphantom{3^{3^{3^j}}}}
      \sum_{i\in\{0,\ldots\, 3^{3^{3^j}}\}} i\cdot j
\end{displaymath}

These commands are often used in conjunction with \smash. See \smash, which includes another example of \vphantom.
The three phantom commands appear often but note that LaTeX provides a suite of other commands to work with box sizes that may be more convenient, including \makebox (see \mbox & \makebox) as well as \settodepth (see \settodepth), \settoheight (see \settoheight), and \settowidth (see \settowidth). In addition, the mathtools package has many commands that offer fine-grained control over spacing.
All three commands produce an ordinary box, without any special mathematics status. So to do something like attaching a superscript you should give it such a status, for example with the \operatorname command from the package amsmath.
While most often used in mathematics, these three can appear in other contexts. However, they don’t cause LaTeX to change into horizontal mode. So if one of these starts a paragraph then you should prefix it with \leavevmode.

\mathstrut
Synopsis:

\mathstrut

The analogue of \strut for mathematics. See \strut.
The input $\sqrt{x} + \sqrt{x^i}$ gives output where the second radical is taller than the first. To add extra vertical space without any horizontal space, so that the two have the same height, use $\sqrt{x\mathstrut} + \sqrt{x^i\mathstrut}$.
The \mathstrut command adds the vertical height of an open parenthesis, (, but no horizontal space. It is defined as \vphantom{(}, so see \phantom & \vphantom & \hphantom for more. An advantage over \strut is that \mathstrut adds no depth, which is often the right thing for formulas. Using the height of an open parenthesis is just a convention; for complete control over the amount of space, use \rule with a width of zero. See \rule.

Math styles
TeX’s rules for typesetting a formula depend on the context. For example, inside a displayed equation, the input \sum_{0\leq i<n}k^m=\frac{n^{m+1}}{m+1}+\mbox{lower order terms} will give output with the summation index centered below the summation symbol. But if that input is inline then the summation index is off to the right rather than below, so it won’t push the lines apart. Similarly, in a displayed context, the symbols in the numerator and denominator will be larger than for an inline context, and in display math subscripts and superscripts are further apart then they are in inline math.
TeX uses four math styles.
Display style is for a formula displayed on a line by itself, such as with \begin{equation} ... \end{equation}.
Text style is for an inline formula, as with ‘so we have $ ... $’.
Script style is for parts of a formula in a subscript or superscript.
Scriptscript style is for parts of a formula at a second level (or more) of subscript or superscript.
TeX determines a default math style but you can override it with a declaration of \displaystyle, or \textstyle, or \scriptstyle, or \scriptscriptstyle.
In this example, the ‘Arithmetic’ line’s fraction will look scrunched.

\begin{tabular}{r|cc}
  \textsc{Name}  &\textsc{Series}  &\textsc{Sum}  \\  \hline
  Arithmetic     &$a+(a+b)+(a+2b)+\cdots+(a+(n-1)b)$
                   &$na+(n-1)n\cdot\frac{b}{2}$  \\
  Geometric      &$a+ab+ab^2+\cdots+ab^{n-1}$
                   &$\displaystyle a\cdot\frac{1-b^n}{1-b}$  \\
\end{tabular}

But because of the \displaystyle declaration, the ‘Geometric’ line’s fraction will be easy to read, with characters the same size as in the rest of the line.
Another example is that, compared to the same input without the declaration, the result of

we get
$\pi=2\cdot{\displaystyle\int_{x=0}^1 \sqrt{1-x^2}\,dx}$

will have an integral sign that is much taller. Note that here the \displaystyle applies to only part of the formula, and it is delimited by being inside curly braces, as ‘{\displaystyle ...}’.
The last example is a continued fraction.

\begin{equation}
a_0+\frac{1}{
       \displaystyle a_1+\frac{\mathstrut 1}{
       \displaystyle a_2+\frac{\mathstrut 1}{
       \displaystyle a_3}}}
\end{equation}

Without the \displaystyle declarations, the denominators would be set in script style and scriptscript style. (The \mathstrut improves the height of the denominators; see \mathstrut.)

Math miscellany
LaTeX contains a wide variety of mathematics facilities. Here are some that don’t fit into other categories.

Colon character : & \colon
Synopsis, one of:

:
\colon

In mathematics, the colon character, :, is a relation.

With side ratios \( 3:4 \) and \( 4:5 \), the triangle is right.

Ordinary LaTeX defines \colon to produce the colon character with the spacing appropriate for punctuation, as in set-builder notation \{x\colon 0\leq x<1\}.
But the widely-used amsmath package defines \colon for use in the definition of functions f\colon D\to C. So if you want the colon character as a punctuation then use \mathpunct{:}.

\*
Synopsis:

\*

A multiplication symbol that allows a line break. If there is a break then LaTeX puts a \times symbol, ×, before that break.
In \( A_1\* A_2\* A_3\* A_4 \), if there is no line break then LaTeX outputs it as though it were \( A_1 A_2 A_3 A_4 \). If a line break does happen, for example between the two middle ones, then LaTeX sets it like \( A_1 A_2 \times \), followed by the break, followed by \( A_3 A_4 \).

\frac
Synopsis:

\frac{numerator}{denominator}

Produces the fraction. Used as: \begin{displaymath} \frac{1}{\sqrt{2\pi\sigma}} \end{displaymath}. In inline math mode it comes out small; see the discussion of \displaystyle (see Math formulas).

\sqrt
Synopsis, one of:

\sqrt{arg}
\sqrt[root-number]{arg}

The square root, or optionally other roots, of arg. The optional argument root-number gives the root, i.e., enter the cube root of x+y as \sqrt[3]{x+y}. The size of the radical grows with that of arg (as the height of the radical grows, the angle on the leftmost part gets steeper, until for a tall enough arg, it is vertical).
LaTeX has a separate \surd symbol for making a square root without arg (see Math symbols).

\stackrel
Synopsis:

\stackrel{text}{relation}

Put text above relation. To put a function name above an arrow enter \stackrel{f}{\longrightarrow}.