Sums, Integrals & More
Some mathematical “functions” are so important (or just weird-looking) that tehy have their own special symbols and operators! These aren’t written by simply using their (shortened) name. This chapter discusses the most common ones: fractions, binomials, (square) roots, sums, products, integrals and logic/set operations.
Fractions
A fraction is created with
1\frac{numerator}{denominator}
Fractions can be nested within fractions as often as you like. Those nested fractions keep getting smaller and smaller, which is why I don’t recommend nesting them too deeply. If you want nested fractions to all stay at the same size, use \cfrac{num}{denom}
(continued fraction)
Want your fractions displayed with a diagonal slash? Include the xfrac
package and use
1\sfrac{numerator}{denominator}
1\[
2 \frac{2}{3} \text{ or } \sfrac{2}{3} \text{ or } x^{\frac{2}{3}}
3\]
Binomial
The command for creating binomials—sometimes also used for column vectors—works similarly.
1\binom{top}{bottom}
1\[
2 \binom{6}{4} = \frac{6!}{4! \cdot 2!}
3\]
(Square) Roots
Any type of root can be created with:
1\sqrt[n]{equation}
If you leave out the optional parameter (n), it’s a square root. Otherwise, it’s the n-th root. The symbol automatically scales with the equation.
1\[
2 \sqrt{a^2 + b^2} \ \sqrt[4]{a^2 + b^2}
3\]
Sums & Products
The syntax for sum symbols …
1\sum_{subscript}^{superscript}
The syntax for product symbols …
1\prod_{subscript}{superscript}
1\[
2 \sum_{i=1}^{n} 2i \not= \prod_{i=1}^{n} 2i
3\]
Integrals
A single integral can be created with
1\int_{subscript}^{superscript}
If you want more integrals, you can just place these after each other.
However, if you want multiple integrals with a single subscript you can use the \iint
, \iiint
and \iiiint
commands. These create two, three or four integrals after each other, respectively. For more integrals, you can use \idotsint
, which displays two integral symbols with the familiar dots between them.
Integrating over an area, by default, means a double integral. One along the first dimension, one along the second.
For cyclic integrals, include the esint
package. Now use oint
for a cyclic integral. Or \oiint
for a double cyclic integral.
1\oint_{subscript}^{superscript}
1\usepackage{esint}
2
3\begin{document}
4 % Special command to display the differential in roman letters
5 % Not necessary, but highly recommended
6 \newcommand*\diff{\mathop{}\!\mathrm{d}}
7
8 % The actual integrals
9 \[
10 \int_{a}^{b} 4x \diff x \not= \idotsint 4x \diff x
11 \]
12
13 \[
14 \oint_{a}^{b} 4x \diff x \not= \oiint 4x \diff x
15 \]
16
17\end{document}
Logic & Set Operations
For operations on sets (unions and intersections), use the \bigcup
and \bigcap
commands.
For logical operations (AND and OR), use the \bigwedge
and \bigvee
commands.
Yes, they are name dafter what they look like, not their function. You know I’m all about semantics. So I hate this and—during my years of studying—kept forgetting this and having to look it up on my own tutorials website 😅
1\[
2 A \bigcup B = \left\{ x \in \mathbb{R} \middle| x \in A \bigvee x \in B \right\}
3\]
4\[
5 A \bigcap B = \left\{ x \in \mathbb{R} \middle| x \in A \bigwedge x \in B \right\}
6\]
Leftovers
Besides these, there are 6 other “big” symbols you can use:
Command | Visual |
---|---|
\bigoplus | \( \bigoplus\) |
\bigotimes | \( \bigotimes \) |
\bigodot | \( \bigodot \) |
\bigsqcup | \( \bigsqcup \) |
\biguplus | \( \biguplus \) |
\coprod | \( \coprod \) |
Stacking Subscripts
What if you want multiple subscripts for one of these big chunky symbols? You could use the atop
command discussed before.
A much better and easier solution, however, is at hand: substacks.
1\substack{something \ something}
1\[
2 \sum_{\substack{ i=1 \ i \not= j}}^{n} i
3\]
Regular Superscripts
A problem arises if you try to get the subscript in math style, but want the superscript in regular text style. To solve this, you can set regular (and other) superscripts for big symbols with
1\sideset{left superscripts}{superscript}
1\[
2 \sideset{_a^b}{'}\sum_{\substack{ i=1 \ i \not= j}}^{n} i
3\]
Want to support me?
Buy one of my projects. You get something nice, I get something nice.
Donate through a popular platform using the link below.
Simply giving feedback or spreading the word is also worth a lot.