Equations and Formulas#
Objective: Experiment with mathematical notation in LaTeX.
Getting Started: Basic Equations#
Inline vs Display Style#
To add math to your documents, you first have to enter math mode. Math can be displayed inline or in math blocks (called display style). To render equations in inline style, enclose them in a pair of dollar signs $...$
.
Inline: Using $x + y = z$
will display the equation \(x + y = z\) in the line.
To render equations in display style, LaTeX offers several options. We suggest using \[...\]
to start.
Display: Using \[ x + y = z \]
will display the equation centered on its own line as below.
Simple Operators, Subscripts, Superscripts & More#
To render simple equations, you also need to know syntax and commands for operators, relations, subscripts, superscripts, and fractions.
Operators & Relations:
+, , =, >, < work as expected. Here are some other commands:
Command 
Display 
Command 
Display 


\(\times\) 

\(\cdot\) 

\(\div\) 

\(\pm\) 

\(\geq\) 

\(\leq\) 

\(\neq\) 

\(\approx\) 
Subscript: use the underscore (_) / Superscript: use the carret (^)
Note
If the subscript or superscript includes more than one character, enclose it in curly brackets–otherwise the command applies only to the first character.
Example: $x^n+1$
gives \(x^n+1\) but $x^{n+1}$
gives \(x^{n+1}\)
Fractions:
To display a fraction, use the command \frac
followed by the numerator and denominator in curly brackets.
Example: \frac{1}{x}
gives \(\frac{1}{x}\)
Exercise 1#
Open a blank document in Overleaf and recreate this text in your document using LaTeX commands:
A quadratic equation is an equation of the form \(ax^2 + bx + c = 0\) and such equations can be solved using the quadratic formula:
Commands needed: \frac{}{}
, \pm
, \sqrt{}
Challenge Exercise
Recreate these equations in your document:
Tip
Getting compile errors or having problems getting the equations to render correctly? Compare your LaTeX code with the solutions.
Next Steps: Greek Letters, Integrals & More#
Greek Letters#
Many equations and formulas use Greek letters. The command is simple  just the backslash and the name of the letter. Capitalize the command to get the capital letter. Here are some examples:
Command 
Display 
Command 
Display 


\(\alpha\) 

\(\mu\) 

\(\beta\) 

\(\pi\) 

\(\Gamma\) 

\(\rho\) 

\(\delta\) 

\(\sigma\) 

\(\Delta\) 

\(\Phi\) 

\(\lambda\) 

\(\omega\) 

\(\Lambda\) 

\(\Omega\) 
Note
Greek letters that are the same in English are an exception, for example, use A for Alpha, B for Beta, Z for Zeta. For more commands, see the Overleaf list of Greek letters.
Limits, Integrals, Products & Sums#
There are also commands for common operations that take upper and lower bounds:
Limits:
\[
lim_{x \to \infty} f(x)
\]
results in
Integrals
\[
\int_{a}^{b} x^2 dx
\]
results in
Products
\[
\prod_{i=a}^{b} f(i)
\]
results in
Sums
What about summation (\(\sum\))?
Exercise 2#
Recreate these equations in your Overleaf document:
Commands needed: \pi
, \infty
, \frac{}{}
, \sum_{}^{}
Challenge Exercise
Recreate this text in your document:
Suppose that the measurable sets \(A_1,A_2,...\) are “almost disjoint” in the sense that \(\mu(A_i \cap A_j) = 0\) if \(i \neq j\). Prove that
Commands needed: \mu
, \cap
, \neq
, \cup
, \infty
, \sum_{}
, \geq
Tip
Need help getting the text and equations to render properly? Compare your LaTeX code with the solutions.
More Advanced: Math Packages#
amsmath & amssymb Packages#
LaTeX has many packages that you can use to extend its capabilities. The amsmath and amssymb packages provide you with additional symbols and commands for structuring equations.
To include them, add these commands to the preamble of your LaTeX document:
\usepackage{amsmath}
\usepackage{amssymb}
amsmath: Equations Environment#
Use the \begin{equation}...\end{equation}
command to include a numbered equation in display mode.
\begin{equation}
(I  A \otimes A) vec(X) = vec(Q)
\end{equation}
results in
Note
Use \begin{equation*}
for unnumbered equations.
amsmath: Align Environment#
The command \begin{align}...\end{align}
will allow you to align a series of equations around a common element, which you can identify with the ampersand (&).
\begin{align}
\frac{d}{dx} \sin x &= \cos x \\
\frac{d}{dx} \cos x &= \sin x \\
\frac{d}{dx} \tan x &= \sec^2 x
\end{align}
results in
amsmath: Cases Environment#
The amsmath package also offers the \begin{cases}...\end{cases}
command, which enables you to display an equation with multiple cases.
\begin{equation*}
f(n) = \begin{cases}
0 & n=0 \\
1 & n=1 \\
f(n1) + f(n2) & \text{otherwise}
\end{cases}
\end{equation*}
results in
Note
Use the \text{}
command to include text in math mode.
amssymb#
The amssymb package provides access to more options for mathematical symbols including additional fonts such as BlackboardBold.
More fonts:
\mathbb{R}
gives \(\mathbb{R}\) for the set of real numbers.
More symbols:
\approxeq
\(\Rightarrow\) \(\approxeq\)
\nleq
\(\Rightarrow\) \(\nleq\)
Alternate versions of symbols:
in plain LaTeX: \emptyset
\(\Rightarrow\) \(\emptyset\)
with amssymb: \varnothing
\(\Rightarrow\) \(\varnothing\)
Matrices#
To create a matrix in your document, you can use the the {array}
environment in plain LaTeX or the simpler {matrix}
environment in the amsmath package.
\[
\begin{matrix}
a & b & c \\
d & e & f \\
\end{matrix}
\]
results in a matrix with no brackets:
Note
Compare that to {pmatrix}
for matrices with parentheses, {bmatrix}
for matrices with square brackets, and {vmatrix}
for determinants.
{pmatrix}
{bmatrix}
{vmatrix}
Exercise 3#
Part A
Recreate these matrices in your Overleaf document:
Commands needed: \begin{bmatrix}...\end{bmatrix}
, \begin{pmatrix}...\end{pmatrix}
, \alpha
, \beta
, \gamma
, \lambda
, \mu
, \nu
, \rho
, \sigma
, \tau
Part B
Recreate this equation in your document:
Commands needed: \begin{equation*}...\end{equation*}
, \int_{}
, \Sigma
, \sum_{}^{}
, \frac{}{}
, \partial
, \rho
, \text{}
, \in
, \infty
, \mathbb{}
Note
To scale the parentheses to the height of the equation, use the commands \left(
and \right)
.
Tip
Need help getting the text and equations to render properly? Compare your LaTeX code with the solutions.