1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
|
[\<- 2.1](2.1.md)
---
# 2.2 Set Operations p1
We can represent sets in a **Venn Diagram** as circles/ellipses that lie inside some **universal set**
```
+----------+
| |
| +--+ u |
| | s| |
| | | |
| +--+ |
+----------+
```
- "rectangle is universal set `u`
- Ex.
- Let `u` = ℤ
- 'A' = `{2k | k∈ℤ}`
- 'B' = `{3l | l∈ℤ}`
1. Draw a Venn Diagram and write at least on element in each "region"
```
+---------------------+
| |
| +-------+ u |
| | A | |
| | +-------+ |
| | | | | |
| +----|--+ | |
| | B | |
| +-------+ |
+---------------------+
```
- `u` is representing ℤ
- Examples that belong in each region:
- Inside 'A', outside 'B'
- 2
- 4
- Inside 'B', outside 'A'
- 3
- -9
- Inside both 'A' and 'B'
- 6
- 0
- -18
- Outside of both 'A' and 'B' (but inside `u`)
- 7
- 5
- **Definitions**: If 'A', 'B' are sets, the
1. **Intersection** of 'A' and 'B', written `A∩B`, is the set of all elements in 'A' **and** 'B'
2. **Union** of 'A' and 'B', written `A∪B`, is the set of all elements in 'A' **or** 'B'
- the "or" is inclusive, btw
### Intersection Venn Diagram
```
+---------------------+
| A↓ |
| +-------+ u |
| | | |
| | +-------+ |
| | |██| | |
| +----|--+ |← |
| | |B |
| +-------+ |
+---------------------+
```
- `A∩B` = shaded
### Union Venn Diagram
```
+---------------------+
| A↓ |
| +-------+ u |
| |███████| |
| |████+-------+ |
| |████|██|████| |
| +----|--+████|← |
| |███████|B |
| +-------+ |
+---------------------+
```
- `A∪B` = shaded
|Words|Logic|Sets|
|-----|-----|----|
|and |^ |∩ |
|or |∨ |∪ |
- Describe `A∩B`, `A∪B` in the earlier example
- `A∩B` = multiples of 2 **and** 3
- multiples of 6
- `A∪B` = multiples of 2 **or** 3
- 2, 3, 4, 6, 8, ...
---
- **Definition**: If `A∩B` = Ø, we say 'A' and 'B' are **disjoint**
```
+---------------------+
| |
| +-------+ u |
| | A | |
| | | |
| | | +----+ |
| +-------+ | B | |
| | | |
| +----+ |
+---------------------+
```
- Notice how 'A' and 'B' don't overlap at all
- **Definition**: Fix a universal set `u`, and `S ≺= u`. The **complement** of 'S', written s̅ or s^c, is the set of elements `u` not in 'S'
**complement**
```
+---------------------+
|█████████████████████|
|██+-------+██████u███|
|██| S |██████████|
|██| |██████████|
|██| |██████████|
|██+-------+██████████|
|█████████████████████|
|█████████████████████|
+---------------------+
```
- Everything outside of 'S' and inside `u` is shaded
- the shaded region is s̅
- **Definition**: The **difference** of 'A' and 'B', written `A-B` or `A\B`, is the set of elements **in 'A' but not 'B'**
```
+---------------------+
| A↓ |
| +-------+ u |
| |███████| |
| |████+-------+ |
| |████| | | |
| +----|--+ |← |
| | |B |
| +-------+ |
+---------------------+
```
- The shaded region is `A-B`
- **Note**: `A-B` = `A∩¯(B̄̄̄̄̄̄̄̄̄)`
- (line above 'B' -> complement of B)
---
## Set Identities
| | | |
|-|-|-|
|**Commutative**|`A∪B` = `B∪A`|`A∩B` = `B∩A`|
|**Associative**|`A∪(B∪C)` = `(A∪B)∪C`|`A∩(B∩C)` = `(A∩B)∩C`|
|**De Morgan (for sets)|`¯(A∩B)` (not in ('A and 'B')) = `¯(A)∪¯(B)`|`¯(A∪B)` (not in ('A or 'B')) = `¯(A)∩¯(B)`|
---
# 2.2 Set Operations p2
Ex: Let `A ≺= B`. Prove that `A∪B ≺= B`
- Proof: Let x∈A∪B. Then, x∈A or x∈B.
- Case 1: If x∈A, then x∈B since `A ≺= B`
- Case 2: If x∈B, then we are done
- ∴ x∈B which implies `A∪B ≺= B` ▣
- **Theorem**: Let 'A', 'B' be sets. 'A' = 'B' iff `A ≺= B` and `B ≺= A`
|