Term | Examples: |
(add additional examples from class) | |
set unordered collection of elements | \(7 \in \{43, 7, 9 \}\) \(2 \notin \{43, 7, 9 \}\) |
repetition doesn’t matter | |
Equal sets agree on membership of all elements | |
\(n\)-tuple ordered sequence of elements with \(n\) “slots" (\(n >0\)) | |
repetition matters, fixed length | |
Equal \(n\)-tuples have corresponding components equal | |
string ordered finite sequence of elements each from specified set (called the alphabet over which the string is defined) | |
repetition matters, arbitrary finite length | |
Equal strings have same length and corresponding characters equal |
Special cases:
When \(n=2\), the 2-tuple is called an ordered pair.
A string of length \(0\) is called the empty string and is denoted \(\lambda\).
A set with no elements is called the empty set and is denoted \(\{\}\) or \(\emptyset\).
Term | Notation Example(s) | We say in English … |
---|---|---|
all reals | \(\mathbb{R}\) | The (set of all) real numbers (numbers on the number line) |
all integers | \(\mathbb{Z}\) | The (set of all) integers (whole numbers including negatives, zero, and positives) |
all positive integers | \(\mathbb{Z}^+\) | The (set of all) strictly positive integers |
all natural numbers | \(\mathbb{N}\) | The (set of all) natural numbers. Note: we use the convention that \(0\) is a natural number. |
To define sets:
To define a set using roster method, explicitly list its elements. That is, start with \(\{\) then list elements of the set separated by commas and close with \(\}\).
To define a set using set builder definition, either form “The set of all \(x\) from the universe \(U\) such that \(x\) is ..." by writing \[\{x \in U \mid ...x... \}\] or form “the collection of all outputs of some operation when the input ranges over the universe \(U\)" by writing \[\{ ...x... \mid x\in U \}\]
We use the symbol \(\in\) as “is an
element of” to indicate membership in a set.
Example sets: For each of the following, identify whether it’s defined using the roster method or set builder notation and give an example element.
Can we infer the data type of the example element from the notation?
\(\{ -1, 1\}\)
\(\{0, 0 \}\)
\(\{-1, 0, 1 \}\)
\(\{(x,x,x) \mid x \in \{-1,0,1\} \}\)
\(\{ \}\)
\(\{ x \in \mathbb{Z} \mid x \geq 0 \}\)
\(\{ x \in \mathbb{Z} \mid x > 0 \}\)
\(\{ \smile, \sun \}\)
\(\{\texttt{A},\texttt{C},\texttt{U},\texttt{G}\}\)
\(\{\texttt{A}\texttt{U}\texttt{G}, \texttt{U}\texttt{A}\texttt{G}, \texttt{U}\texttt{G}\texttt{A}, \texttt{U}\texttt{A}\texttt{A}\}\)
Pro-tip: the meaning of writing one element next to another like \(xy\) depends on the data-types of \(x\) and \(y\). When \(x\) and \(y\) are strings, the convention is that \(xy\) is the result of string concatenation. When \(x\) and \(y\) are numbers, the convention is that \(xy\) is the result of multiplication. This is (one of the many reasons) why is it very important to declare the data-type of variables before we use them.
Fill in the missing entries in the table:
Set | Example elements in this set and their data type: |
---|---|
\(B\) | A C G U |
\((\texttt{A}, \texttt{C})\) \((\texttt{U}, \texttt{U})\) | |
\(B \times \{-1,0,1\}\) | |
\(\{-1,0,1\} \times B\) | |
\((0,0,0)\) | |
\(\{\texttt{A}, \texttt{C}, \texttt{G}, \texttt{U}\} \circ \{\texttt{A}, \texttt{C}, \texttt{G}, \texttt{U}\}\) | |
\(\texttt{G}\texttt{G}\texttt{G}\texttt{G}\) | |
Term | Notation Example(s) | We say in English … |
---|---|---|
sequence | \(x_1, \ldots, x_n\) | A sequence \(x_1\) to \(x_n\) |
summation | \(\sum_{i=1}^n x_i\) or \(\displaystyle{\sum_{i=1}^n x_i}\) | The sum of the terms of the sequence \(x_1\) to \(x_n\) |
piecewise rule definition | \(f(x) = \begin{cases} \text{rule 1 for } x & \text{when~COND 1} \\ \text{rule 2 for } x & \text{when COND 2}\end{cases}\) | Define \(f\) of \(x\) to be the result of applying rule 1 to \(x\) when condition COND 1 is true and the result of applying rule 2 to \(x\) when condition COND 2 is true. This can be generalized to having more than two conditions (or cases). |
function application | \(f(7)\) | \(f\) of \(7\) or \(f\) applied to \(7\) or the image of \(7\) under \(f\) |
\(f(z)\) | \(f\) of \(z\) or \(f\) applied to \(z\) or the image of \(z\) under \(f\) | |
\(f(g(z))\) | \(f\) of \(g\) of \(z\) or \(f\) applied to the result of \(g\) applied to \(z\) | |
absolute value | \(\lvert -3 \rvert\) | The absolute value of \(-3\) |
square root | \(\sqrt{9}\) | The non-negative square root of \(9\) |
Pro-tip: the meaning of two vertical lines \(| ~~~ |\) depends on the data-types of what’s between the lines. For example, when placed around a number, the two vertical lines represent absolute value. We’ve seen a single vertial line \(|\) used as part of set builder definitions to represent “such that”. Again, this is (one of the many reasons) why is it very important to declare the data-type of variables before we use them.