# Sets and functionsIntroduction

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.

## Sets

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*.

**Definition**

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 contains a finite number of elements , we can write

For example is the set of

The fundamental operation provided by a set is

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

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

The set containing no elements is called the

Some sets with standard and specially typeset names include

- , the set of real numbers,
- , the set of rational numbers,
- , the set of integers, and
- , the set of natural numbers.