





Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
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
1 / 9
This page cannot be seen from the preview
Don't miss anything!






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.
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.
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
Figure 2 : 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
Figure 4 : R
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.
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 : N → N 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)).