MAT1123 Units 1-3 Notes

Table of contents

  1. Unit 1 — Set Theory and Relations
  2. Set operations (Operações com conjuntos)
  3. Algebra of sets and Duality (Álgebra de conjuntos e dualidade)
  4. Finite / infinite sets, power sets, multisets
  5. Cartesian product (Produto cartesiano)
  6. Relations and their types (Relações)
  7. Partial order, Hasse diagram, lattice (course-plan L9)
  8. Applications: databases and SQL
  9. Unit 2 — Propositional Calculus
  10. Basic operations / connectives (Conectivos lógicos)
  11. Truth values of compound statements
  12. Tautology, contradiction, equivalence
  13. Normal forms (Formas normais)
  14. Quantifiers (Quantificadores)
  15. Applications: Boolean logic and digital circuits
  16. Unit 3 — Techniques of Counting
  17. Permutations (Permutações — order matters)
  18. The Pigeonhole Principle (Princípio da Casa dos Pombos)
  19. Combinations (Combinações — order does NOT matter)
  20. Decision table — which formula?
  21. Quick exam checklist (Units 1–3)

1. Unit 1 — Set Theory and Relations

1.1 What is a set?

A set is a well-defined collection of distinct objects, known as elements. The order of elements within a set does not matter, and repetitions are disregarded 1.

  • Set: A collection of distinct objects.
  • Elements: The individual objects within a set 1.

📝 A set can be represented as a bag of items where the arrangement and duplication of items are irrelevant 1.

2. Set operations (Operações com conjuntos)

2.1 Set notation and definitions

Sets are collections of distinct elements where order and repetition do not matter. They can be represented in roster form (listing elements) or set-builder form (describing elements) 2.

  • Roster form: Elements are listed within curly braces. Example: A={1,2,3}A = \{1, 2, 3\}.
  • Set-builder form: Describes the properties of the elements. Example: B={x:x is an even number, x<10}={2,4,6,8}B = \{x: x \text{ is an even number, } x < 10\} = \{2, 4, 6, 8\}.
  • Element membership: x∈Ax \in A means 'x belongs to A'; x∉Ax \notin A means 'x does not belong to A'.
  • Empty set: ∅\emptyset represents a set with no elements.
  • Universal set: UU encompasses all elements under consideration.
  • Number sets: Common sets include N\mathbb{N} (naturals), Z\mathbb{Z} (integers), Q\mathbb{Q} (rationals), and R\mathbb{R} (reals).
  • Cardinality: ∣A∣|A| denotes the number of elements in set A. For example, ∣{a,b,c}∣=3|\{a, b, c\}| = 3 2.

2.2 Subsets

A set AA is a subset of set BB (A⊆BA \subseteq B) if every element in AA is also in BB. If AA is a subset of BB and AA is not equal to BB, it is a proper subset (A⊂BA \subset B) 2.

  • Subset definition: A⊆BA \subseteq B means all elements of AA are in BB.
  • Proper subset: A⊂BA \subset B means A⊆BA \subseteq B and A≠BA \neq B.
  • Set equality: A=BA = B if and only if A⊆BA \subseteq B and B⊆AB \subseteq A. This is the method to prove two sets are equal.
  • Properties of empty set and self-subset: The empty set ∅\emptyset is a subset of every set. Every set is a subset of itself.
  • Proving subsets: To prove A⊆BA \subseteq B, take any element x∈Ax \in A and show that x∈Bx \in B 2.

2.3 Set operations

Several operations can be performed on sets to create new sets. These operations are often visualized using Venn diagrams, where circles represent sets within a rectangular universal set UU 3.

OperationSymbolMeaning
UnionA ∪ BElements in A or B (or both)
IntersectionA ∩ BElements in A and B
DifferenceA − BElements in A but not in B
ComplementA′Elements in U that are not in A
Symmetric differenceA Δ BElements in exactly one of A or B (A − B) ∪ (B − A)
  • Disjoint sets: Two sets are disjoint if their intersection is the empty set (A∩B=∅A \cap B = \emptyset) 3.

2.4 Counting formula (Inclusion-Exclusion Principle)

The inclusion-exclusion principle is used to count the number of elements in the union of sets, accounting for overlaps 3.

  • For two sets: The formula is ∣A∪B∣=∣A∣+∣B∣−∣A∩B∣|A \cup B| = |A| + |B| - |A \cap B|. The intersection is subtracted because its elements were counted twice (once in ∣A∣|A| and once in ∣B∣|B|).
  • For three sets: The formula extends to ∣A∪B∪C∣=∣A∣+∣B∣+∣C∣−∣A∩B∣−∣A∩C∣−∣B∩C∣+∣A∩B∩C∣|A \cup B \cup C| = |A| + |B| + |C| - |A \cap B| - |A \cap C| - |B \cap C| + |A \cap B \cap C| 3.

📝 Given A={1,2,3,4}A = \{1, 2, 3, 4\} and B={3,4,5}B = \{3, 4, 5\}:

  • A∪B={1,2,3,4,5}A \cup B = \{1, 2, 3, 4, 5\}
  • A∩B={3,4}A \cap B = \{3, 4\}
  • A−B={1,2}A - B = \{1, 2\}
  • B−A={5}B - A = \{5\}
  • AΔB={1,2,5}A \Delta B = \{1, 2, 5\} Using the counting formula: ∣A∪B∣=∣A∣+∣B∣−∣A∩B∣=4+3−2=5|A \cup B| = |A| + |B| - |A \cap B| = 4 + 3 - 2 = 5 3.

3. Algebra of sets and Duality (Álgebra de conjuntos e dualidade)

3.1 Laws of Set Algebra

The algebra of sets follows several fundamental laws that govern operations like union (∪\cup) and intersection (∩\cap). These laws are analogous to those in arithmetic and propositional logic, providing a framework for simplifying set expressions 4.

LawUnion RuleIntersection Rule
IdempotentA ∪ A = AA ∩ A = A
CommutativeA ∪ B = B ∪ AA ∩ B = B ∩ A
Associative(A ∪ B) ∪ C = A ∪ (B ∪ C)(A ∩ B) ∩ C = A ∩ (B ∩ C)
DistributiveA ∪ (B ∩ C) = (A ∪ B) ∩ (A ∪ C)A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C)
IdentityA ∪ ∅ = AA ∩ U = A
DominationA ∪ U = UA ∩ ∅ = ∅
ComplementA ∪ A′ = UA ∩ A′ = ∅
Double complement—(A′)′ = A
AbsorptionA ∪ (A ∩ B) = AA ∩ (A ∪ B) = A

3.2 De Morgan's Laws

De Morgan's laws describe how the complement operation interacts with union and intersection. They state that the complement of a union is the intersection of the complements, and the complement of an intersection is the union of the complements.

Essentially, the complement operation flips the union and intersection operators 4.

  • De Morgan's Laws:
  • (A∪B)′=A′∩B′(A \cup B)' = A' \cap B'
  • (A∩B)′=A′∪B′(A \cap B)' = A' \cup B'
  • In plain terms, "NOT (A or B)" is equivalent to "NOT A and NOT B" 4.

📝 If set A represents students who like tea and set B represents students who like coffee, then (A∪B)′(A \cup B)' represents students who like neither tea nor coffee. According to De Morgan's law, this is equal to A′∩B′A' \cap B', which means students who do not like tea AND do not like coffee 4.

4. Finite / infinite sets, power sets, multisets

4.1 Finite and infinite sets

A finite set is one whose elements can be counted, and the counting process finishes. An infinite set is one where counting the elements never ends.

Sets of natural numbers (N\mathbb{N}), integers (Z\mathbb{Z}), and real numbers (R\mathbb{R}) are infinite.

A countably infinite set is an infinite set whose elements can be listed in a sequence, such as the first, second, third, and so on. Examples include N\mathbb{N}, Z\mathbb{Z}, and the set of rational numbers (Q\mathbb{Q}).

The set of real numbers (R\mathbb{R}) is uncountable, meaning its elements cannot be listed in such a sequence 5.

4.2 Power sets

The power set of a set AA, denoted as P(A)P(A), is the set containing all possible subsets of AA. This includes the empty set (∅\emptyset) and the set AA itself 5.

If a set AA has nn elements, its power set P(A)P(A) will have 2n2^n subsets. This is because for each element in AA, there are two possibilities: it is either included in a subset or it is not 5.

📝 If A={a,b}A = \{a, b\}, then P(A)={∅,{a},{b},{a,b}}P(A) = \{\emptyset, \{a\}, \{b\}, \{a, b\}\}. The number of elements in AA is 2, so the number of subsets in P(A)P(A) is 22=42^2 = 4 5.

4.3 Multisets

A multiset is a generalization of a set that allows for the repetition of elements. The number of times an element appears in a multiset is called its multiplicity 5.

📝 The multiset {a,a,b}\{a, a, b\} contains the element aa with a multiplicity of 2 and the element bb with a multiplicity of 1 5.

5. Cartesian product (Produto cartesiano)

5.1 Set operations 6

The following table outlines basic set operations and their rules, using multisets A = {a,a,b} and B = {a,b,b,c} as examples.

OperationRuleExample with A={a,a,b}, B={a,b,b,c}
UnionTake the maximum multiplicity{a,a,b,b,c}
IntersectionTake the minimum multiplicity{a,b}
SumAdd multiplicities{a,a,a,b,b,b,c}
DifferenceSubtract multiplicities (never below 0)A - B = {a}

5.2 Cartesian product definition

The Cartesian product of two sets, A and B, forms all possible ordered pairs where the first element comes from set A and the second element comes from set B. This is analogous to pairing every item of clothing with every pair of pants.

  • Definition: The Cartesian product A×BA \times B is the set of all ordered pairs (a,b)(a, b) such that aa is an element of AA and bb is an element of BB.
  • Order matters: The order of elements in a pair is significant, meaning (1,2)(1, 2) is distinct from (2,1)(2, 1).
  • Cardinality: The number of elements in the Cartesian product is the product of the number of elements in each set: ∣A×B∣=∣A∣⋅∣B∣|A \times B| = |A| \cdot |B|.
  • Non-commutativity: In general, A×BA \times B is not equal to B×AB \times A, unless AA and BB are identical or one of them is an empty set.
  • Empty set property: The Cartesian product of any set with an empty set is an empty set: A×∅=∅A \times \emptyset = \emptyset.

📝 If A={1,2}A = \{1, 2\} and B={x,y}B = \{x, y\}, then A×B={(1,x),(1,y),(2,x),(2,y)}A \times B = \{(1, x), (1, y), (2, x), (2, y)\}. The size of this product is ∣A×B∣=2⋅2=4|A \times B| = 2 \cdot 2 = 4 6.

6. Relations and their types (Relações)

6.1 Relations

A relation R from set A to set B is defined as any subset of the Cartesian product A×BA \times B. This means R consists of ordered pairs (a,b)(a, b), where a∈Aa \in A and b∈Bb \in B.

The notation aRba R b is used to indicate that the ordered pair (a,b)(a, b) is an element of the relation R. The domain of a relation consists of all the first elements of the ordered pairs in R, while the range (or image) consists of all the second elements. A relation on a set A is a subset of A×AA \times A.

The total number of possible relations from a set A to a set B is 2(∣A∣⋅∣B∣)2^{(|A| \cdot |B|)}. The inverse of a relation R, denoted R−1R^{-1}, is the set of all ordered pairs (b,a)(b, a) such that (a,b)∈R(a, b) \in R.

The composition of two relations, S∘RS \circ R, is the set of all ordered pairs (a,c)(a, c) for which there exists an element bb such that (a,b)∈R(a, b) \in R and (b,c)∈S(b, c) \in S 7.

6.2 Types of relations on a set A 7 8

Relations on a set A can be classified based on several properties:

TypeRulePlain words
Reflexive(a,a) ∈ R for every aEveryone points to themselves
Irreflexive(a,a) ∉ R for every aNobody points to themselves
Symmetric(a,b) ∈ R ⇒ (b,a) ∈ REvery arrow has a return arrow
Antisymmetric(a,b) ∈ R and (b,a) ∈ R ⇒ a = bTwo-way arrows only between a thing and itself
Asymmetric(a,b) ∈ R ⇒ (b,a) ∉ RNo return arrows at all
Transitive(a,b), (b,c) ∈ R ⇒ (a,c) ∈ RShortcut arrow for every 2-step path

6.3 Examples of relation properties 8

The following table illustrates the properties of common relations:

RelationReflexiveSymmetricAntisym.Transitive
= on integers✔✔✔✔
≤ on integers✔✘✔✔
< on integers✘✘✔✔
"is a friend of"✘✔✘usually ✘
"divides" on positive integers✔✘✔✔
"is parent of"✘✘✔✘

Important Note: Symmetric and antisymmetric properties are not opposites. A relation can be both symmetric and antisymmetric (like the equality relation "=") or neither 9.

6.4 Representations of relations

Relations can be represented in several ways:

  • Set of pairs: Listing all the ordered pairs that belong to the relation. For example, R={(1,1),(1,2),(2,1)}R = \{(1,1), (1,2), (2,1)\}.
  • Matrix: A matrix where rows and columns correspond to the elements of the set. An entry is 1 if aRba R b and 0 otherwise.
  • Digraph (directed graph): Elements are represented as dots, and an arrow from aa to bb signifies that aRba R b. A loop on a dot represents a reflexive relation (a,a)(a,a) 9.

6.5 Reading relation matrices

Key properties can be quickly identified from a relation's matrix:

  • Reflexive: The main diagonal (from top-left to bottom-right) consists entirely of 1s.
  • Irreflexive: The main diagonal consists entirely of 0s.
  • Symmetric: The matrix is equal to its transpose (mirror image across the main diagonal).
  • Antisymmetric: For any two off-diagonal positions (i,j)(i, j) and (j,i)(j, i) where i≠ji \neq j, if one entry is 1, the other must be 0 9.

📝 To determine if a relation R is transitive, you must check if for every pair of pairs (a,b)∈R(a,b) \in R and (b,c)∈R(b,c) \in R, the pair (a,c)(a,c) is also in R. For instance, if R={(1,2),(2,3),(1,3)}R = \{(1,2), (2,3), (1,3)\}, it is transitive because the pairs (1,2)(1,2) and (2,3)(2,3) are in R, and (1,3)(1,3) is also in R. If R={(1,2),(2,3)}R = \{(1,2), (2,3)\}, it would not be transitive because (1,3)(1,3) is missing 8.

7. Partial order, Hasse diagram, lattice (course-plan L9)

7.1 Equivalence relations

An equivalence relation on a set is a relation that is reflexive, symmetric, and transitive (RST). These three properties ensure that the relation behaves like equality in many respects 10.

  • Reflexive: For every element aa in the set, aa is related to itself (aRaa R a).
  • Symmetric: If element aa is related to element bb, then element bb is also related to element aa (aRb  ⟹  bRaa R b \implies b R a).
  • Transitive: If element aa is related to element bb, and element bb is related to element cc, then element aa is also related to element cc (aRb and bRc  ⟹  aRca R b \text{ and } b R c \implies a R c) 10.

The equivalence class of an element aa, denoted as [a][a], is the set of all elements xx in the set such that xx is related to aa ([a]={x:xRa}[a] = \{x: x R a\}). These equivalence classes form a partition of the set, which is a division of the set into non-empty, non-overlapping subsets that together cover the entire set 10.

📝 Consider the set of integers Z\mathbb{Z} and the relation aRba R b if a−ba - b is divisible by 3 (congruence modulo 3).

  • This relation is reflexive because a−a=0a - a = 0, which is divisible by 3.
  • It is symmetric because if a−ba - b is divisible by 3, then b−a=−(a−b)b - a = -(a - b) is also divisible by 3.
  • It is transitive because if a−ba - b and b−cb - c are divisible by 3, then their sum (a−b)+(b−c)=a−c(a - b) + (b - c) = a - c is also divisible by 3. The equivalence classes are:
  • [0]={…,−6,−3,0,3,6,… }[0] = \{\dots, -6, -3, 0, 3, 6, \dots\}
  • [1]={…,−5,−2,1,4,7,… }[1] = \{\dots, -5, -2, 1, 4, 7, \dots\}
  • [2]={…,−4,−1,2,5,8,… }[2] = \{\dots, -4, -1, 2, 5, 8, \dots\} These three classes partition the set of integers Z\mathbb{Z} 10.

7.2 Partial order

A partial order on a set is a relation that is reflexive, antisymmetric, and transitive. A set equipped with a partial order is called a partially ordered set (poset) 10.

  • Antisymmetric: If aa is related to bb and bb is related to aa, then aa must be equal to bb (aRb and bRa  ⟹  a=ba R b \text{ and } b R a \implies a = b) 10.

An example of a partial order is the "less than or equal to" relation (≤\leq) on the set of integers 10.

PropertyDefinition
Reflexivea≤aa \leq a
AntisymmetricIf a≤ba \leq b and b≤ab \leq a, then a=ba = b
TransitiveIf a≤ba \leq b and b≤cb \leq c, then a≤ca \leq c

8. Applications: databases and SQL

8.1 Databases and relations

A database table is structured as a relation, which is essentially a subset of the Cartesian product of its column domains. Each row within this table represents a tuple 11.

8.2 SQL set operations

SQL provides commands that directly correspond to set operations on rowsets:

  • UNION: Corresponds to the set union (∪\cup) operation.
  • INTERSECT: Corresponds to the set intersection (∩\cap) operation.
  • EXCEPT: Corresponds to the set difference (−-) operation 11.

9. Unit 2 — Propositional Calculus

9.1 Propositions

A proposition is a declarative sentence that is definitively either true or false, but not both. Propositions are the fundamental building blocks of propositional calculus 12.

  • Atomic propositions are simple statements that cannot be broken down further.
  • Compound propositions are formed by combining atomic propositions using logical connectives 12.

Propositions are typically represented by letters such as pp, qq, and rr. Their truthfulness is indicated by truth values: T for true and F for false 12.

📝

  • "The Earth revolves around the Sun" is a proposition (True).
  • "What is your name?" is not a proposition (it's a question).
  • "2 + 2 = 5" is a proposition (False).
  • "Please pass the salt" is not a proposition (it's a command).
  • "x + 3 = 7" is not a proposition because its truth value depends on the value of xx 12.

10. Basic operations / connectives (Conectivos lógicos)

10.1 Logical connectives

Logical connectives are symbols used to combine simple propositions into more complex statements. The truth value of a compound proposition depends on the truth values of its components and the specific connective used.

Understanding these connectives is fundamental to propositional logic 13.

NameSymbolRead asTrue when…
NOT (negation)¬pnot pp is false
AND (conjunction)p ∧ qp and qboth true
OR (disjunction)p ∨ qp or qat least one true (inclusive)
XORp ⊕ qp or q, not bothexactly one true
Implication (conditional)p → qif p then qnot (p true and q false)
Biconditional (biconditional)p ↔ qp iff qp and q have the same value

10.2 Truth table for logical connectives

A truth table systematically lists all possible combinations of truth values for the propositions involved and the resulting truth value of the compound proposition. This allows for a clear and unambiguous determination of the logical behavior of each connective 13.

  • p: q, ¬p, p∧q, p∨q, p⊕q, p→q, p↔q
  • T: T, F, T, T, F, T, T
  • T: F, F, F, T, T, F, F
  • F: T, T, F, T, T, T, F
  • F: F, T, F, F, F, T, T 13.

11. Truth values of compound statements

11.1 Compound statement truth tables

A compound statement is formed by combining simpler statements using logical connectives. The truth value of a compound statement depends on the truth values of its component statements and the specific connective used.

When dealing with nn distinct propositional variables, a truth table will have 2n2^n rows to cover all possible combinations of truth values. The order of operations for logical connectives is: negation (¬\neg) first, then conjunction (∧\land), disjunction (∨\lor), implication (→\to), and finally biconditional (↔\leftrightarrow).

Brackets can be used to clarify the order when necessary 14.

  • p: q, ¬p, p∧q, p∨q, p⊕q, p→q, p↔q
  • F: F, T, F, F, F, T, T
  • F: T, T, F, T, T, T, F
  • T: F, F, F, T, T, T, F
  • T: T, F, T, T, F, T, T 14.

11.2 Understanding implication (p → q)

The implication p→qp \to q is often the most confusing logical connective. It can be understood as a promise: "If pp is true, then qq will be true."

The only case where this promise is broken (i.e., the implication is false) is when pp is true and qq is false. In all other scenarios, the promise is considered kept (true) 14.

  • True antecedent, true consequent (pp is T, qq is T): The promise is kept. The implication is true.
  • True antecedent, false consequent (pp is T, qq is F): The promise is broken. The implication is false. This is the sole condition for p→qp \to q to be false.
  • False antecedent, true consequent (pp is F, qq is T): The promise was not broken because the condition (pp) was not met. The implication is true.
  • False antecedent, false consequent (pp is F, qq is F): The promise was not broken because the condition (pp) was not met. The implication is true 14.

📝 Consider the statement, "If you pass the exam, I will buy you ice cream."

  • If you pass (T) and I buy ice cream (T), the promise is kept (T).
  • If you pass (T) and I do not buy ice cream (F), the promise is broken (F).
  • If you fail (F) and I buy ice cream (T), the promise is not broken (T).
  • If you fail (F) and I do not buy ice cream (F), the promise is not broken (T) 14.

11.3 Related statements to implication 14

Several statements are related to the implication p→qp \to q, each having its own truth conditions 14.

  • Converse (q→pq \to p): This statement reverses the antecedent and consequent of the original implication. It is not necessarily equivalent to the original implication.
  • Inverse (¬p→¬q\neg p \to \neg q): This statement negates both the antecedent and the consequent of the original implication. It is equivalent to the converse.
  • Contrapositive (¬q→¬p\neg q \to \neg p): This statement negates both the antecedent and the consequent and then reverses them. The contrapositive is always logically equivalent to the original implication p→qp \to q 14.
StatementFormEquivalence to p → q
Originalp → q—
Converseq → pNot necessarily equivalent
Inverse¬p → ¬qEquivalent to Converse, not Original
Contrapositive¬q → ¬pAlways equivalent

12. Tautology, contradiction, equivalence

12.1 Truth tables

Truth tables are used to determine the truth value of a compound proposition for all possible truth values of its atomic propositions. The table is constructed by listing all possible combinations of truth values for the atomic propositions and then evaluating the compound proposition for each combination.

The final column of the truth table shows the truth value of the entire compound proposition for each case 15.

For example, to evaluate (p∨q)∧¬p(p \lor q) \land \neg p:

  • First, list the truth values for pp and qq.
  • Then, determine the truth value of p∨qp \lor q.
  • Next, determine the truth value of ¬p\neg p.
  • Finally, combine the results of p∨qp \lor q and ¬p\neg p using the conjunction (∧\land) operator.

The resulting truth column for (p∨q)∧¬p(p \lor q) \land \neg p is F,F,T,FF, F, T, F. This is equivalent to ¬p∧q\neg p \land q 15.

12.2 Types of propositions

Propositions can be classified based on their truth values across all possible assignments of truth values to their atomic components 15.

TypeDefinition
TautologyA proposition that is always true, regardless of the truth values of its atomic propositions. Example: p∨¬pp \lor \neg p.
ContradictionA proposition that is always false, regardless of the truth values of its atomic propositions. Example: p∧¬pp \land \neg p.
ContingencyA proposition that is sometimes true and sometimes false, depending on the truth values of its atomic propositions.

12.3 Logical equivalence

Two propositions PP and QQ are logically equivalent, denoted as P≡QP \equiv Q, if they have the same truth column in a truth table. Equivalently, their biconditional P↔QP \leftrightarrow Q is a tautology 15.

12.4 Logical laws

Several laws govern logical operations, analogous to set theory laws. These laws can be used to simplify logical expressions and prove equivalences algebraically 16.

LawRule
Double negation¬¬p≡p\neg\neg p \equiv p
Idempotentp∧p≡pp \land p \equiv p; p∨p≡pp \lor p \equiv p
Commutative / AssociativeSame as in sets
Distributivep∧(q∨r)≡(p∧q)∨(p∧r)p \land (q \lor r) \equiv (p \land q) \lor (p \land r); p∨(q∧r)≡(p∨q)∧(p∨r)p \lor (q \land r) \equiv (p \lor q) \land (p \lor r)
Identityp∧T≡pp \land T \equiv p; p∨F≡pp \lor F \equiv p
Dominationp∨T≡Tp \lor T \equiv T; p∧F≡Fp \land F \equiv F
Negationp∨¬p≡Tp \lor \neg p \equiv T; p∧¬p≡Fp \land \neg p \equiv F
De Morgan¬(p∧q)≡¬p∨¬q\neg(p \land q) \equiv \neg p \lor \neg q; ¬(p∨q)≡¬p∧¬q\neg(p \lor q) \equiv \neg p \land \neg q
Absorptionp∨(p∧q)≡pp \lor (p \land q) \equiv p; p∧(p∨q)≡pp \land (p \lor q) \equiv p

12.5 Laws for implication and biconditional

Additional laws are specific to implication (→\rightarrow) and biconditional (↔\leftrightarrow) operators, which are often used in logical reasoning 16.

LawRule
Implicationp→q≡¬p∨qp \rightarrow q \equiv \neg p \lor q
Contrapositivep→q≡¬q→¬pp \rightarrow q \equiv \neg q \rightarrow \neg p
Biconditionalp↔q≡(p→q)∧(q→p)p \leftrightarrow q \equiv (p \rightarrow q) \land (q \rightarrow p)
Negation of implication¬(p→q)≡p∧¬q\neg(p \rightarrow q) \equiv p \land \neg q

12.6 Proving equivalence

Equivalences can be proven using two primary methods: truth tables or algebraic manipulation using the named logical laws. A common first step in algebraic proofs is to eliminate implications and biconditionals by using the implication law 16.

📝 To prove p→q≡¬q→¬pp \rightarrow q \equiv \neg q \rightarrow \neg p, we can use the implication law:

p→q≡¬p∨qp \rightarrow q \equiv \neg p \lor q.

Now, consider the right side:

¬q→¬p≡¬(¬q)∨¬p\neg q \rightarrow \neg p \equiv \neg(\neg q) \lor \neg p.

Applying double negation to ¬(¬q)\neg(\neg q) gives qq.

So, ¬q→¬p≡q∨¬p\neg q \rightarrow \neg p \equiv q \lor \neg p.

Since ¬p∨q\neg p \lor q is the same as q∨¬pq \lor \neg p due to the commutative law, the two expressions are logically equivalent 16.

13. Normal forms (Formas normais)

13.1 Vocabulary

  • Literal: A variable or its negation (e.g., pp or ¬p\neg p).
  • Minterm: An AND of literals where each variable appears exactly once. For example, p∧¬qp \land \neg q.
  • Maxterm: An OR of literals where each variable appears exactly once. For example, ¬p∨q\neg p \lor q.
  • DNF (Disjunctive Normal Form): A logical formula expressed as an OR of AND terms (a sum of products).
  • CNF (Conjunctive Normal Form): A logical formula expressed as an AND of OR terms (a product of sums).
  • Principal DNF/CNF: A DNF or CNF where every term includes all variables 17.

13.2 Method 1: Deriving normal forms from a truth table

This method constructs the principal DNF (PDNF) and principal CNF (PCNF) directly from a truth table.

  • PDNF: For each row where the truth table output is True (T), create a minterm. If a variable is True in that row, use the variable itself; if False, use its negation. Join all these minterms with the OR operator (∨\lor).
  • PCNF: For each row where the truth table output is False (F), create a maxterm. If a variable is False in that row, use the variable itself; if True, use its negation. Join all these maxterms with the AND operator (∧\land) 17.

For the implication p→qp \rightarrow q:

  • The truth table has T outputs for rows (T,T), (F,T), and (F,F).
  • This yields the PDNF: (p∧q)∨(¬p∧q)∨(¬p∧¬q)(p \land q) \lor (\neg p \land q) \lor (\neg p \land \neg q).
  • The truth table has an F output for row (T,F).
  • This yields the PCNF: ¬p∨q\neg p \lor q 17.

📝 For the implication p→qp \rightarrow q, the truth table has an F output for row (T,F), yielding the PCNF: ¬p∨q\neg p \lor q 17.

13.3 Method 2: Algebraic manipulation

This method transforms a logical formula into a normal form using algebraic rules.

  1. Eliminate implication (→\rightarrow) and biconditional (↔\leftrightarrow):
  • A→BA \rightarrow B is equivalent to ¬A∨B\neg A \lor B.
  • A↔BA \leftrightarrow B is equivalent to (A→B)∧(B→A)(A \rightarrow B) \land (B \rightarrow A), which further simplifies to (¬A∨B)∧(¬B∨A)(\neg A \lor B) \land (\neg B \lor A) 17.

The process continues with other algebraic rules to achieve DNF or CNF.

14. Quantifiers (Quantificadores)

14.1 Predicates and quantifiers 18

A predicate is a statement with a variable, such as P(x)="x > 3"P(x) = \text{"x > 3"}. This statement becomes a proposition when the variable xx is assigned a specific value or when a quantifier is added.

The domain (or universe) specifies the set of possible values for xx.

Quantifiers are symbols used to indicate the scope of a variable in a predicate.

SymbolNameMeaning
∀xP(x)\forall x P(x)Universal (universal)P(x) is true for every x in the domain
∃xP(x)\exists x P(x)Existential (existencial)P(x) is true for at least one x

A universal statement (∀xP(x)\forall x P(x)) is false if even one counterexample exists. An existential statement (∃xP(x)\exists x P(x)) is true if at least one example can be found 18.

14.2 Negation rules for quantifiers 18

The negation of a universal statement is an existential statement, and vice versa.

Original StatementNegation
∀xP(x)\forall x P(x)∃x¬P(x)\exists x \neg P(x)
∃xP(x)\exists x P(x)∀x¬P(x)\forall x \neg P(x)

15. Applications: Boolean logic and digital circuits

15.1 Boolean logic and digital circuits

Boolean logic uses truth values (True/False) to represent logical statements. In digital circuits, these truth values are mapped to electrical signals: True is represented by 1 (high voltage) and False by 0 (low voltage) 19.

Key logical operations correspond to digital gates:

  • AND gate: Implements the logical conjunction (∧\land), outputting 1 only if all inputs are 1.
  • OR gate: Implements the logical disjunction (∨\lor), outputting 1 if at least one input is 1.
  • NOT gate: Implements logical negation (¬\neg), inverting the input (0 becomes 1, 1 becomes 0) 19.
Logical OperatorDigital GateSymbol
Conjunction (AND)AND gatep \land q
Disjunction (OR)OR gatep \lor q
Negation (NOT)NOT gate\neg p

15.2 Universal gates

NAND (Not-AND) and NOR (Not-OR) gates are considered universal gates because any digital circuit can be constructed using only NAND gates or only NOR gates. This universality simplifies circuit design and manufacturing 19.

15.3 Circuit simplification

Simplifying a digital circuit is equivalent to simplifying its corresponding Boolean logic formula. This is achieved using the laws of Boolean algebra, which allows for the reduction in the number of gates required, leading to more efficient and cost-effective circuits 19.

For example, the expression (p∧q)∨(p∧¬q)(p \land q) \lor (p \land \neg q) can be simplified:

  1. Apply the distributive law: p∧(q∨¬q)p \land (q \lor \neg q)
  2. Apply the negation law (q∨¬qq \lor \neg q is always True, T): p∧Tp \land T
  3. Apply the identity law (p∧Tp \land T is pp): pp This simplification means a complex circuit can be reduced to a single wire 19.

📝 The expression (p∧q)∨(p∧¬q)(p \land q) \lor (p \land \neg q) simplifies to pp, meaning a complex circuit can be reduced to a single wire 19.

15.4 Half adder

A half adder is a digital circuit that performs the addition of two single bits. It produces two outputs: a Sum bit and a Carry bit 19.

  • Sum: The sum bit is 1 if exactly one of the input bits is 1. This corresponds to the XOR operation (p⊕qp \oplus q).
  • Carry: The carry bit is 1 if both input bits are 1. This corresponds to the AND operation (p∧qp \land q) 19.
Input pInput qSum (p ⊕ q)Carry (p ∧ q)
0000
0110
1010
1101

16. Unit 3 — Techniques of Counting

16.1 Basic principles

This section introduces fundamental counting techniques: the sum rule and the product rule, which are essential for solving combinatorial problems. These rules help determine the total number of ways an event can occur based on different scenarios 20.

  • Sum rule: Used when a task can be performed in one of two mutually exclusive ways. If task 1 can be done in mm ways and task 2 can be done in nn ways, and these tasks cannot be performed simultaneously, the total number of ways to perform either task is m+nm + n.
  • Product rule: Applied when a task involves a sequence of steps. If step 1 can be done in mm ways and, for each of those ways, step 2 can be done in nn ways, then the total number of ways to perform the entire task is m×nm \times n. This rule is often referred to as the "AND" rule or "then" rule 20.

The principle of inclusion-exclusion is used when there are overlapping possibilities. For two sets A and B, the total number of elements in their union is given by the formula: ∣A∪B∣=∣A∣+∣B∣−∣A∩B∣|A \cup B| = |A| + |B| - |A \cap B| 20.

  • Factorial: The factorial of a non-negative integer nn, denoted by n!n!, is the product of all positive integers less than or equal to nn. It is defined as n!=n×(n−1)×⋯×2×1n! = n \times (n-1) \times \dots \times 2 \times 1. By definition, 0!=10! = 1. For example, 5!=5×4×3×2×1=1205! = 5 \times 4 \times 3 \times 2 \times 1 = 120 20.

A common strategy for solving counting problems, especially those with restrictions, is to use "slots" or boxes to represent the positions or choices. The number of options for each slot is determined, and then these numbers are multiplied.

It is often beneficial to handle any restricted slots first, such as a slot that must satisfy a specific condition (e.g., a digit in a number must be odd) 20.

📝 If you have 3 different shirts and 2 different pairs of pants, the total number of distinct outfits you can create is 3×2=63 \times 2 = 6 20.

17. Permutations (Permutações — order matters)

17.1 Permutations without repetition

Permutations deal with arrangements where the order of items is significant. For instance, arranging people in a line, where the position of each person matters, is a permutation.

The fundamental principle is that ABC is distinct from CBA 21.

When arranging rr items chosen from a set of nn distinct items without repetition, the formula is P(n,r)=n!(n−r)!P(n, r) = \frac{n!}{(n-r)!}. If all nn items are arranged, the formula simplifies to n!n! 21.

📝 If there are 5 runners in a race and we want to determine the number of ways to award gold, silver, and bronze medals, we use permutations. This is calculated as P(5,3)=5!(5−3)!=5!2!=5×4×3=60P(5, 3) = \frac{5!}{(5-3)!} = \frac{5!}{2!} = 5 \times 4 \times 3 = 60 possible outcomes 21.

📝 The number of distinct ways to arrange the letters in the word MATH is 4!=244! = 24 21.

17.2 Permutations with repetition 21

Permutations with repetition involve scenarios where items can be reused or where some items in the set are identical.

There are two main cases for permutations with repetition:

CaseDescriptionFormulaExample
Items can be reusedChoosing rr items from nn options, with replacementnrn^rA 4-digit PIN can be formed in 104=10,00010^4 = 10,000 ways
Arranging objects with identical itemsArranging nn objects where n1n_1 are identical of type 1, n2n_2 of type 2,..., nkn_k of type kn!n1!⋅n2!⋅…⋅nk!\frac{n!}{n_1! \cdot n_2! \cdot \ldots \cdot n_k!}Arranging the letters in BANANA: 6!3!⋅2!⋅1!=72012=60\frac{6!}{3! \cdot 2! \cdot 1!} = \frac{720}{12} = 60 ways

A common exam strategy is to first determine if items can be reused. If reuse is allowed, the formula nrn^r applies.

If identical objects exist within the set being arranged, the formula involves dividing by the factorials of the counts of these identical objects 21.

(Bonus: The number of ways to arrange nn people in a circle is (n−1)!(n-1)!.) 21.

18. The Pigeonhole Principle (Princípio da Casa dos Pombos)

18.1 The Pigeonhole Principle

The Pigeonhole Principle is a mathematical concept used to prove that certain conditions must exist when a set of objects is distributed into a smaller set of categories. It's based on the intuitive idea that if you have more items than containers, at least one container must hold more than one item 22.

The principle has two main forms 22:

  • Basic form: If n+1n + 1 objects are placed into nn boxes, then at least one box must contain at least 2 objects.
  • Generalized form: If NN objects are placed into kk boxes, then at least one box must contain at least ⌈N/k⌉\lceil N / k \rceil objects. The ceiling function, denoted by ⌈x⌉\lceil x \rceil, rounds xx up to the nearest integer 22.

The core strategy for applying the Pigeonhole Principle involves identifying which elements represent the "objects" (pigeons) and which represent the "categories" or "boxes" (holes). Proofs typically state the categories and then assert that since the number of objects exceeds the number of categories, the principle guarantees the desired outcome 22.

📝 If there are 13 people, at least two must share the same birth month, because there are only 12 months 22.

18.2 Guarantee Questions

The Pigeonhole Principle is particularly useful for "guarantee" questions, which ask for the minimum number of objects needed to ensure a specific outcome. This often involves thinking about the worst-case scenario 22.

To guarantee that at least m+1m + 1 objects are in one box when distributing objects into kk boxes, you need to have a total of k⋅m+1k \cdot m + 1 objects. This ensures that even if you distribute the objects as evenly as possible, the (k⋅m+1)(k \cdot m + 1)-th object will force one box to have m+1m + 1 items 22.

📝 To guarantee having at least 3 socks of the same color, given there are 4 possible colors, you need to take 4⋅2+1=94 \cdot 2 + 1 = 9 socks. This is because in the worst case, you could pick 2 socks of each of the 4 colors (total 8 socks), and the 9th sock must then complete a set of 3 22.

19. Combinations (Combinações — order does NOT matter)

19.1 Definition and formula

Combinations refer to the number of ways to choose a subset of items from a larger set where the order of selection does not matter. This is analogous to picking a team, where the same group of individuals constitutes the same team regardless of the order in which they were selected 23.

The formula for combinations is given by C(n,r)=n!r!(n−r)!C(n, r) = \frac{n!}{r!(n-r)!}, where nn is the total number of items to choose from, and rr is the number of items to choose. This is also denoted as nCr^nC_r or "n choose r" 23.

Combinations are related to permutations by the formula P(n,r)=r!⋅C(n,r)P(n,r) = r! \cdot C(n,r), indicating that permutations involve choosing items first and then arranging them 23.

19.2 Properties of combinations 23

PropertyMeaning
C(n,0)=C(n,n)=1C(n,0) = C(n,n) = 1There is one way to choose nothing or to choose everything from a set.
C(n,1)=nC(n,1) = nThere are nn ways to choose one item from a set of nn items.
C(n,r)=C(n,n−r)C(n,r) = C(n, n-r)Choosing rr items to include is the same as choosing n−rn-r items to exclude.
Pascal's Identity: C(n,r)=C(n−1,r−1)+C(n−1,r)C(n,r) = C(n-1,r-1) + C(n-1,r)This identity relates combinations to the previous row in Pascal's triangle, often interpreted as choosing a specific item or not.
∑r=0nC(n,r)=2n\sum_{r=0}^{n} C(n,r) = 2^nThe sum of all combinations for a given nn equals the total number of subsets, linking to the power set.

19.3 Examples

To choose 3 students from a group of 5, the number of combinations is calculated as C(5,3)=5!3!(5−3)!=5×4×33×2×1=10C(5,3) = \frac{5!}{3!(5-3)!} = \frac{5 \times 4 \times 3}{3 \times 2 \times 1} = 10 23.

For a scenario involving handshakes among 6 people, where each handshake involves 2 people, the number of combinations is C(6,2)=6!2!(6−2)!=6×52×1=15C(6,2) = \frac{6!}{2!(6-2)!} = \frac{6 \times 5}{2 \times 1} = 15 23.

📝 Choosing 3 students from 5. The calculation C(5,3)=5!3!(5−3)!=10C(5,3) = \frac{5!}{3!(5-3)!} = 10 shows there are 10 distinct groups of 3 students that can be formed from a set of 5 23.

20. Decision table — which formula?

20.1 Choosing the right formula 24

This section provides a decision table to help determine the correct formula for counting problems based on whether order matters and if repetition is allowed 24.

Does order matter?Repetition allowed?Formula
Yes (permutation)NoP(n,r) = n!/(n−r)!
Yes (permutation)Yesnʳ
No (combination)NoC(n,r)
No (combination)YesC(n+r−1, r)

20.2 Combinations with repetition example

Combinations with repetition are used when choosing items from different types, and repeats are permitted. For instance, selecting 3 ice-cream scoops from 5 available flavors, where flavors can be chosen multiple times, is calculated using this method 24.

📝 Choosing 3 ice-cream scoops from 5 flavors, with repetition allowed, uses the formula C(n+r−1,r)C(n+r-1, r). With n=5n=5 flavors and r=3r=3 scoops, this becomes C(5+3−1,3)=C(7,3)C(5+3-1, 3) = C(7,3). Calculating the combinations: C(7,3)=7!3!(7−3)!=7!3!4!=7×6×53×2×1=35C(7,3) = \frac{7!}{3!(7-3)!} = \frac{7!}{3!4!} = \frac{7 \times 6 \times 5}{3 \times 2 \times 1} = 35. There are 35 different ways to choose the scoops 24.

20.3 Combining rules for selections

When combining different selection criteria, such as forming a committee, the "AND" rule implies multiplication of the individual combination counts. For example, if a committee requires selecting 2 men from 5 and 3 women from 4, the total number of ways to form the committee is the product of the ways to select men and the ways to select women 24.

📝 To form a committee with 2 men from 5 and 3 women from 4, we multiply the number of ways to choose the men by the number of ways to choose the women. The number of ways to choose 2 men from 5 is C(5,2)=5!2!3!=10C(5,2) = \frac{5!}{2!3!} = 10. The number of ways to choose 3 women from 4 is C(4,3)=4!3!1!=4C(4,3) = \frac{4!}{3!1!} = 4. Therefore, the total number of ways to form the committee is 10×4=4010 \times 4 = 40 24.

21. Quick exam checklist (Units 1–3)

21.1 Proving sets and relations

  • Set equality: To prove two sets, A and B, are equal, demonstrate that A is a subset of B and B is a subset of A. Alternatively, use algebraic manipulation, citing the names of the logical laws applied.
  • Relation properties: To disprove a property of a relation (reflexive, symmetric, transitive), provide a single counterexample. To prove a property holds, construct a general argument that applies to all elements.
  • Equivalence relations: An equivalence relation is reflexive, symmetric, and transitive. It partitions a set into disjoint equivalence classes.
  • Partial orders: A partial order is reflexive, antisymmetric, and transitive. Hasse diagrams are used to visualize partial orders by removing loops and shortcuts 25.

21.2 Logical structures and truth tables

  • Truth tables: For propositional logic, truth tables have 2n2^n rows, where nn is the number of propositional variables. The only case where an implication p→qp \rightarrow q is false is when pp is true and qq is false.
  • Logical equivalences: First, eliminate implications using the equivalence p→q≡¬p∨qp \rightarrow q \equiv \neg p \vee q. De Morgan's laws can be used to distribute negations over conjunctions and disjunctions.
  • Normal forms:
  • PDNF (Principal Disjunctive Normal Form): Derived from the rows where the formula is true.
  • PCNF (Principal Conjunctive Normal Form): Derived from the rows where the formula is false.
  • Quantifiers:
  • Universal quantifier (∀\forall) is typically used with implication (→\rightarrow).
  • Existential quantifier (∃\exists) is typically used with conjunction (∧\wedge).
  • Negating a quantified statement flips the quantifier (e.g., ¬∀xP(x)≡∃x¬P(x)\neg \forall x P(x) \equiv \exists x \neg P(x)) 25.

📝 The only case where an implication p→qp \rightarrow q is false is when pp is true and qq is false 25.

21.3 Counting techniques

  • Basic counting principles:
  • AND (multiplication): Use when events occur in sequence or when choices are made for multiple independent categories.
  • OR (addition): Use when events are mutually exclusive and you are choosing one option from several possibilities.
  • Permutations and Combinations:
  • Permutation: Used when the order of selection matters.
  • Combination: Used when the order of selection does not matter.
  • Pigeonhole Principle: If NN items are put into kk containers, with N>kN > k, then at least one container must contain more than one item. The generalized form states that at least one container must contain at least ⌈N/k⌉\lceil N/k \rceil items. Identify the "pigeons" (items) and "holes" (containers) in the problem 25.
ConceptKey Strategy
Proving set equalityTwo inclusions or algebraic manipulation with law names
Disproving relation propertiesOne counterexample
Proving relation propertiesGeneral argument
Equivalence relationReflexive, Symmetric, Transitive; forms partition
Partial orderReflexive, Antisymmetric, Transitive; draw Hasse diagram
Truth table implication T → FThis is the only false case
Logical equivalence p → qEquivalent to ¬p ∨ q
De Morgan's lawsFlip ∧/∨ when negating
PDNFFrom True rows
PCNFFrom False rows
Quantifier ∀ withImplication (→)
Quantifier ∃ withConjunction (∧)
Negating quantifiersFlip quantifier and negate predicate
Counting ANDMultiply
Counting ORAdd
Counting order mattersPermutation
Counting order doesn't matterCombination
Pigeonhole PrincipleIdentify pigeons and holes; use ⌈N/k⌉

© 2026 Maeve. All rights reserved. This content is protected by copyright.

See also