Selectați unul dintre cuvintele cheie din stânga ...

Sets and functionsIntroduction

Timp de citit: ~10 min

Sets and functions are foundational to the study of mathematics and ubiquitous in quantitative disciplines, including statistics and data science. In this course we review the basics of sets, lists, and functions from a data perspective. These ideas will be useful for developing rigorous mathematical language for discussing randomness, and they will also be helpful precursors to several important data structures we'll develop in the programming course.


A simple grocery list is a real-life example of a set: the main utility afforded by the grocery list is to answer the query "here's an item in the store; is it on list?" Note that for purposes of answering this question, the order of the listed items on the grocery list doesn't matter, and repeating an entry is equivalent to having a single instance of that entry. This leads us to the definition of the term set.

A set is an unordered collection of objects. The objects in a set are called elements.

The term object in this definition is deliberately vague. Sets may contain any kind of data: numbers, words, symbols, circles, squares, other sets, and many others.

If a set S contains a finite number of elements s_1, s_2, \ldots, s_n, we can write

\begin{align*}S = \{s_1, s_2, \ldots, s_n\}.\end{align*}

For example \{2,3,5,7\} is the set of .

The fundamental operation provided by a set is : we write s \in S to indicate that s is an element of the set S. If s is not an element of S, we write s \notin S.

If two sets have the same elements, then they are considered . For example,

\begin{align*}\{1,1,2\} = \{1,2\}\end{align*}

For this reason, we typically list the elements of a set without duplication.

The set containing no elements is called the and is denoted \emptyset or {}.

Some sets with standard and specially typeset names include

  • \mathbb{R}, the set of real numbers,
  • \mathbb{Q}, the set of rational numbers,
  • \mathbb{Z}, the set of integers, and
  • \mathbb{N}, the set of natural numbers.
Bruno Bruno