Sets, Functions, and Relations, Study notes of Mathematics

One of the most important ways to define a subset of a given uni- versal set, is using the set builder notation. Many sets are defined in this manner.

Typology: Study notes

2022/2023

Uploaded on 03/01/2023

ekachakra
ekachakra 🇺🇸

4.6

(33)

268 documents

1 / 9

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Sets, Functions, and Relations
Benjamin Cosman, Patrick Lin and Mahesh Viswanathan
Fall 2020
TAKE-AWAYS
A set is an unordered collection of objects, typically listed
without repetition.
is the emptyset, Zthe set of integers, Nthe set of nat-
ural numbers (or non-negative integers), Rthe set of real
numbers, and Qthe set of rational numbers.
Elements of a set uniquely determine the set. xSdenotes
that xis an element of set S.
RSdenotes that Ris a subset of Sor that every element
in Ris also an element of S.R=Sif RSand SR.
For sets Rand S,RSdenotes their union, RSdenotes
their intersection, R\Sdenotes their difference, and R
denotes the complement of R(with respect to a universe).
The Cartesian product of sets Rand Sis the set of all or-
dered pairs of the form (r,s)where rRand sS.
The power set of a set Sis the set consisting all subsets of S.
For a function f:AB,Ais the domain, and Bis the
codomain of function f. The range of function fis the set
{yB| xA f (x) = y}.
A function fis surjective/onto if codom(f) = rng(f).
A function fis injective/1-to-1if distinct elements are
mapped to distinct elements.
A function fis bijective if it is both injective and surjective.
Binary relations, with domain Aand co-domain B, are
subsets of A×B.
pf3
pf4
pf5
pf8
pf9

Partial preview of the text

Download Sets, Functions, and Relations and more Study notes Mathematics in PDF only on Docsity!

Benjamin Cosman, Patrick Lin and Mahesh Viswanathan

Fall 2020

TAKE-AWAYS

  • A set is an unordered collection of objects, typically listed without repetition.
  • ∅ is the emptyset, Z the set of integers, N the set of nat- ural numbers (or non-negative integers), R the set of real numbers, and Q the set of rational numbers.
  • Elements of a set uniquely determine the set. x ∈ S denotes that x is an element of set S.
  • R ⊆ S denotes that R is a subset of S or that every element in R is also an element of S. R = S if R ⊆ S and S ⊆ R.
  • For sets R and S, R ∪ S denotes their union, R ∩ S denotes their intersection, R \ S denotes their difference, and R denotes the complement of R (with respect to a universe).
  • The Cartesian product of sets R and S is the set of all or- dered pairs of the form (r, s) where r ∈ R and s ∈ S.
  • The power set of a set S is the set consisting all subsets of S.
  • For a function f : A → B, A is the domain, and B is the codomain of function f. The range of function f is the set {y ∈ B | ∃x ∈ A f (x) = y}.
  • A function f is surjective/onto if codom( f ) = rng( f ).
  • A function f is injective/ 1 -to- 1 if distinct elements are mapped to distinct elements.
  • A function f is bijective if it is both injective and surjective.
  • Binary relations, with domain A and co-domain B, are subsets of A × B.

Sets

A set is an unordered collection of objects, typically listed with- out repetition between braces. Unordered means that the way the elements of a set are listed does not matter. For example, the set {0, 2, 4, 6} is the same as the set {2, 0, 6, 4}. Elements of a set are also listed only once. So the set {0, 0}, is the same as the set { 0 }.

Notation. There are some important sets and their notation that you should be comfortable with.

  • {} and ∅ denote the empty set which is the unique set that contains no elements.
  • Z = {... − 2, −1, 0, 1, 2,.. .} denotes the set of all integers.
  • N = {0, 1, 2,.. .} denotes the set of natural numbers. Notice that in this course, and typically in computer science/mathematics, this set includes the number 0. If you are confused by this, you may want to read and remember N as N on-negative integers.
  • R denotes the set of all real numbers.

Example 1. Sets can contain any elements as members, including numbers, letters, symbols, or even other sets. Here are some exam- ples.

A = {0, 2, 4, 6} P = {B, C, D, E, F, J, K, P, Q, R, S, T, V} B = {{ 0 }, { 2 }, { 4 }, { 6 }} C = {∅, {∅}, {∅, {∅}}}

The set P above is a set of names of programming languages. How many of them did you know?

Since the elements in a set are unordered and do not repeat, a set is completely determined by its members. The “x ∈ S” means that x is a member of set S. An element of a set is something that is written between commas after erasing the outermost braces. Let us look at some examples.

Example 2. Let us look at the members of some sets introduced in Example 1. The elements of set A = {0, 2, 4, 6} are 0, 2, 4, and 6. On the other hand, the elements of set B = {{ 0 }, { 2 }, { 4 }, { 6 }} are { 0 }, { 2 }, { 4 }, and { 6 }. Notice, that 0 6 ∈ B but { 0 } ∈ B. Similarly, 0 ∈ A but { 0 } 6 ∈ A. The members of set C = {∅, {∅}, {∅, {∅}}} are ∅, {∅}, and {∅, {∅}}. Observe that ∅ is not a member of A or B. But ∅ ∈ C.

Example 8. The set of even integers can be defined as follows.

E = {n ∈ Z | n is even} = {n ∈ Z | ∃m ∈ Z n = 2 m}

The set Q = {r ∈ R | ∃m, n ∈ Z (n 6 = 0 ∧ r = mn )} defines the set of real numbers that can be written as the ratio of two integers, where the denominator is non-zero. In other words, Q is the set of all rational numbers.

Set Operations

Sets can combined in different ways to create new sets. We will describe some standard set operations in this section. We begin with the Boolean operations of union, intersection, difference, and comple- ment.

Definition 9. Let R and S be arbitrary sets. Union (R ∪ S), intersec- tion (R ∩ S), difference (R \ D), and complementation are defined as follows.

R ∪ S = {x | x ∈ R or x ∈ S} R ∩ S = {x | x ∈ R and x ∈ S} R \ S = {x ∈ R | x 6 ∈ S}

Typically there is a universe/domain of discourse that all sets in a discussion are subsets of. This universe is often implicitly known in the context. In such a case, the complement of set R (with respect to universe U) is given as R = U \ R.

Boolean operations on sets are best understood through what is often called a Venn diagram, that shows logical relationships between different sets. Sets are often represented as circles with their spatial arrangement mimicing their relationships. The universe is typically shown as a rectangle enclosing all the sets. Union and intersection of sets R and S can be pictorial shown in a Venn diagram as the shaded regions in Figure 1 and Figure 2 , respectively.

Figure 1 : R ∪ S

R S

Figure 2 : R ∩ S

R S

Similarly, the difference between R and S, and their complement are shown in Figure 3 and Figure 4. Let us look at some examples.

Figure 3 : R \ S

R S

Figure 4 : R

R S

Example 10. Let us recall the sets A = {0, 2, 4, 6}, B = {{ 0 }, { 2 }, { 4 }, { 6 }}, from Example 1. Observe that A ∪ B = {0, 2, 4, 6, { 0 }, { 2 }, { 4 }, { 6 }} but A ∩ B = ∅. Further, A ∪ ∅ = A, A ∩ ∅ = ∅, and A \ B = A. On the other hand, B \ A = B. Thus, in general, for sets R and S, R \ S is not necessarily equal to S \ R.

Example 10 makes a couple of observations that hold for any sets (not just A and B of the example).

Proposition 11. For any set S, S ∪ ∅ = S and S ∩ ∅ = ∅.

The set operations of union, intersection, and complementation, satisfy many of the properties that ∨, ∧, and ¬ satisfy in logic. The proof that they satisfy these properties often exploits the same prop- erties of the logical operators. Let us look at one example to illustrate this idea.

Proposition 12. For any sets X, Y, Z, X ∩ (Y ∪ Z) = (X ∩ Y) ∪ (X ∩ Z).

Proof. Let us fix some arbitrary sets X, Y, and Z. Recall that proving the equality of two sets R and S involves ar- guing that element of the first set is also an element of the second set and vice versa. As in the proof of any if and only if statement, there are two implications to be proved, and we need to do that in set equality proofs. In this case each direction can be proved by a direct proof.

X ∩ (Y ∪ Z) ⊆ (X ∩ Y) ∪ (X ∩ Z): We need to prove that for any x, if x ∈ X ∩ (Y ∪ Z) then x ∈ (X ∩ Y) ∪ (X ∩ Z). We will use a direct proof to establish this implication. Let x be an arbitrary element and assume that x ∈ X ∩ (Y ∪ Z). We use the definition of the set operations and logical reasoning to observe the following sequence of steps. x ∈ X ∩ (Y ∪ Z) → (x ∈ X) ∧ (x ∈ Y ∪ Z) → (x ∈ X) ∧ ((x ∈ Y) ∨ (x ∈ Z)) → ((x ∈ X) ∧ (x ∈ Y)) ∨ ((x ∈ X) ∧ (x ∈ Z)) → (x ∈ X ∩ Y) ∨ (x ∈ X ∩ Z) → (x ∈ (X ∩ Y) ∪ (X ∩ Z))

Figure 5 : Pictorial representation of the function g( 0 ) = 1, g( 1 ) = 2, and g( 2 ) = 2.

Functions

A function f : A → B assigns an element of B to each element of A. A is the domain, and B is the codomain of the function f. Given a function f , we will use dom( f ) to denote the domain, and codom( f ) to denote the codomain. On the other hand, the range of the function f (denoted rng( f )) is the set

rng( f ) = {b ∈ B | ∃a ∈ A f (a) = b}.

Example 17. Functions can be described in multiple ways. They can be given by explicitly listing the mapping. For example, consider the function g : {0, 1, 2} → {0, 1, 2} given by

g( 0 ) = 1 g( 1 ) = 2 g( 2 ) = 2

Sometimes it is convenient to represent the function pictorially, where arrows from the domain to the co-domain describe the mapping. For example, the function g described above is shown pictorially in Figure 5. Observe that dom(g) = codom(g) = {0, 1, 2}. On the other hand, rng(g) = {1, 2}; pictorially, these are all the elements that have an incoming arrow. Most of the time it is convenient to describe the function mathe- matically. For example, consider the function dbl : NN given by dbl(n) = 2 n. The domain, codomain, and range of dbl are as follows: dom(dbl) = codom(dbl) = N , and rng(dbl) = { 2 n | n ∈ N }.

Definition 18 (Injective, Surjective, and Bijective Functions). Consider a function f : A → B. f is said to be surjective or onto if rng( f ) = codom( f ). That is

∀y ∈ B∃x ∈ A f (x) = y.

Figure 6 : Function f given by: f ( 0 ) = 1, f ( 1 ) = 2 and f ( 2 ) = 0.

f is said to be 1 -to- 1 or injective if distinct elements in A get mapped to distinct elements in B. That is

∀x ∈ A∀y ∈ A (x 6 = y → f (x) 6 = f (y)).

f is said to be 1 -to- 1 and onto or bijective if it is both 1 -to- 1 and onto.

Let us look at some examples.

Example 19. The requirements of onto and 1 -to- 1 , can be understood pictorially as follows. Every element of the codomain has at least one incoming arrow when the function is onto. On the other hand, every element of the codomain as at most one incoming arrow, when the function is 1 -to- 1. Consider functions f : {0, 1, 2} → {0, 1, 2} and g : {0, 1, 2} → {0, 1, 2} defined as

f ( 0 ) = 1 f ( 1 ) = 2 f ( 2 ) = 0 g( 0 ) = 1 g( 1 ) = 2 g( 2 ) = 2

Function g is shown in Figure 5 , while function f is shown in Fig- ure 6. The function f is both 1 -to- 1 and onto. On the other hand g is neither 1 -to- 1 nor onto — g is not onto because 0 6 ∈ rng(g) and it is not 1 -to- 1 because g( 1 ) = g( 2 ). Since f is both 1 -to- 1 and onto, it is bijective. On the other hand, g is not bijective.

When proving whether a function is onto or 1 -to- 1 , we use the formal definition of these properties. Notice that injectiveness or 1 -to- 1 ness requires one to prove an implication. Often the most con- venient way to establish this is by looking at its contrapositive. Let us look at a couple of examples that state some useful properties about functions. Before looking at these properties, let us define what it means to compose two functions.

Definition 20. For functions f : A → B and g : B → C, their composition g ◦ f is a function A → C defined as

g ◦ f (a) = g( f (a)).