The course covers fundamental concepts of discrete structure like introduce logic, proofs, sets, relations, functions, counting, and probability, with an emphasis on applications in computer science.
CSC165Semester II3 credit hours6 units84 solved questions1,085 study cardsFull study modes
The course covers fundamental concepts of discrete structure like introduce logic, proofs, sets, relations, functions, counting, and probability, with an emphasis on applications in computer science.
The free sample is open to everyone. Sign in for 2 free weeks of every answer, flashcards and progress.
This chapter builds the vocabulary that the rest of discrete structures is written in: sets and the operations on them, functions and how they classify mappings between sets, the fuzzy generalisation of a set, and sequences with the summation notation used to add up their terms.
A set is an unordered collection of distinct objects, called its elements. Repeating an element or reordering a listing never changes the set. A set can be written in roster (tabular) form, by listing its elements inside braces, for example $A = {a, e, i, o, u}$, or in set builder notation, by stating the property its elements share, for example $A = {x : x \text{ is a vowel of the English alphabet}}$. Membership is written $x \in S$ and non-membership $x \notin S$; for $S = {1, 1.2, 1.7, 2}$, $1 \in S$ but $1.5 \notin S$.
Some sets recur so often that they have standard names: $\mathbb{N}$ (natural numbers, ${1, 2, 3, \ldots}$), $\mathbb{Z}$ (integers), $\mathbb{Z}^+$ (positive integers), $\mathbb{Q}$ (rationals), $\mathbb{R}$ (reals) and $\mathbb{W}$ (whole numbers, ${0, 1, 2, \ldots}$).
The cardinality of a set $S$, written $|S|$, is the number of elements it contains; an infinite set has infinite cardinality. Comparing cardinalities of two sets $X$ and $Y$ connects directly to functions between them: $|X| = |Y|$ exactly when a bijective function exists from $X$ to $Y$, $|X| \leq |Y|$ exactly when an injective function exists from $X$ to $Y$, and $|X| < |Y|$ when that injective function cannot be made bijective.
A set $X$ is a subset of $Y$, written $X \subseteq Y$, if every element of $X$ is also an element of $Y$. It is a proper subset, written $X \subset Y$, if additionally $X \neq Y$, that is $|X| < |Y|$. Every set is a (non-proper) subset of itself.
The universal set $U$ is the set of all objects under discussion in a given context; every other set considered is implicitly a subset of $U$. The empty (null) set, written $\emptyset$, contains no elements and has cardinality $0$, so it is finite. A singleton set contains exactly one element, for instance ${8}$.
Two sets are equal if they contain exactly the same elements, regardless of order, for example ${1, 2, 6} = {6, 1, 2}$. Two sets are equivalent if they merely have the same cardinality, for example ${1, 2, 6}$ and ${16, 17, 22}$ are equivalent because both have three elements, even though they are not equal. Two sets are overlapping if they share at least one common element, and disjoint if they share none. For disjoint sets, $A \cap B = \emptyset$ and consequently $n(A \cup B) = n(A) + n(B)$; for overlapping sets this identity needs a correction term, which is the subject of the inclusion-exclusion principle below.
The power set of a set $S$, written $P(S)$, is the set of all subsets of $S$, including $\emptyset$ and $S$ itself. If $|S| = n$, then $|P(S)| = 2^n$, since each element is independently either included or excluded from a given subset.
For $S = {a, b, c, d}$, listing subsets by size gives one subset of size $0$ (namely $\emptyset$), four of size $1$, six of size $2$, four of size $3$, and one of size $4$, for $1+4+6+4+1 = 16 = 2^4$ subsets in total: $$P(S) = {\emptyset, {a},{b},{c},{d}, {a,b},{a,c},{a,d},{b,c},{b,d},{c,d}, {a,b,c},{a,b,d},{a,c,d},{b,c,d}, {a,b,c,d}}.$$ The power set of the empty set is not empty: $P(\emptyset) = {\emptyset}$, so $|P(\emptyset)| = 2^0 = 1$.
The Cartesian product of sets $A_1, A_2, \ldots, A_n$, written $A_1 \times A_2 \times \cdots \times A_n$, is the set of all ordered $n$-tuples $(x_1, x_2, \ldots, x_n)$ with $x_i \in A_i$ for every $i$. For two sets $A = {a, b}$ and $B = {1, 2}$, $$A \times B = {(a,1),(a,2),(b,1),(b,2)}, \qquad B \times A = {(1,a),(1,b),(2,a),(2,b)}.$$ Because the pairs are ordered, $A \times B \neq B \times A$ in general, and $|A \times B| = |A|\cdot|B|$.
Given sets $A$ and $B$ inside a universal set $U$: the union $A \cup B = {x : x \in A \text{ or } x \in B}$; the intersection $A \cap B = {x : x \in A \text{ and } x \in B}$; the set difference $A - B = {x : x \in A \text{ and } x \notin B}$; and the complement $A' = U - A = {x : x \notin A}$. For $A = {10,11,12,13}$ and $B = {13,14,15}$: $A \cup B = {10,11,12,13,14,15}$ (the shared element $13$ is listed once), $A \cap B = {13}$, $A - B = {10,11,12}$ and $B - A = {14,15}$, showing that set difference is not commutative.
The symmetric difference of $A$ and $B$, written $A \oplus B$, is the set of elements in exactly one of $A$ or $B$: $$A \oplus B = (A - B) \cup (B - A) = (A \cup B) - (A \cap B).$$ It satisfies $A \oplus \emptyset = A$ and $A \oplus A = \emptyset$ for every set $A$, and it is commutative ($A \oplus B = B \oplus A$) and associative ($A \oplus (B \oplus C) = (A \oplus B) \oplus C$).
Union, intersection and complement satisfy the following identities, collectively the algebra of sets:
| Law | Form |
|---|---|
| Idempotent | $A \cup A = A$, $\ A \cap A = A$ |
| Associative | $(A \cup B) \cup C = A \cup (B \cup C)$, $\ (A \cap B) \cap C = A \cap (B \cap C)$ |
| Commutative | $A \cup B = B \cup A$, $\ A \cap B = B \cap A$ |
| Distributive | $A \cup (B \cap C) = (A \cup B) \cap (A \cup C)$, $\ A \cap (B \cup C) = (A \cap B) \cup (A \cap C)$ |
| De Morgan's | $(A \cup B)' = A' \cap B'$, $\ (A \cap B)' = A' \cup B'$ |
| Identity | $A \cup \emptyset = A$, $\ A \cup U = U$, $\ A \cap U = A$, $\ A \cap \emptyset = \emptyset$ |
| Complement | $A \cup A' = U$, $\ A \cap A' = \emptyset$, $\ U' = \emptyset$, $\ \emptyset' = U$ |
| Involution | $(A')' = A$ |
Each of these can be proved directly from the definition of the operations. For instance, to prove the idempotent law $A \cup A = A$: since $B \subseteq A \cup B$ for any sets, taking $B = A$ gives $A \subseteq A \cup A$. Conversely, if $x \in A \cup A$ then $x \in A$ or $x \in A$, so $x \in A$ either way, giving $A \cup A \subseteq A$. The two inclusions together give $A \cup A = A$.
Discrete Structures for TU BSc CSIT is covered here in full, from syllabus notes to solved past questions. This subject has 6 chapters mapped to the official syllabus, and 84 past exam questions with written model answers. The opening of every note and answer is free, and the most-searched questions are free in full. A free account gets 2 free weeks of the whole program plus flashcards and progress tracking so weak topics come back before the exam.
This TU BSc CSIT Discrete Structures guide covers Basic Discrete Structures, Integers and Matrices, Logic and Proof Methods, Induction and Recursion, Counting and Discrete Probability, Relations and Graphs, across 6 chapters. It includes model answers to 84 past exam questions, plus flashcards for quick revision.
Discrete Structures has 6 chapters mapped to the official syllabus.
Yes. Each of the 84 past questions comes with a written model answer; the most-searched ones are free in full, the rest open with a free account's 2 free weeks or a pass.
Free to start. The opening of every note and answer is free, the most-searched questions are free in full, and a free account gets 2 free weeks of the whole program plus flashcards and progress tracking. After that a program pass keeps everything open.
Based on the official syllabus.
This chapter builds the vocabulary that the rest of discrete structures is written in: sets and the operations on them, functions and how they classify mappings between sets, the fuzzy generalisation of a set, and sequences with the summation notation used to add up their terms.
A set is an unordered collection of distinct objects, called its elements. Repeating an element or reordering a listing never changes the set. A set can be written in roster (tabular) form, by listing its elements inside braces, for example , or in set builder notation, by stating the property its elements share, for example . Membership is written and non-membership ; for , but .
Some sets recur so often that they have standard names: (natural numbers, ), (integers), (positive integers), (rationals), (reals) and (whole numbers, ).
The cardinality of a set , written , is the number of elements it contains; an infinite set has infinite cardinality. Comparing cardinalities of two sets and connects directly to functions between them: exactly when a bijective function exists from to , exactly when an injective function exists from to , and when that injective function cannot be made bijective.
A set is a subset of , written , if every element of is also an element of . It is a proper subset, written , if additionally , that is . Every set is a (non-proper) subset of itself.
The universal set is the set of all objects under discussion in a given context; every other set considered is implicitly a subset of . The empty (null) set, written , contains no elements and has cardinality , so it is finite. A singleton set contains exactly one element, for instance .
Two sets are equal if they contain exactly the same elements, regardless of order, for example . Two sets are equivalent if they merely have the same cardinality, for example and are equivalent because both have three elements, even though they are not equal. Two sets are overlapping if they share at least one common element, and disjoint if they share none. For disjoint sets, and consequently ; for overlapping sets this identity needs a correction term, which is the subject of the inclusion-exclusion principle below.
The power set of a set , written , is the set of all subsets of , including and itself. If , then , since each element is independently either included or excluded from a given subset.
For , listing subsets by size gives one subset of size (namely ), four of size , six of size , four of size , and one of size , for subsets in total: The power set of the empty set is not empty: , so .
The Cartesian product of sets , written , is the set of all ordered -tuples with for every . For two sets and , Because the pairs are ordered, in general, and .
Given sets and inside a universal set : the union ; the intersection ; the set difference ; and the complement . For and : (the shared element is listed once), , and , showing that set difference is not commutative.
The symmetric difference of and , written , is the set of elements in exactly one of or : It satisfies and for every set , and it is commutative () and associative ().
Union, intersection and complement satisfy the following identities, collectively the algebra of sets:
| Law | Form |
|---|---|
| Idempotent | , |
| Associative | , |
| Commutative | , |
| Distributive | , |
| De Morgan's | , |
| Identity | , , , |
| Complement | , , , |
| Involution |
Each of these can be proved directly from the definition of the operations. For instance, to prove the idempotent law : since for any sets, taking gives . Conversely, if then or , so either way, giving . The two inclusions together give .