Docsity

Operations with Sets: Union, Intersection, and Difference - Prof. Jorge Viola-Prioli, Study notes of Discrete Mathematics

Partial preview of the text

Download Operations with Sets: Union, Intersection, and Difference - Prof. Jorge Viola-Prioli and more Study notes Discrete Mathematics in PDF only on Docsity!

§11.OPERATIONS WITH SETS

We will devote this sec.on to three basic opera.ons with set and to the analysis of the Inclusion‐Exclusion Formula , which is an addi.onal coun.ng principle.

DEFINITION. Given sets A and B the union of A and B is the set

defined as {x; x ∈ A or x ∈B}. This set is denoted by A ∪ B.

It follows at once from the defini.on that

  1. A ∪ B = B ∪ A
  2. A ∪ A = A
  3. A ∪ ∅ = A
  4. A ⊆ A ∪ B and B ⊆ A ∪ B.

The dual no.on, intersec.on, is introduced next.

DEFINITION. Given sets A and B we define the intersec@on of A and B

as {x; x ∈ A and x ∈ B}. This set is denoted by A ∩ B. It follows at once from the defini.on that

  1. A ∩ B = B ∩ A
  2. A ∩ A = A
  3. A ∩ ∅ = ∅
  4. A ∩ B ⊆ A and A ∩ B ⊆ B

A B A B €

The intersec.on of A and B can be represented by the following Venn diagram:

Unravel P : x ∈ A ∪ (B ∩ C), equivalently x ∈ A or x ∈ (B ∩ C). Equivalently, x ∈ A or (x ∈ B and x ∈ C) # Unravel Q : x ∈ (A ∪ B) ∩ (A ∪ C), equivalently x ∈ (A ∪ B) and x ∈ (A ∪ C). Equivalently, (x ∈ A or x ∈ B) and (x ∈ A or x ∈ C) ## In # we must explore the two possible cases, to produce the link from P to Q: Case a: x ∈ A. Therefore, (x ∈ A or x ∈ B) clearly. Likewise, (x ∈ A or x ∈ C). Thus, (x ∈ A or x ∈ B) and (x ∈ A or x ∈ C) , hence ## holds. Case b): x ∈ B and x ∈ C. Since x ∈ B we have that (x ∈ A or x ∈ B), and since x ∈ C it follows that (x ∈ A or x ∈ C). Given that this is occurring simultaneously, we have that (x ∈ A or x ∈ B) and (x ∈ A or x ∈ C), so ## holds also in this second case. Having proved that X ⊆ Y we leave the other containment (that is, Y ⊆ X) as a good prac@ce exercise.

Recall that with |A| we denote the number of elements of the set A. We are interested in compu.ng the size of the union of two arbitrary sets, that is, |A ∪ B|. The answer is given in

THEOREM: Let A and B be sets with finitely many elements. Then

|A ∪ B|= |A | + | B| −|A ∩ B|.

Proof. Recall that in any set the elements must be different. If any of the sets is empty, the equality follows at once (do you see why?). We might then assume they are non‐empty, say A = {a 1 , …, an} and B= {b 1 , ….bm}. Since some elements may appear in both sets we rearrange all the elements by wri.ng A = {c 1 , …, cp, a 1 ,... , at} and B={c 1 , …, cp, b 1 ,... , bs} where c 1 , …, cp denotes the common elements.

ILLUSTRATION. A survey reveals that 150 students either swim or jog,

85 of them swim and 60 students swim and jog. Find the number of students that jog. Solu@on. Call S the set of students that swim, and call J the set of students that jog. Recall that in Math the or is inclusive! Hence some of the 150 students that swim or jog may be involved in both ac.vi.es! Observe that we are looking for |J|. Since 150= |S ∪ J|= |S | + |J| − |S ∩ J|= 85 + |J| − 60= 25 + |J|, we infer that |J| = 125. The textbook leaves as an exercise the important Inclusion‐Exclusion formula for three sets: |A ∪ B ∪ C| = |A | + | B| + |C | −|A ∩ B| − |A ∩ C| − |B ∩ C| + |A ∩ B ∩ C|

Hint: to prove this formula call X = A ∪ B, replace in the leo hand side, and use the previous theorem together with the De Morgan’s Laws. It is not hard.

Remarks.

a) The theorem can be thought of as the Inclusion‐Exclusion formula for only two sets. b) The Inclusion‐Exclusion formula can be extended to more than three sets, although we will not make use of that generaliza.on in what follows.

APPLICATION. How many numbers in the set {1, 2, …, 1000} are

divisible by 2, by 3 or by 5? Solu@on. Let all small cap lerers indicate integers.

Observe that we did not embark into lis.ng those numbers: we just computed how many there are, thus answering our ques.on. Another opera.on is introduced next.

DEFINITION. Given sets A and B their difference is defined as

{x; x ∈ A and x ∉ B}. This set is denoted by A −B. Please no.ce that the nota.on is sugges.ve: “remove from A those elements of B”. It should be emphasized that A −B does not involve an algebraic opera@on , but a symbol to denote the construc.on of this new set.

The difference can be represented by the following Venn diagram: A A ‐ B B

It follows at once from the defini.on that

  1. A − A = ∅
  2. A − ∅ = A
  3. A−B is different from B−A, in general.

Exercise. By resor.ng to the defini.ons, prove that A−B= A−(A ∩ B).

Make also a Venn diagram to visualize the statement. CAUTION : |A−B| is not |A| − |B|. So, how do we compute |A−B|? See the next

PROPOSITION. |A−B|= |A| − |A ∩ B|.

Proof. We just need to observe that (A−B) and (A ∩ B) are disjoint sets whose union is A. Therefore, |A| = |A−B| + |A ∩ B|, from which we can solve for |A−B|.

APPLICATION.

In a study of 260 pa.ents and two drugs ( A and B ) it was found that 140 were affected by drug A, 210 were affected by at least one drug and 100 were affected by B. Solu@on. Call for simplicity A the set of pa.ents affected by drug A , and B those pa.ents affected by drug B. Recall that |A ∪ B|= |A | + | B| − |A ∩ B|. Accordingly, we have |A|=140, |B|= 100, |A ∪ B|= 210. Therefore, we infer that |A ∩ B| = |A | + | B| − |A ∪ B| = 140 + 100 − 210= Find how many pa.ents were a) affected by both b) affected by A but not by B c) affected by just one drug d) not affected by either drug

DEFINITION. Given sets A and B we define their symmetric difference

as (A−B) ∪ (B −A). This set is denoted by A Δ B. The symmetric difference of A and B can be represented by the following Venn diagram: A B A Δ B

It follows at once from the defini.on that

  1. A Δ B = B Δ A
  2. A − B, B − A and A ∩ B are (pairwise) disjoint
  3. A Δ B and A ∩ B are disjoint.

PROPOSITION. A Δ B = (A ∪ B) − (A ∩ B).

Proof. Leo as an exercise. Another important opera.on with sets is the Cartesian product.

DEFINITION. Given sets A and B we define the Cartesian product of A

and B as {(a, b) ; a ∈ A and b ∈ B}. This set is denoted by A × B.