math
1. Boolean algebra and logic gates (part 1)
This section introduces the foundational concepts of Boolean algebra, including its basic operations, the construction of Boolean expressions and functions, and their direct correspondence to logical operators and truth values.
1.1 Introduction to Boolean algebra
Boolean algebra is a mathematical system that deals with operations on a set of two values, typically represented as {0, 1}. It forms the bedrock for digital logic design and computer science, providing rules for manipulating logical statements. The three primary operations in Boolean algebra are complementation, Boolean sum, and Boolean product 3.
1.1.1 Boolean operations
-
Complementation: Denoted by a bar over the variable (e.g., Aˉ), it inverts the value of an element. Specifically, 0ˉ=1 and 1ˉ=0.
-
Boolean sum: Also known as the OR operation, denoted by
+orOR. Its truth table is as follows:- 1+1=1
- 1+0=1
- 0+1=1
- 0+0=0 4.
-
Boolean product: Also known as the AND operation, denoted by
.orAND. Its rules are:- 1⋅1=1
- 1⋅0=0
- 0⋅1=0
- 0⋅0=0 5.
Example: Evaluate 1⋅0+0+1. Using the definitions of the operations: 1⋅0+0+1=0+0+1=0+1=1 6.
1.1.2 Logical equivalence
The Boolean operations directly correspond to logical operators:
- Complementation (Aˉ) corresponds to logical negation (¬A).
- Boolean sum (A+B) corresponds to logical OR (A∨B).
- Boolean product (A⋅B) corresponds to logical AND (A∧B).
In this correspondence, 0 represents FALSE (F) and 1 represents TRUE (T).
Example: Translate 1⋅0+0+1=1 into a logical equivalence. This translates to (T∧F)∨(F∨T)≡T, which simplifies to F∨T≡T, and finally T≡T 7.
1.2 Boolean expressions and Boolean functions
A Boolean expression is a logical statement composed of Boolean values (TRUE/FALSE) and logical connectives. A Boolean function is represented by a Boolean expression and produces a Boolean value as its output 8.
1.2.1 Comparison operators
In programming contexts, Boolean values are often produced by comparison operators that evaluate the relationship between two operands. Common comparison operators include:
- x==y: x is equal to y
- x!=y: x is not equal to y
- x<y: x is less than y
- x>y: x is greater than y
- x<=y: x is less than or equal to y
- x>=y: x is greater than or equal to y 10.
1.2.2 Logical operators
Logical operators are used to combine or modify Boolean variables and expressions:
!: Logical negation (NOT)&&: Logical AND||: Logical OR 11.
Example: Evaluate the Boolean expression p∧q∨r, given p=TRUE, q=FALSE, r=FALSE. T∧F∨F F∨F F 12.
Example: Evaluate the Boolean expression !q∨p∧r, given p=TRUE, q=FALSE, r=FALSE. !FALSE∨TRUE∧FALSE TRUE∨FALSE TRUE 13.
Example: Evaluate −j>k∨k==1∧k>3, given j=12, k=15. −12>15∨15==1∧15>3 FALSE∨FALSE∧TRUE FALSE∨FALSE FALSE 14.
1.2.3 Boolean functions and truth tables
A Boolean function can be represented by a Boolean expression, and its behavior can be illustrated using a truth table. A truth table systematically lists all possible input combinations for the variables in the function and the corresponding output for each combination.
Example: Find the values of the Boolean function F(x,y,z)=xy+z. This involves evaluating the product xy first, then ORing the result with z.
x y z xy xy+z 1 1 1 1 1 1 1 0 1 1 1 0 1 0 0 1 0 0 0 1 0 1 1 0 0 0 1 0 0 1 0 0 1 0 0 0 0 0 0 1
1.3 Boolean expression simplification
Boolean algebra provides identities that can be used to simplify complex Boolean expressions. Simplification is crucial for designing more efficient logic circuits 17.
Example: Simplify C+BC. Using the distributive law A+AB=A: C+BC=C(1+B) (Distributive law) C(1+B)=C (Identity law 1+A=1). C=C (Identity law A⋅1=A). Therefore, C+BC=C 18.
Example: Simplify AB+A(B+C). AB+A(B+C)=AB+AB+AC (Distributive law) AB+AB+AC=AB+AC (Idempotent law A+A=A) AB+AC=A(B+C) (Distributive law) 19.
Example: Try to simplify the Boolean expression F=ABC+A′+AB′C. F=A′+ABC+AB′C F=A′+A(BC+B′C) (Distributive law) F=A′+AC(B+B′) (Distributive law) F=A′+AC (Complement law B+B′=1). F=A′+AC (Identity law A⋅1=A) F=(A′+A)(A′+C) (Distributive law) F=(A′+C) (Complement law A′+A=1) 1. F=A′+C (Identity law A⋅1=A) 20.
2. Boolean algebra and logic gates (part 2)
This section delves into the practical application of Boolean algebra in designing electronic circuits through logic gates, focusing on basic gate types and their combinations.
2.1 Logic gates as circuit elements
Logic gates are the fundamental building blocks of electronic circuits within computers and other devices. These gates are designed and implemented using the principles of Boolean algebra. Each circuit can be constructed by combining these basic gate elements to achieve a desired logical operation or output 21.
2.2 Basic types of logic gates
The foundational logic gates are derived directly from Boolean operations.
-
NOT gate (Inverter): This gate produces an output that is the logical inverse of its input. If the input variable is represented as A, the output is NOT A. This can also be denoted as A′ or A 22.
Example: If the input to a NOT gate is 1 (high), the output will be 0 (low), and vice versa.
-
OR gate: The OR gate is an electronic circuit that outputs a high signal (1) if one or more of its inputs are high. The OR operation is represented by the plus sign (+) 23.
Example: For inputs A and B, the output of an OR gate is A+B. If A=1 or B=1 (or both), the output is 1.
-
AND gate: The AND gate is an electronic circuit that outputs a high signal (1) only if all of its inputs are high. The AND operation is represented by a dot (⋅), such as A⋅B. This dot is often omitted, and the expression is written as AB 24.
Example: For inputs A and B, the output of an AND gate is A⋅B. The output is 1 only if both A=1 and B=1.
2.3 Combinations of gates
More complex logical functions can be realized by combining basic gates (inverters, OR gates, and AND gates). In such combinations, some gates may share inputs, meaning a single input signal can be fed into multiple gates simultaneously. The same circuit can often be represented in different ways, illustrating the flexibility in gate arrangement 25 26.
Note: Constructing circuits from Boolean expressions and deriving Boolean expressions from circuit diagrams are key skills in digital logic design.
2.3.1 Constructing circuits from Boolean expressions
Given a Boolean expression, one can design the corresponding logic circuit. This involves translating the operations (AND, OR, NOT) into their respective gate symbols and connecting them according to the expression's structure.
Example: Construct a circuit for the output C=A⋅B+A. This expression involves an AND operation (A⋅B) and an OR operation with A 27.
Example: Construct a circuit for the output Q=(A⋅B)+C. This circuit would first perform an AND operation on A and B, and then OR the result with C 28.
Example: Construct a circuit for the output Q=(P⋅R)+(R⋅S). This requires two AND operations, the results of which are then combined by an OR gate 29.
2.3.2 Writing Boolean expressions from circuit diagrams
Conversely, given a circuit diagram, one can derive the corresponding Boolean expression that describes the circuit's output. This involves identifying the gates and their connections and systematically building the expression from the inputs to the final output.
Example: For a circuit diagram with inputs A and B feeding into an AND gate, followed by an inverter, the Boolean expression for the output Q would be Q=A⋅B 31.
Example: For a circuit diagram with inputs A and B feeding into an OR gate, and input C feeding into an inverter, with the outputs of these two feeding into an AND gate, the expression for output Y would be Y=(A+B)⋅C 32.
Example: For a circuit diagram where P and Q are OR-ed, and R and S are AND-ed, and the results are then OR-ed, the output Q would be Q=(P+Q)+(R⋅S) 33.
The "DO IT YOURSELF" sections provide exercises for practicing both constructing circuits from expressions and deriving expressions from circuits 34 35.
2.4 Minimization of circuits
The efficiency of a combinational circuit is determined by the number and arrangement of its constituent gates. Minimizing a Boolean function leads to the construction of a circuit that uses the fewest gates and the fewest inputs to those gates. This results in a more streamlined and potentially faster circuit 36.
Tip: Circuit minimization is crucial for reducing manufacturing costs, power consumption, and signal propagation delays in electronic devices. Techniques such as Karnaugh maps or the Quine-McCluskey algorithm are often used for this purpose.
3. Karnaugh maps and circuit minimization
Karnaugh maps (K-maps) provide a visual method for simplifying Boolean expressions and minimizing digital circuits by grouping adjacent terms containing ones.
3.1 Introduction to Karnaugh maps
Karnaugh maps, developed in the 1950s, are a graphical tool specifically designed for the manual simplification of Boolean expressions and the minimization of logic circuits. They are particularly effective for circuits with up to six input variables. The core principle behind K-maps is to rearrange the information from a truth table into a special grid format, which then allows for the visual identification of redundant terms in a Boolean expression. By grouping adjacent cells that represent minterms (product terms) resulting in a '1' output, common factors can be exploited to eliminate unnecessary variables, thereby reducing the complexity of the circuit 37.
- Pictorial Representation: K-maps offer a pictorial method for grouping expressions with common factors, leading to the elimination of unwanted variables. They can be considered a special arrangement of a truth table 38.
- Correspondence with Truth Tables: For a given number of input variables, there is a direct correspondence between the rows of a truth table and the cells within a K-map. Each cell in the map represents a unique combination of input variable values, and its content is derived from the output column of the truth table. The input variable values are typically labeled around the edges of the map.
3.2 Rules for simplification using Karnaugh maps
The simplification process using Karnaugh maps relies on a set of rules for grouping adjacent cells containing '1's. The objective is to create the largest possible groups that adhere to these rules, ensuring that every '1' in the map is covered by at least one group, and that the total number of groups is minimized 41.
Key Rules for Grouping Cells:.
- Adjacent Cells: Groups are formed by combining adjacent cells. Adjacency includes wrapping around the edges of the map (horizontally and vertically).
- Wrap-around: The leftmost cell in a row can be grouped with the rightmost cell, and the top cell in a column can be grouped with the bottom cell 45.
- Group Size: Groups must contain a number of cells that is a power of two (i.e., 1, 2, 4, 8, etc.).
- Largest Possible Groups: Groups should be made as large as possible. This maximizes the simplification achieved.
- Coverage: Every '1' in the K-map must be included in at least one group.
- No Zeros: Groups are formed only around '1's; '0's are not included in groups.
- No Diagonals: Groups cannot be formed diagonally.
- Overlapping: Groups are allowed to overlap. This can be necessary to achieve the largest possible groups and the minimum number of groups.
- Fewest Groups: The final minimized expression should be represented by the fewest possible number of groups 46 47.
Remember: The goal is to cover all '1's with the largest, fewest, and potentially overlapping groups, respecting the power-of-two size and adjacency rules.
3.3 Constructing and interpreting Karnaugh maps
Karnaugh maps are constructed based on the number of input variables. For two variables (A, B), the map is a 2x2 grid. For three variables (A, B, C), it's typically a 2x4 or 4x2 grid, and for four variables (A, B, C, D), it's a 4x4 grid. The arrangement of the labels along the axes is crucial; it follows a Gray code sequence, meaning that only one variable changes between adjacent cells. This ensures that adjacent cells differ by only a single variable, which is fundamental for the simplification rules 39.
- Mapping Truth Table Outputs: The output values ('0' or '1') from the truth table are directly transcribed into the corresponding cells of the K-map 40.
- Deriving Simplified Expressions: After forming the largest possible groups of '1's, each group corresponds to a product term in the minimized sum-of-products (SOP) expression. For each group, identify the variables that remain constant within that group. If a variable is constant at '0', it appears in its complemented form (e.g., Aˉ); if it's constant at '1', it appears in its uncomplemented form (e.g., A). Variables that change within a group are eliminated from that term. The final minimized expression is the sum (OR) of these product terms 50.
Example: Consider a group of four cells in a 3-variable K-map where variable A is always '1', variable B changes from '0' to '1', and variable C is always '0'. The term derived from this group would be ACˉ.
Tip: When forming terms from groups, if a variable is constant across all cells in the group, include it in the term. If a variable changes within the group, it is eliminated from the term.
3.4 Applications and examples
Karnaugh maps are widely used in digital logic design to simplify Boolean functions representing combinational circuits. By minimizing the logic gates required, the overall cost, power consumption, and propagation delay of a circuit can be significantly reduced.
Example Problem: Minimize the Boolean function represented by the following truth table using a K-map 48.
A B C F 0 0 0 0 0 0 1 0 0 1 0 1 0 1 1 0 1 0 0 1 1 0 1 1 1 1 0 1 1 1 1 0 Solution using K-map:
- Construct a 3-variable K-map.
- Place '1's in the cells corresponding to the minterms where F=1 (i.e., for inputs ABC=010,100,101,110).
- Group the adjacent '1's. In this case, two groups can be formed:
- A group of two cells for minterms 100 and 101. In this group, A=1, B=0, and C changes. This group yields the term ABˉ.
- A group of two cells for minterms 010 and 110. In this group, A changes, B=1, and C=0. This group yields the term BCˉ.
Important: The K-map method is especially useful for visualizing simplifications that might be less obvious when manipulating Boolean algebra rules directly. The method becomes more complex with more than four variables.
4. Propositional and predicate logic (part 1)
This section introduces the foundational concepts of logic, starting with propositional logic, defining propositions, logical connectives, and truth tables, before briefly touching upon predicate logic and quantifiers.
4.1 The nature of logic and propositions
Logic, derived from the Greek word "logos," is the study of the principles of correct reasoning. It enables us to differentiate sound reasoning from flawed reasoning by examining the validity of arguments and whether conclusions logically follow from given assumptions 57 58.
A proposition is a declarative sentence that can be definitively assigned a truth value of either true or false, but not both simultaneously. Questions, commands, and statements whose truth depends on variable assignments are not propositions 61 62.
Example:
- "Kedah is the biggest state in Malaysia." is a proposition (its truth value can be determined).
- "2 + 5 = 10" is a proposition (it is false).
- "Wake up!" is not a proposition (it is a command).
- "What time is it?" is not a proposition (it is a question).
- "9 + b = 3" is not a proposition (its truth depends on the value of 'b') 63.
Propositions are commonly represented by variables, such as p, q, and r, analogous to how letters are used for numbers in algebra. For instance, we can define a proposition p as p: 3+2=9 64.
4.2 Compound statements and logical connectives
Compound statements are formed by combining simpler statements (propositions or propositional variables) using logical connectives. These connectives allow us to build more complex logical expressions from basic propositions 65.
4.2.1 Conjunction
The conjunction of two propositions, p and q, is denoted by p∧q and represents the proposition "p and q." The conjunction p∧q is true only when both p and q are true; otherwise, it is false
Example: If p: "It is a sunny day" and q: "It is warm," then the conjunction p∧q is "It is a sunny day and it is warm". If both p and q are true, then p∧q is true 66 67.
4.2.2 Disjunction
The disjunction of two propositions, p and q, is denoted by p∨q and represents the proposition "p or q." The disjunction p∨q is true if at least one of p or q is true; it is false only when both p and q are false
Example: If p: "It is a sunny day" and q: "It is warm," then the disjunction p∨q is "It is a sunny day or it is warm". If both p and q are false, then p∨q is false 68 69.
4.3 Truth tables
Truth tables are used to systematically represent the truth values of compound statements. A truth table is a two-dimensional array that includes columns for each input proposition and a final column for the resulting logical operation. The rows list all possible combinations of truth values for the input propositions and their corresponding outputs 70.
A truth table with n input propositions will have n+1 columns and 2n rows, accounting for all possible truth value assignments 71.
Example: The following truth table illustrates the behavior of the conjunction operator (∧):
p q p∧q T T T T F F F T F F F F 72.
This table clearly shows that the conjunction p∧q is true only when both p and q are true 73.
4.4 Introduction to predicate logic and quantifiers
While propositional logic deals with simple and compound statements as atomic units, predicate logic extends this by considering the internal structure of propositions and introducing quantifiers. Predicate logic allows us to make statements about objects and their properties, and to express generalizations about collections of objects [Not explicitly detailed on pages 54-73, but mentioned as the next step in topic description.
- Predicate: A predicate is a statement about a subject, which becomes a proposition when the subject is specified. For example, "x is an even number" is a predicate; it becomes a proposition when x is assigned a value (e.g., "4 is an even number" is true).
- Quantifiers: These are logical symbols that indicate the extent to which a predicate is true for a range of individuals.
- Universal Quantifier (∀): Used to state that a predicate is true for all elements in a domain (e.g., "For all x, P(x)").
- Existential Quantifier (∃): Used to state that a predicate is true for at least one element in a domain (e.g., "There exists an x such that P(x)").
5. Propositional and predicate logic (part 2)
This section extends the fundamentals of propositional logic by detailing the negation, conditional, and biconditional operators, and exploring their associated logical relationships and truth value computations.
5.1 Logical connectives: negation, conditional, and biconditional
This part of the study guide focuses on three crucial logical connectives that build upon the basic propositions introduced earlier. These connectives allow for the construction of more complex logical statements.
5.1.1 Negation (~p)
The negation of a proposition p, denoted by ~p, is the statement "not p". It asserts the falsehood of p. The truth value of ~p is the opposite of the truth value of p. In English, negation can be phrased as "It is not the case that p" or more directly as "p is false". It is crucial to understand that negation does not involve correcting a statement or stating its opposite in a descriptive sense, but rather denying its truth.
Note: When negating statements involving quantifiers like "all" or "some," the negation reverses the quantifier and negates the predicate. For instance, the negation of "All vehicles have 4 wheels" is "There exists at least one vehicle that does not have 4 wheels." 80.
The truth table for negation is as follows:
| p | ∼p |
|---|---|
| T | F |
| F | T |
5.1.2 Conditional proposition (p → q)
A conditional proposition, also known as an implication, has the form "if p then q" or "p implies q," denoted symbolically as p→q. The first proposition, p, is called the antecedent or hypothesis, and the second proposition, q, is called the consequent or conclusion. This statement asserts that if the condition p is met, then the consequence q will follow.
The truth value of p→q is defined by the following truth table:
| p | q | p→q |
|---|---|---|
| T | T | T |
| T | F | F |
| F | T | T |
| F | F | T |
Example: If p: 2>3 (False) and q: 5<9 (True), then the conditional proposition p→q is True. Conversely, if q is True and p is False, q→p would be False 83.
The order of operations for logical connectives, when not specified by parentheses, places the conditional operator (→) as the last to be evaluated.
Related conditional statements
For a conditional proposition p→q, several related statements can be formed:
- Converse: q→p (If q then p)
- Contrapositive: ∼q→∼p (If not q then not p)
- Inverse: ∼p→∼q (If not p then not q)
Example: For the statement "If it rained last night, then the sidewalk is wet":
Restating propositions as conditionals
Many everyday statements can be rephrased into conditional propositions. The key is to identify the condition (antecedent) and the result (consequent).
Examples:
- "Mary will be a good lecturer if she knows how to teach." → "If Mary knows how to teach, then she will be a good lecturer."
- "When you sing, my ears hurt." → "If you sing, then my ears hurt."
- "A sufficient condition for Maria to visit Singapore is that she goes to the Suria Tower." → "If Maria goes to the Suria Tower, then she visits Singapore." 86 87.
Evaluating complex conditional propositions
When evaluating the truth value of compound propositions involving conditional statements, it's essential to follow the order of operations and substitute the given truth values.
Example: Assume p is True, q is False, and r is True.
- p∧q→r: First, evaluate p∧q. Since p is True and q is False, p∧q is False. Then, False→True is True.
- p→(q→r): First, evaluate q→r. Since q is False and r is True, False→True is True. Then, True→True is True.
- p∧(q→∼r): First, evaluate ∼r. Since r is True, ∼r is False. Then, evaluate q→∼r. Since q is False and ∼r is False, False→False is True. Finally, p∧True. Since p is True, True∧True is True. 84 85.
5.1.3 Biconditional proposition (p q)
A biconditional proposition, also known as a logical equivalence or "if and only if" statement, connects two propositions p and q. It is denoted by p↔q. This statement is true if and only if p and q have the same truth value; that is, both are true, or both are false.
The truth value of p↔q is defined by the following truth table:
| p | q | p↔q |
|---|---|---|
| T | T | T |
| T | F | F |
| F | T | F |
| F | F | T |
Example: The statement "1 < 5 if and only if 2 < 8" can be represented as p↔q, where p is "1 < 5" (True) and q is "2 < 8" (True). Since both p and q are true, p↔q is true 90.
5.2 Constructing truth tables for complex propositions
Truth tables are a systematic way to determine the truth value of a compound proposition for all possible combinations of truth values of its constituent propositions. To construct a truth table for a complex proposition, one typically breaks down the proposition into its simpler components and evaluates them step-by-step.
Example: Construct a truth table for the proposition p∨∼q∧r. This involves propositions p, q, and r. There will be 23=8 possible rows. The intermediate steps would involve evaluating ∼q and then p∨(∼q∧r) or (∼q∧r) depending on the assumed order of operations for ∨ and ∧. If standard precedence rules are followed where ∧ binds tighter than ∨, the expression would be evaluated as p∨(∼q∧r). If parentheses are to be explicitly followed, the construction might vary. Given the example on page 93 is p∨∼q∧r, a typical interpretation would be to evaluate negation first, then conjunction, and finally disjunction 93.
6. Propositional and predicate logic (part 3)
This section delves into the advanced concepts of propositional logic, including tautologies, contradictions, and contingencies, and then introduces the necessity and foundational elements of predicate logic.
6.1 Tautologies, contradictions, and contingencies
Within propositional logic, statements can be categorized based on their truth values across all possible assignments of truth values to their propositional variables.
- Tautology: A proposition that is true for all possible truth value assignments of its propositional variables 98.
- Contradiction: A proposition that is always false, regardless of the truth values of its variables 103.
- Contingency: A proposition that is neither a tautology nor a contradiction; its truth value depends on the truth values of its variables 104.
Truth tables are the primary tool for determining whether a given proposition falls into one of these categories.
Example: To show that ((p→q)∧(q→r))→(p→r) is a tautology, we construct a truth table. Since all possible truth value assignments result in the proposition being true, it is a tautology 100.
| p | q | r | p→q | q→r | p→r | (p→q)∧(q→r) | ((p→q)∧(q→r))→(p→r) |
|---|---|---|---|---|---|---|---|
| T | T | T | T | T | T | T | T |
| T | T | F | T | F | F | F | T |
| T | F | T | F | T | T | F | T |
| T | F | F | F | T | F | F | T |
| F | T | T | T | T | T | T | T |
| F | T | F | T | F | T | F | T |
| F | F | T | T | T | T | T | T |
| F | F | F | T | T | T | T | T |
Note: Not all propositions are tautologies. For instance, the proposition p∧(p∨q)→q is not a tautology because it evaluates to false for certain truth assignments of p and q 99.
6.2 Limitations of propositional logic
While propositional logic is fundamental, it has limitations in representing the full complexity of statements encountered in mathematics and computer science.
- Inability to handle statements with variables: Propositional logic treats statements as atomic propositions. It cannot directly represent assertions like "x is greater than 1" because its truth value depends on the variable x. Such statements are not propositions until x is assigned a specific value.
- Difficulty with generalizations and equivalences: Propositional logic cannot capture logical equivalences that apply across many objects or situations. For example, it cannot express the general equivalence between "Not all birds fly" and "Some birds don't fly" without listing each specific instance as a separate proposition. [109-111]
- Repetitive statements: For statements that must be repeated for many individual objects (e.g., "If John is a PKS graduate, then John has passed Diploma," "If Ann is a PKS graduate, then Ann has passed Diploma," etc.), propositional logic requires a separate proposition for each object. This is inefficient 112.
6.3 Introduction to predicate logic
Predicate logic extends propositional logic by introducing concepts that address its limitations. It provides a more powerful framework for expressing and reasoning about complex statements.
6.3.1 Predicates and variables
Predicate logic introduces predicates, which are properties or relations that can be true or false for specific arguments, and variables that represent these arguments. For example, "x is greater than 1" can be represented as a predicate P(x), where P is the predicate "is greater than 1" and x is the variable 108.
6.3.2 Quantifiers
To make statements with variables universally true or false, or true for at least one instance, quantifiers are used. These allow us to express properties of groups of objects.
- Universal Quantifier (∀): Used to state that a property holds for all members of a group. It is read as "for all" or "for every".
- Example: ∀x(P(x)) means "For all x, P(x) is true.".
- Existential Quantifier (∃): Used to state that a property holds for at least one member of a group. It is read as "there exists" or "for some".
- Example: ∃x(P(x)) means "There exists an x such that P(x) is true.".
These quantifiers enable the representation of statements like "All new cars must be registered" or "Some integers are not even," which are beyond the scope of propositional logic alone 113.
7. Propositional and predicate logic (part 4)
This part of the study guide delves into predicate logic, introducing predicates, propositional functions, domains of discourse, and the crucial concepts of quantifiers (universal and existential).
7.1 Predicates and propositional functions
A predicate is a verb phrase template that describes a property of objects or a relationship among objects represented by variables. When a specific object or set of objects is substituted for the variables, the predicate becomes a proposition, which can be definitively true or false.
- Predicate: A statement with variables that becomes a proposition upon substitution. For instance, "is blue" is a predicate.
- Propositional Function (Predicate Logic Statement): A predicate that takes one or more arguments. It is not a proposition itself because its truth value depends on the values of its variables.
- Example: Let P(x) represent the statement "x is a prime number." P(x) is a propositional function. P (2 is a prime number) is a proposition (True). P (4 is a prime number) is a proposition (False)4.
- Example: Let G(x,y) represent the predicate "x>y." This is a propositional function. Substituting values, G(9,19) means "9 is greater than 19," which is a proposition (False).
Predicates can have multiple arguments to represent relationships between objects.
- Example: Older(John,Peter) denotes "John is older than Peter." This is a proposition.
- Example: Older(x,y) denotes "x is older than y." This is a propositional function.
- Example: Let Q(x,y) denote "x+5>y." This is a propositional function. Q(3,6) means "3 + 5 > 6," which is a proposition (True).
Note: A propositional function is defined over a specific domain of discourse, which is the set of all possible values that the variable(s) in the function can take. For each element in this domain, the propositional function must evaluate to a proposition (either true or false) 119.
7.1.1 Examples of propositional functions
-
Statement: "n is an odd integer."
-
Statement: "n2+2n is an odd integer."
-
Statement: "The baseball player hit over .300 in 2003."
7.2 Quantifiers
Quantifiers are essential in predicate logic for expressing statements about collections of objects. They specify the extent to which a predicate is true over its domain of discourse.
7.2.1 Types of quantifiers
There are two primary types of quantifiers:
- Universal Quantifier: Used to state that a predicate is true for all elements in the domain of discourse.
- Existential Quantifier: Used to state that a predicate is true for at least one element in the domain of discourse 124.
7.2.2 The universal quantifier
- Symbol: ∀
- Meaning: "For all," "for every," "for any."
- Statement Form: ∀xP(x)
- Reading: "For all x such that P(x) is true," or "For every x in the domain of discourse, P(x)."
- Truth Condition: The statement ∀xP(x) is true if and only if P(x) is true for every x in the domain of discourse. It is false if there exists at least one value a in the domain such that P(a) is false 125.
- Counterexample: A value a from the universe for which P(a) is false. This value serves to disprove the universally quantified statement.
Example: Consider the statement ∀x(x2−1>0) with the domain of discourse being the set of real numbers.
- If we test x=1, we get 12−1>0, which is 0>0 (False).
- Since we found a value (x=1) for which the predicate is false, x=1 is a counterexample, and the statement ∀x(x2−1>0) is false 127.
Example: The statement "Every car is red" (∀x(Car(x)⟹Red(x))) is false because my car is gold, serving as a counterexample 126.
7.2.3 The existential quantifier
- Symbol: ∃
- Meaning: "There exists," "for some," "there is at least one."
- Statement Form: ∃xP(x)
- Reading: "There exists an x such that P(x) is true," or "For some x in the domain of discourse, P(x)."
- Truth Condition: The statement ∃xP(x) is true if and only if P(x) is true for at least one x in the domain of discourse. It is false if and only if P(x) is false for every x in the domain 128 130.
Example: The sentence "There is a red car" (∃x(Car(x)∧Red(x))) is true because my friend's car is red, which is one instance where the predicate holds true.
Example: Consider the statement "For some x, x2<0."
- With the domain of discourse being the set of real numbers, there is no real number whose square is negative.
- Therefore, the predicate P(x):x2<0 is false for all real numbers x.
- This makes the existentially quantified statement ∃x(x2<0) false.
Tip: Disproving an existential statement (∃xP(x) is false) requires showing that P(x) is false for all elements in the domain. This can be challenging as it involves a universal claim. Conversely, disproving a universal statement (∀xP(x) is false) only requires finding a single counterexample 131.
8. Graph theory: Trees, spanning trees, and algorithms
This section explores the fundamental concepts of trees and spanning trees in graph theory, detailing algorithms for finding minimum spanning trees and discussing their applications in navigation systems.
8.1 Trees and spanning trees
A tree is a special type of graph crucial in computer science, characterized by specific structural properties. A rooted tree has a designated root vertex from which all other vertices are reachable, and importantly, there are no cycles. A spanning tree of an undirected, connected graph G=(V,E) is a subgraph T that is itself a tree and includes every vertex of G. Spanning trees are essential in network data transmission to ensure connectivity without creating redundant paths (loops), thereby optimizing data flow and speed. A connected graph G with n vertices and m edges requires the removal of m−(n−1) edges to form a spanning tree. A connected graph is guaranteed to have at least one spanning tree 140.
Note: Spanning trees are particularly important in multicasting over Internet Protocol networks, where they help construct efficient data distribution paths from a source to multiple destinations by avoiding loops 137.
8.2 Properties of trees
A set A and a relation T on A define a tree if there exists a vertex v0∈A such that there is no path from v0 back to itself. This vertex v0 is called the root of the tree, and T is then referred to as a rooted tree. A rooted tree is denoted as (T,v0) 135.
8.3 Minimal spanning trees
For a weighted graph G, a minimal spanning tree (MST) is a spanning tree whose total edge weight is the smallest possible among all spanning trees of G. MSTs are vital for finding the most cost-effective way to connect all vertices in a network 144.
8.3.1 Kruskal's algorithm
Kruskal's algorithm is a greedy approach to find a minimal spanning tree for a connected, weighted graph.
- Algorithm Steps:
- Arrange all edges of the graph G in ascending order of their weights.
- Initialize a forest where each vertex is a separate tree.
- Iterate through the sorted edges. For each edge (u,v) with weight w:
- If adding edge (u,v) does not create a cycle in the forest, add it to the MST.
- Continue until n−1 edges have been added, where n is the number of vertices in G. At this point, the forest becomes a single spanning tree, which is the MST 153.
Example: Consider a weighted graph. First, sort edges by increasing weights. Then, add edges one by one, ensuring no cycle is formed. For instance, with edges sorted as BD AE DF BF CE AC AF BE BC the algorithm would add BD, AE, DF, CE, and AF, forming an MST with a total weight of 24155.
8.3.2 Prim's algorithm
Prim's algorithm is another greedy method for constructing an MST. It starts with an arbitrary vertex and grows the MST by adding the cheapest edge that connects a vertex in the growing tree to a vertex outside the tree.
- Algorithm Steps:
- Choose an arbitrary starting vertex v0.
- Maintain a set of vertices already included in the MST. Initially, this set contains only v0.
- Repeatedly add the edge (u,v) with the minimum weight such that u is in the MST set and v is not. Add v to the MST set.
- Continue until all n vertices are included in the MST set. The algorithm will have added n−1 edges.
Note: The algorithm ensures that by selecting the minimum weight edge at each step, the cumulative weight of the spanning tree is minimized 145.
Example: Given a weighted graph, order edges by decreasing weights. Successively delete edges that do not disconnect the graph until n−1 edges remain. For a graph with edges like BC AF AC BE CE BF AE DF BD deleting edges that would form cycles leads to an MST containing BE, CE, AE, DF, and BD, with a total weight of 24 8 148.
| Algorithm | Edge Sorting | Cycle Handling | Resulting MST Edges |
|---|---|---|---|
| Kruskal's | Increasing weights | Avoid adding edges that form cycles | BD, AE, DF, CE, AF |
| Prim's | (Implicitly handled by selection) | Select minimum weight edge connecting to the tree | BE, CE, AE, DF, BD |
8.4 Applications in object navigation
Graph theory, particularly concepts related to shortest paths (often built upon MST principles or related algorithms like Dijkstra's), finds extensive application in navigation systems.
- Robotics: Warehouse robots and autonomous vacuum cleaners use graph representations (e.g., occupancy grids) to plan paths. Algorithms like Dijkstra's or A* are employed to find the shortest path to a destination, such as an object or a charging dock.
- GPS and Road Maps: Navigation systems model real-world road networks as graphs, where intersections are nodes and roads are edges. Edge weights can represent travel time, distance, or other costs. Dijkstra's algorithm is then used to determine the fastest or shortest route to a specified destination.
- Video Games: Game worlds are often converted into navigation mesh graphs. Non-player characters (NPCs) utilize graph algorithms like Dijkstra's to navigate the game environment efficiently, moving towards the player or designated targets 159.
In these applications, the physical world is abstracted into a graph G=(V,E), where:
- Nodes (V): Represent distinct locations or points where an agent can be.
- Edges (E): Represent the possible movements or connections between these locations.
- Weights: Assigned to edges to quantify the "cost" of traversing that edge, which can be distance, time, energy consumption, or risk 160.
9. Graph theory: Properties, paths, cycles, and algorithms (part 1)
This section introduces fundamental concepts in graph theory, focusing on the properties of graphs, their components, and the definition of paths and cycles, along with an initial look at algorithms.
9.1 Graph properties and definitions
A graph G is formally defined as an ordered pair (V,E), where V is a non-empty set of vertices (also called nodes) and E is a set of edges (or arcs) that connect pairs of vertices. The nature of these edges determines the type of graph 163:
- Undirected Graph: In an undirected graph, edges are unordered pairs of distinct vertices. If an edge e connects vertices v and w, it is represented as e=(v,w) or e=(w,v). The edges have no specific direction, as illustrated in 167.
- Directed Graph (Digraph): A directed graph consists of a set V of vertices and a set E of edges, where each edge e∈E is associated with an ordered pair of vertices (v,w). This signifies an edge directed from v to w. The vertex v is termed the source, and w is the target. Such an edge can be denoted as v→w 169.
Graphs can also be categorized by their vertex set size:
- Infinite Graph: A graph with an infinite set of vertices 164.
- Finite Graph: A graph with a finite set of vertices, which is the primary focus of this chapter 165.
Further classifications of graphs based on their edges include:
- Simple Graph: A graph that contains neither loops (edges connecting a vertex to itself) nor parallel edges (multiple edges connecting the same pair of vertices).
- Multigraph: A graph that contains multiple edges between the same pair of vertices but does not allow loops.
- Pseudograph: A graph that allows both loops and multiple edges 174.
Note: In a directed graph, an edge associated with an ordered pair (v,w) is represented as v→w, indicating a direction from v to w 170.
9.1.1 Incidence and adjacency
Key relationships between vertices and edges include:
- Incident: An edge e connecting vertices v and w is said to be incident on both v and w. Conversely, vertices v and w are incident on edge e.
- Adjacent Vertices: Two vertices v and w are considered adjacent (or neighbors) if they are connected by an edge 171.
Example: In a graph with vertices {1, 2, 3, 4, 5}, vertex 1 is adjacent to vertices connected by an edge to 1. If vertex 2 is connected to vertex 1 by an edge, then 1 and 2 are adjacent.
- Isolated Vertex: A vertex that is not incident on any edge is called an isolated vertex 172.
9.1.2 Loops and parallel edges
- Loop: An edge that connects a vertex to itself. In directed graphs, a loop is represented by an ordered pair (v,v). These can be used to model self-referential communication links.
- Parallel Edges: If two or more edges connect the same pair of vertices, they are called parallel edges 178.
Important: A simple graph is defined as a graph that contains neither loops nor parallel edges 173.
9.2 Degree of vertices
The degree of a vertex v in a graph G, denoted as deg(v), is the total number of edges incident on that vertex 179.
Note: For undirected graphs, each edge is counted once for each of the two vertices it connects.
A fundamental property concerning vertex degrees is The Handshaking Lemma:
- The sum of the degrees of all vertices in a graph G is equal to twice the number of edges in G. This is because each edge contributes one degree to two different vertices (or two degrees to one vertex if it's a loop, though simple graphs exclude loops). ∑v∈Vdeg(v)=2∣E∣ 180.
Remember: This lemma holds for finite undirected graphs. For directed graphs, the concepts of in-degree and out-degree are used.
9.3 Paths and cycles
Paths and cycles are fundamental structures within graphs that describe sequences of connected vertices and edges.
-
Path: A path in a graph is a sequence of vertices (v0,v1,…,vk) such that for each i from 0 to k−1, there is an edge between vi and vi+1. The length of the path is the number of edges, k.
- A path is simple if all its vertices are distinct.
- A walk is a sequence of vertices and edges, where vertices and edges can be repeated. A path is a specific type of walk.
-
Cycle: A cycle is a path that starts and ends at the same vertex, i.e., v0=vk, and all other vertices (v0,…,vk−1) are distinct.
Two specific types of cycles are of significant interest:
-
Eulerian Cycle/Path:
- An Eulerian path is a path in a graph that visits every edge exactly once.
- An Eulerian cycle (or circuit) is an Eulerian path that starts and ends on the same vertex. A graph has an Eulerian cycle if and only if every vertex has an even degree, and all vertices with non-zero degree belong to the same connected component.
-
Hamiltonian Cycle/Path:
- A Hamiltonian path is a path in a graph that visits every vertex exactly once.
- A Hamiltonian cycle is a Hamiltonian path that starts and ends on the same vertex. Determining the existence of Hamiltonian paths and cycles is a more complex problem (NP-complete).
Tip: Paths and cycles are essential for understanding connectivity, reachability, and network traversals.
10. Graph theory: Properties, paths, cycles, and algorithms (part 2)
This section delves into the properties of vertices, subgraphs, paths, cycles, and introduces the concepts of Eulerian and Hamiltonian paths/circuits, along with their associated algorithms.
10.1 Vertex degrees
The degree of a vertex in a graph is a fundamental property indicating the number of edges connected to it.
- Definition: The degree of a vertex v, denoted as deg(v), is the number of edges incident to v. In multigraphs, an edge connecting a vertex to itself (a loop) is counted twice, and other edges are counted according to their multiplicity. The sum of the degrees of all vertices in a graph is equal to twice the number of edges, a property known as the Handshaking Lemma: ∑v∈Vdeg(v)=2∣E∣.
- Classification of Vertices:
- An even vertex has an even degree.
- An odd vertex has an odd degree.
- An isolated vertex has a degree of zero 182.
Example: For a graph with vertices A, B, C, D and edges (A,B), (A,C), (B,C), (B,D), (C,D), the degrees are deg(A)=2, deg(B)=3, deg(C)=3, and deg(D)=2. Vertices A and D are even, while B and C are odd 181.
For directed graphs (digraphs), vertex degrees are further categorized into in-degrees and out-degrees:
- In-degree (deg−): The number of edges directed into a vertex.
- Out-degree (deg+): The number of edges directed out of a vertex.
The sum of in-degrees equals the sum of out-degrees, and both are equal to the total number of edges in the directed graph: ∑v∈Vdeg−(v)=∑v∈Vdeg+(v)=∣E∣ 184.
Example: In a directed graph with vertices 1, 2, 3 and edges (1,2), (1,3), (2,1), (2,3), (3,1), (3,2), the degrees are:
Note: The provided example on page 185 has different edge directions leading to deg−=0, deg−=3, deg−=4 and deg+=2, deg+=3, deg+=2. This implies a specific set of directed edges for that illustration. 3 185.
10.2 Subgraphs
A subgraph is a graph derived from a larger graph by selecting a subset of its vertices and edges.
- Definition: A subgraph H of a graph G=(V,E) is a graph H=(V′,E′) where V′⊆V and E′⊆E, and the edges in E′ connect only vertices in V′.
- Types of Subgraphs:
- Induced Subgraph: If a subset of vertices W⊆V is chosen, the induced subgraph on W includes all vertices in W and all edges from the original graph G that connect pairs of vertices within W. Once vertices are selected, all their connecting edges within the graph are automatically included.
- Spanning Subgraph: A subgraph that includes all vertices of the original graph but only a subset of its edges.
- Proper Subgraph: A subgraph that is not identical to the original graph G. This means it must have either fewer vertices, fewer edges, or both, compared to G 188.
10.3 Paths and Cycles
Paths and cycles are fundamental structures in graph traversal.
-
Path: A path from vertex v0 to vertex vn of length n is a sequence of n+1 vertices (v0,v1,…,vn) and n edges (e1,e2,…,en) such that ei connects vi−1 and vi for i=1,…,n. Crucially, no edge is used more than once in a path 189.
Example: In a graph, the sequence (1,e1,2,e2,3,e3,4,e4,2) represents a path of length 4 from vertex 1 to vertex 2, where edges e1,e2,e3,e4 are traversed in sequence 190.
-
Cycle (Circuit): A cycle is a path of non-zero length that begins and ends at the same vertex. Like a path, a cycle does not repeat any edges 191.
Example: Given a path, determining if it's a cycle involves checking if it starts and ends at the same vertex and uses distinct edges.
10.4 Eulerian Paths and Circuits
Eulerian paths and circuits are specific types of traversals that visit every edge of a graph exactly once.
-
Eulerian Path: A simple path in a graph that traverses every edge exactly once. Vertices can be revisited, but edges cannot be repeated. The starting and ending vertices do not need to be the same.
- A connected graph with exactly two vertices of odd degree contains an Eulerian path 195.
-
Eulerian Circuit (or Eulerian Tour): An Eulerian path that is also a cycle; it starts and ends at the same vertex. Every edge is traversed exactly once.
- A connected graph has an Eulerian circuit if and only if all its vertices have even degrees. The contrapositive states that if any vertex has an odd degree, the graph cannot have an Eulerian circuit.
The existence of Eulerian paths and circuits is directly related to the number of odd-degree vertices in a connected graph:
| Number of odd vertices | Number of even vertices | Type of path/circuit |
|---|---|---|
| 0 | All | Eulerian circuit |
| 2 | All others | Eulerian path |
| More than 2 | Varies | Neither |
197.
Example:
Note: An Eulerian path exists in a connected graph if it has zero or two vertices with odd degrees. An Eulerian circuit exists if and only if all vertices have even degrees 194 196.
Example of an Eulerian Path: In a graph, E, D, B, A, C, D is an Eulerian path, visiting every edge exactly once. Example of an Eulerian Circuit: In a graph, 5, 3, 2, 1, 3, 4, 5 is an Eulerian circuit, starting and ending at vertex 5 and traversing all edges once 200.
10.5 Hamiltonian Paths and Circuits
A Hamiltonian path or circuit involves visiting vertices rather than edges.
- Hamiltonian Path: A path in a graph that visits every vertex exactly once.
- Hamiltonian Circuit: A Hamiltonian path that is also a cycle, meaning it starts and ends at the same vertex after visiting all other vertices exactly once.
Unlike Eulerian paths, there are no simple necessary and sufficient conditions based solely on vertex degrees for the existence of Hamiltonian paths or circuits. Determining their existence is generally a more complex problem, often requiring more advanced algorithms or specific graph properties.
Note: While the document briefly mentions cycles and paths, it does not explicitly define or detail Hamiltonian paths/circuits or algorithms like Dijkstra's in the provided page range (181-200). This summary focuses on the content present within the specified pages.
11. Graph theory: Properties, paths, cycles, and algorithms (part 3)
This section delves into specific types of paths and circuits in graph theory, namely Eulerian and Hamiltonian paths/circuits, and introduces the concept of weighted graphs along with Dijkstra's algorithm for finding shortest paths.
11.1 Eulerian paths and circuits
An Eulerian path is a trail within a graph that traverses every edge exactly once. If such a path begins and ends at the same vertex, it is classified as an Eulerian circuit. The existence of Eulerian paths and circuits is closely tied to the degrees of the vertices in the graph. A graph has an Eulerian circuit if and only if all vertices have an even degree and all vertices with non-zero degree belong to the same connected component. A graph has an Eulerian path but no Eulerian circuit if and only if it has exactly two vertices of odd degree. If a graph has more than two vertices of odd degree, it has neither an Eulerian path nor an Eulerian circuit 201.
Example: Consider a graph where vertex 'b' has a degree of 3. Since this is an odd degree, the graph cannot have an Eulerian circuit. If this is the only vertex with an odd degree, it cannot even have an Eulerian path. If there are exactly two vertices with odd degrees, an Eulerian path exists. If there are more than two, neither an Eulerian path nor a circuit exists 202.
11.2 Hamiltonian paths and circuits
A Hamiltonian path is a path in a graph that visits each vertex exactly once. A Hamiltonian circuit is a cycle that visits every vertex exactly once, with the exception that the start and end vertices are the same. Unlike Eulerian paths, which are defined by traversing edges, Hamiltonian paths are defined by visiting vertices. Determining the existence of Hamiltonian paths or circuits is generally a more complex problem (NP-complete) than for Eulerian paths. 204 205.
Example: In a graph with vertices labeled a, b, c, d, and e, the path a, b, c, d, e is a Hamiltonian path because it includes each vertex precisely once. If this path could be extended to return to 'a' (i.e., a, b, c, d, e, a), it would then be a Hamiltonian circuit 203.
Note: A graph might possess a Hamiltonian path but not a Hamiltonian circuit. For instance, a path traversing vertices (5, 7, 6, 4, 3, 1, 2) might be a Hamiltonian path, but if there's no edge connecting vertex 2 back to vertex 5, it cannot form a Hamiltonian circuit 206.
11.3 Weighted graphs
A weighted graph is a graph where each edge is assigned a numerical value, known as its weight. These weights are typically non-negative integers and are often referred to as the "cost" of traversing that edge. Weighted graphs are instrumental in modeling real-world scenarios such as computer networks, where edge weights can represent communication costs, response times, or distances between nodes. They can be directed or undirected. 212 213.
Applications of edge weights:
- Communications Networks: Monthly leasing costs of telephone lines.
- Computer Networks: Response times between computers.
- Logistics and Transportation: Distances between locations or cities, travel times, fuel consumption.
- Resource Allocation: Capacity of a communication line or pipeline.
11.4 Dijkstra's algorithm
Dijkstra's algorithm is a fundamental algorithm used to find the shortest path from a designated starting vertex (source) to all other vertices in a graph that has non-negative edge weights. It's a greedy algorithm that systematically explores the graph.
Steps of Dijkstra's Algorithm:
-
Initialization:
- Assign a distance of 0 to the source vertex.
- Assign an infinite distance (∞) to all other vertices.
- Mark all vertices as unvisited.
-
Visit Current Node:
- For the currently selected vertex, calculate the tentative distance to each of its unvisited neighbors.
- The tentative distance to a neighbor is the sum of the distance to the current vertex and the weight of the edge connecting them.
- If this calculated distance is less than the neighbor's current recorded distance, update the neighbor's distance.
-
Mark as Visited:
- Once a vertex's shortest path from the source has been determined, it is marked as visited and will not be revisited.
-
Choose Next Node:
- Select the unvisited vertex with the smallest tentative distance from the source. This vertex becomes the "current node" for the next iteration.
-
Repeat:
- Continue this process until all vertices have been visited or until the target vertex (if a specific destination is sought) has been visited.
Example: Consider a graph with vertices A, B, C, D, E and non-negative edge weights. If A is the source, its distance is initialized to 0, and all others to ∞.
Initial State:
Unvisited nodes: {A, B, C, D, E}
Distances: A: 0, B: ∞, C: ∞, D: ∞, E: ∞
After visiting A (smallest distance):
The algorithm examines neighbors of A. If edge (A, C) has weight 2 and edge (A, B) has weight 4, the distances are updated.
Distances: A: 0, B: 4, C: 2, D: ∞, E: ∞
Next, C is chosen as it has the smallest tentative distance. The algorithm then updates distances for C's neighbors. If there's an edge (C, B) with weight 3, the path A -> C -> B has a total weight of 2 + 3 = 5. If 5 is less than B's current distance B's distance remains 4. However, if there's an edge (C, D) with weight 4, the path A -> C -> D has a total weight of 2 + 4 = 6. This updates D's distance from ∞ to 6. 219 220.
Important Note: Dijkstra's algorithm is guaranteed to find the shortest path only for graphs with non-negative edge weights. If negative edge weights are present, other algorithms like the Bellman-Ford algorithm are required 216.
12. Graph theory: Properties, paths, cycles, and algorithms (part 4)
This section delves into Dijkstra's algorithm, a fundamental method for finding the shortest paths in a weighted graph.
12.1 Dijkstra's algorithm
Dijkstra's algorithm is a greedy algorithm used to find the shortest paths from a single source vertex to all other vertices in a graph with non-negative edge weights. It systematically explores the graph, maintaining the shortest distance found so far from the source to each vertex.
Algorithm Steps:
-
Initialization:
- Assign a distance value to every vertex: infinity for all vertices except the source vertex, which is assigned a value of 0.
- Create a set of unvisited vertices, initially containing all vertices in the graph.
-
Iteration:
- While the set of unvisited vertices is not empty:
- Select the unvisited vertex with the smallest distance value. Let this vertex be u.
- Mark u as visited (remove it from the set of unvisited vertices).
- For each unvisited neighbor v of u:
- Calculate the distance from the source to v through u: distance(source,u)+weight(u,v).
- If this calculated distance is less than the current distance value assigned to v, update the distance value of v to this new shorter distance.
- While the set of unvisited vertices is not empty:
-
Termination:
- Once all vertices have been visited, the algorithm terminates. The distance values assigned to each vertex represent the shortest path distance from the source vertex.
Note: Dijkstra's algorithm assumes that all edge weights are non-negative. If the graph contains negative edge weights, other algorithms like the Bellman-Ford algorithm must be used.
Example Walkthrough:
Consider a weighted graph with vertices A, B, C, D, and E, and edge weights as depicted in the provided diagrams. We aim to find the shortest paths from vertex A.
-
Initial State:
- Distances: A: 0, B: ∞, C: ∞, D: ∞, E: ∞
- Unvisited vertices: {A, B, C, D, E}
-
Step 1: Visit A
- Smallest distance is 0 (vertex A). Select A.
- Mark A as visited.
- Neighbors of A: B (weight 2), C (weight 1).
- Update distances: B: 0+2=2, C: 0+1=1.
- Distances: A: 0, B: 2, C: 1, D: ∞, E: ∞
- Unvisited vertices: {B, C, D, E}
-
Step 2: Visit C
- Smallest distance among unvisited is 1 (vertex C). Select C.
- Mark C as visited.
- Neighbors of C: B (weight 3), D (weight 2), E (weight 4).
- Update distances:
- For B: Current distance is 2. New path through C: distance(A,C)+weight(C,B)=1+3=4. Since 4>2, B's distance remains 2.
- For D: Current distance is ∞. New path through C: distance(A,C)+weight(C,D)=1+2=3. Update D's distance to 3.
- For E: Current distance is ∞. New path through C: distance(A,C)+weight(C,E)=1+4=5. Update E's distance to 5.
- Distances: A: 0, B: 2, C: 1, D: 3, E: 5
- Unvisited vertices: {B, D, E}
-
Step 3: Visit B
- Smallest distance among unvisited is 2 (vertex B). Select B.
- Mark B as visited.
- Neighbors of B: D (weight 4), E (weight 3).
- Update distances:
- For D: Current distance is 3. New path through B: distance(A,B)+weight(B,D)=2+4=6. Since 6>3, D's distance remains 3.
- For E: Current distance is 5. New path through B: distance(A,B)+weight(B,E)=2+3=5. Since 5≯5, E's distance remains 5.
- Distances: A: 0, B: 2, C: 1, D: 3, E: 5
- Unvisited vertices: {D, E}
-
Step 4: Visit D
- Smallest distance among unvisited is 3 (vertex D). Select D.
- Mark D as visited.
- Neighbors of D: E (weight 1).
- Update distances:
- For E: Current distance is 5. New path through D: distance(A,D)+weight(D,E)=3+1=4. Since 4<5, update E's distance to 4.
- Distances: A: 0, B: 2, C: 1, D: 3, E: 4
- Unvisited vertices: {E}
-
Step 5: Visit E
- Smallest distance among unvisited is 4 (vertex E). Select E.
- Mark E as visited.
- E has no unvisited neighbors.
- Distances: A: 0, B: 2, C: 1, D: 3, E: 4
- Unvisited vertices: {}
All nodes have been visited. The shortest paths from A are:
- A to A: 0
- A to B: 2
- A to C: 1
- A to D: 3
- A to E: 4
Example: The shortest path from A to E has a total weight of 4. This path is A → C → D → E.
The final state shows the shortest path distances from the fixed node (A) to all other nodes in the graph 223 224.
13. Functions and relations (part 1)
This section introduces the fundamental concepts of functions, including their definition, types (injective, surjective, bijective), composition, and inverse functions, along with an initial exploration of relations.
13.1 Introduction to functions
A function is a special type of relation between two sets, X and Y, where each element in the first set (the domain) is associated with exactly one element in the second set (the codomain). This association can be represented as a set of ordered pairs (x,y), where x is from the domain and y is from the codomain.
- Formal Definition: A function f from a set X to a set Y, denoted as f:X→Y, is a subset of the Cartesian product X×Y such that for every element x∈X, there exists exactly one element y∈Y with (x,y)∈f.
- Domain: The set X is called the domain of the function f.
- Codomain: The set Y is called the codomain of the function f.
- Range: The set of all y values that are actually mapped to by the function is called the range of f. Formally, it is {y∣(x,y)∈f}.
Example: The set f={(1,a),(2,b),(3,a)} is a function from X={1,2,3} to Y={a,b,c}. Each element in X is mapped to exactly one element in Y. The domain is X, the codomain is Y, and the range is {a,b}. 228.
Note: A set of ordered pairs is NOT a function if an element in the domain is not mapped to any element in the codomain, or if an element in the domain is mapped to more than one element in the codomain. 230.
13.2 Types of functions
Functions can be classified based on how elements from the domain map to the codomain.
13.2.1 Injective (one-to-one) functions
A function f:A→B is injective if distinct elements in the domain map to distinct elements in the codomain. In other words, no two different inputs produce the same output.
- Formal Definition: A function f is injective if for all x1,x2∈A, if f(x1)=f(x2), then x1=x2.
- Property: Every element in the domain maps to a unique element in the codomain.
Example: Prove that f(x)=2x+1 from R→R is injective. Assume f(x1)=f(x2). Then, 2x1+1=2x2+1. Subtracting 1 from both sides gives 2x1=2x2. Dividing by 2 yields x1=x2. Since f(x1)=f(x2) implies x1=x2, the function is injective 233.
13.2.2 Surjective (onto) functions
A function f:A→B is surjective if every element in the codomain is the image of at least one element from the domain. This means the range of the function is equal to its codomain.
- Formal Definition: A function f is surjective if for every y∈B, there exists at least one x∈A such that f(x)=y.
Example: Prove that f(x)=x3 from R→R is surjective. Let y∈R be an arbitrary element in the codomain. We need to find an x∈R such that f(x)=y. This means we need x3=y. Solving for x, we get x=y. Since the cube root of any real number is also a real number, x=y∈R. Thus, for any y in the codomain, we can find a corresponding x in the domain. Therefore, f(x)=x3 is surjective 235.
13.2.3 Bijective functions
A function f:A→B is bijective if it is both injective and surjective.
- Property: A bijective function establishes a perfect one-to-one correspondence between the elements of its domain and codomain. Every element in the codomain is mapped to by exactly one element from the domain.
Example: Prove that f(x)=x+4 from R→R is bijective. 1. Injectivity: Assume f(x1)=f(x2). Then x1+4=x2+4. Subtracting 4 from both sides gives x1=x2. Thus, f is injective. 2. Surjectivity: Let y∈R be arbitrary. We want to find an x such that f(x)=y, which means x+4=y. Solving for x, we get x=y−4. Since y−4 is a real number, such an x always exists in the domain. Thus, f is surjective. Since f is both injective and surjective, it is bijective. 237.
13.3 Composition of functions
The composition of two functions allows us to combine them to create a new function.
- Definition: Let g:X→Y and f:Y→Z be functions. The composition of f and g, denoted by f∘g, is a function from X to Z defined as (f∘g)(x)=f(g(x)) for all x∈X.
- Process: To find (f∘g)(x), you first apply the function g to x, and then apply the function f to the result g(x).
Example: Given f(x)=x2 and g(x)=x+2, find (f∘g)(x) and (g∘f)(x). (f∘g)(x)=f(g(x))=f(x+2)=(x+2)2=x2+4x+4. (g∘f)(x)=g(f(x))=g(x2)=x2+2.
Example: If f(x)=x1 for x=0, what is (f∘f)(x)? (f∘f)(x)=f(f(x))=f(x1). Since f(u)=u1, we substitute u=x1. Thus, (f∘f)(x)=x11=x 241.
13.4 Inverse functions
An inverse function "reverses" the mapping of the original function.
- Definition: If f is a function from set A to set B, its inverse function, denoted by f−1, is a function from B to A such that for every y∈B, f−1(y)=x if and only if f(x)=y.
- Condition: An inverse function f−1 exists if and only if the function f is bijective (both injective and surjective).
- Properties:
- The domain of f−1 is the range of f.
- The range of f−1 is the domain of f.
- If (x,y) is an ordered pair in f, then (y,x) is an ordered pair in f−1.
Example: Given the function f={(1,a),(2,c),(3,b)}, its inverse is f−1={(a,1),(c,2),(b,3)} 243.
Example: Given f:x↦2x−3 with domain X={1,2,3} and codomain Y={−1,1,3}. The mapping is: f=2−3=−1, f=2−3=1, f=2−3=3 2. The inverse function f−1 reverses these mappings: f−1(−1)=1, f−1=2, f−1=3 3 244.
14. Functions and relations (part 2)
This section delves into the properties and applications of functions, specifically focusing on injective, surjective, and bijective types, along with their role in algorithms. It also introduces the concept of relations, their characteristics, and the significant category of equivalence relations.
14.1 Functions in algorithms
Functions serve as fundamental building blocks in algorithm design, modeling data transformations, assignments, and mappings. A function f:A→B maps each element in a set A (the domain) to exactly one element in a set B (the codomain). In algorithmic contexts, the input set corresponds to the domain, the output set to the codomain, and the algorithm's steps define the rule of the function. For instance, an algorithm that doubles an integer, represented as f(x)=2x where f:Z→Z, exemplifies a function where each integer input yields a unique integer output 246 247.
14.1.1 Injective functions in algorithms
Injective functions, also known as one-to-one functions, ensure that distinct inputs always produce distinct outputs. This property is crucial in algorithms for applications such as:
- Hash functions: Injectivity helps avoid collisions in data structures. A collision occurs when two different inputs map to the same hash value, potentially leading to slower data access. Effective hash functions aim to distribute data evenly. For example, if "cat" and "dog" both hash to the value 23, a collision occurs.
- Unique ID generation: Algorithms that assign unique identifiers, like student IDs or employee IDs, must be injective to prevent duplicate assignments 248.
Example: An algorithm to assign unique employee IDs where each employee i receives an ID generated by ID=i×100+1. For instance, Employee 1 gets ID 101, Employee 2 gets ID 201, and so on. This ensures that if i1=i2, then ID1=ID2 253.
14.1.2 Surjective functions in algorithms
Surjective functions, or onto functions, guarantee that every element in the codomain is mapped to by at least one element from the domain. This is important for ensuring comprehensive coverage and utilization in algorithms such as:
- Load balancing: Distributing tasks across all available servers.
- Resource allocation: Ensuring all resources are assigned to some process or task.
- Covering problems: In combinatorics, ensuring all elements of a set are accounted for 249.
Example: An algorithm assigning tasks to departments. If there are three departments, a task t can be assigned to department (tmod3)+1. This ensures that departments 1, 2, and 3 each receive at least one task, demonstrating surjectivity 254.
14.1.3 Bijective functions in algorithms
Bijective functions, which are both injective and surjective, establish a perfect one-to-one correspondence between elements of the domain and codomain. They are essential for applications requiring a unique mapping in both directions:
- Data encoding/decoding: Each encoded message maps to a unique original message and vice versa.
- Permutations: Used in sorting algorithms where elements are rearranged.
- Cryptographic ciphers: One-to-one mappings ensure unique encryption and decryption for every message 250.
Example: A sorting algorithm can be viewed as a bijective function. The original indices of elements are mapped to their final sorted indices. Each original index maps to a unique final index, and every final index is mapped to by exactly one original index, signifying a bijective mapping 251.
Example: Assigning lockers to employees requires a perfect one-to-one correspondence. If employees are assigned lockers sequentially starting from 101, a mapping can be recorded for both Employee → Locker and Locker → Employee, facilitating retrieval from either perspective 255.
14.2 Relations
A relation can be understood as a set of ordered pairs. An ordered pair (a,b) consists of two elements, a and b, where the order is significant, with a appearing first and b last 257.
Relations can be defined from a set X to a set Y, or on a set X (which means from X to X).
14.2.1 Defining and representing relations
Relations can be represented in various ways, including tables and sets of ordered pairs.
- A relation can be explicitly listed as a set of ordered pairs. For example, a relation R of Students to Courses might be represented as R={(Bill,Computer Studies),(Mary,Math),(Bill,Art),(Beth,History),(Beth,Computer Studies),(Dave,Math)} 259.
- If (a,b)∈R, it can also be written as aRb.
Example: Consider sets X={2,3,4} and Y={3,4,5,6,7}. A relation R from X to Y is defined where (x,y)∈R if x divides y. The relation R can be written as R={(2,4),(2,6),(3,3),(3,6),(4,4)}.
14.2.2 Domain and range of relations
The domain of a relation R, denoted as Dom(R), is the set of all first elements of the ordered pairs in R. The range of a relation R, denoted as Ran(R), is the set of all second elements of the ordered pairs in R.
Example: For the relation R={(Bill,Computer Studies),(Mary,Math),(Bill,Art),(Beth,History),(Beth,Computer Studies),(Dave,Math)}, the domain is X={Bill,Mary,Beth,Dave} and the range is Y={Computer Studies,Math,Art,History} 260.
Example: For the relation R={(2,4),(2,6),(3,3),(3,6),(4,4)}, Dom(R)={2,3,4} and Ran(R)={3,4,6} 262.
Example: Let R be the relation on X={1,2,3,4} defined by (x,y)∈R if x≤y. Then R={(1,1),(1,2),(1,3),(1,4),(2,2),(2,3),(2,4),(3,3),(3,4),(4,4)}. Here, Dom(R)={1,2,3,4} and Ran(R)={1,2,3,4} 263.
Example: Let A={1,2,3,4,5}. Define relation R on A as aRb if a<b. Then R={(1,2),(1,3),(1,4),(1,5),(2,3),(2,4),(2,5),(3,4),(3,5),(4,5)}. The domain is Dom(R)={1,2,3,4} and the range is Ran(R)={2,3,4,5} 264.
15. Functions and relations (part 3)
This section delves into the properties of relations, including reflexivity, symmetry, and transitivity, and introduces the concept of equivalence relations.
15.1 Relations and their representations
A relation R on a set A is a subset of the Cartesian product A×A. If a is related to b by relation R, it is denoted as aRb or (a,b)∈R. Relations can be visualized using digraphs, especially for finite sets.
15.1.1 Digraph of a relation
A digraph of a relation R on a finite set A is constructed by:
- Representing each element of A as a vertex (a small circle).
- Drawing a directed edge (an arrow) from vertex ai to vertex aj if and only if (ai,aj)∈R.
Example: For A={1,2,3,4} and R={(1,1),(1,2),(2,1),(2,2),(2,4),(3,4),(4,2)}, the digraph shows loops at vertices 1 and 2, and edges between 1 and 2, 2 and 4, 3 and 4, and 4 and 2 267.
Example: Given a digraph, the relation can be determined by identifying all ordered pairs (ai,aj) for which there is an edge from vertex ai to vertex aj. For instance, a digraph with edges (2,2),(3,3),(1,2),(3,1),(4,3) corresponds to the relation R={(2,2),(3,3),(1,2),(3,1),(4,3)} 268.
15.2 Properties of relations
Relations can possess several important properties that classify their structure.
15.2.1 Reflexive and irreflexive relations
-
Reflexive relation: A relation R on a set X is reflexive if (x,x)∈R for every element x∈X. This means every element is related to itself.
Example: The relation R on X={1,2,3,4} defined by (x,y)∈R if x≤y is reflexive because (1,1),(2,2),(3,3),(4,4) are all in R 270.
-
Irreflexive relation: A relation R on a set X is irreflexive if no element is related to itself, meaning (x,x)∈/R for all x∈X.
Example: The relation R on X={1,2,3,4} defined by (x,y)∈R if x<y is irreflexive, as no element is related to itself 271. Note: A relation is not irreflexive if there exists at least one element x such that (x,x)∈R. For instance, if R={(1,1),(1,2),(2,4)} on X={1,2,3,4}, it is not irreflexive because (1,1)∈R 272.
15.2.2 Symmetric and non-symmetric relations
-
Symmetric relation: A relation R on a set A is symmetric if for all a,b∈A, whenever aRb, then bRa. In a digraph, this means if there is an edge from vertex a to vertex b, there must also be an edge from vertex b to vertex a.
Example: The relation R={(a,a),(b,c),(c,b),(d,d)} on X={a,b,c,d} is symmetric because for (b,c)∈R, we also have (c,b)∈R, and for (a,a),(d,d)∈R, their reverses are themselves 273.
-
Non-symmetric relation: A relation R is non-symmetric if there exist elements a,b∈A such that aRb but bRa is not true.
Example: The relation R on X={1,2,3} defined by (x,y)∈R if x<y is non-symmetric, as (2,3)∈R but (3,2)∈/R 274.
-
Asymmetric relation: A relation R on a set A is asymmetric if for all a,b∈A, if aRb, then bRa must not be true. This implies that no element can be related to itself, and if a=b and aRb, then bRa is false.
Example: The relation R on A={1,2,3} defined by aRb if a<b is asymmetric. For instance, (1,2)∈R but (2,1)∈/R. Also, (x,x)∈/R for any x. Note: A relation is "not asymmetric" if there exist a,b∈A such that aRb and bRa. For example, R={(1,1),(1,2),(2,1),(3,2)} on A={1,2,3} is not asymmetric because (1,2)∈R and (2,1)∈R 275.
15.2.3 Transitive relations
- Transitive relation: A relation R on a set A is transitive if for all a,b,c∈A, whenever (a,b)∈R and (b,c)∈R, it implies that (a,c)∈R. In a digraph, if there's a path from vertex a to vertex b and from vertex b to vertex c, there must also be a direct edge from vertex a to vertex c.
Example: The "less than" relation (<) on the set of integers Z is transitive. If a<b and b<c, then it logically follows that a<c 277. Example: The relation R={(a,a),(b,c),(c,b),(d,d)} on X={a,b,c,d} is not transitive because (b,c)∈R and (c,b)∈R, but (b,b)∈/R 278.
15.3 Equivalence relations
An equivalence relation is a special type of relation that satisfies three specific properties: reflexivity, symmetry, and transitivity.
- Definition: A relation R on a set X is an equivalence relation if it is:
- Reflexive: (x,x)∈R for all x∈X.
- Symmetric: If (x,y)∈R, then (y,x)∈R.
- Transitive: If (x,y)∈R and (y,z)∈R, then (x,z)∈R.
Example: To determine if R={(a,a),(b,c),(c,b),(d,d)} on X={a,b,c,d} is an equivalence relation, we check the properties:
- It is not reflexive because, for instance, (b,b)∈/R.
- It is not transitive because (b,c)∈R and (c,b)∈R, but (b,b)∈/R. Since it fails to meet the criteria for reflexivity and transitivity, it is not an equivalence relation 279.
Note: A common example of an equivalence relation is the relation "is equal to" on a set, or "has the same remainder as" when divided by a specific number. Equivalence relations partition a set into disjoint subsets called equivalence classes.
16. Sets and set operations (part 1)
This section introduces the fundamental concepts of sets and their basic operations, focusing on definitions, notation, and operations such as complement, intersection, and union.
16.1 Introduction to sets
A set is defined as an unordered collection or group of objects, where these objects are referred to as elements or members of the set. A set is said to contain its elements 282.
- Membership Notation:
- The notation a∈A signifies that a is an element of set A.
- The notation a∈/A indicates that a is not an element of set A.
- Lowercase letters are typically used to represent elements of sets 283.
Example: Given A={2,4,5} and B={6,8}, we can state that 2∈A and 5∈A. Conversely, 6∈/A, although 6∈B 284.
16.2 Describing sets
Sets can be described in several ways:
- Listing Members: When feasible, the elements of a set are listed between braces. For instance, {a,b,c,d} represents a set with four specific elements 285.
- Using Ellipses: If a clear pattern exists, some members are listed, followed by ellipses (
...), to indicate continuation. For example, the set of positive integers less than 100 can be denoted as {1,2,3,…,99} 287. - Set-Builder Notation: This method describes a set by stating a property that its elements must satisfy.
- Example: A set of integers from 1 to 5 can be written as A={x:1≤x≤5,x is an integer}.
- Example: The set C of all vowels in the English alphabet is C={a,e,i,o,u} 286.
- Example: The set O of all odd positive integers less than 10 can be written as O={x∣x is an odd positive integer less than 10} or, by specifying the universe, O={x∣x is odd and x<10} 288.
16.2.1 Standard number sets
Certain sets, often denoted by boldface letters, are fundamental in discrete mathematics 289:
- N={1,2,3,…}, the set of natural numbers.
- Z={…,−2,−1,0,1,2,…}, the set of integers.
- Z+={1,2,3,…}, the set of positive integers.
- Q={p/q∣p∈Z,q∈Z, and q=0}, the set of rational numbers.
- R, the set of real numbers.
16.3 Universal sets and complements
16.3.1 Universal set
A universal set, typically denoted by ξ, is a set that encompasses all elements currently under consideration.
Example: If A={2,4,6,8} and the scope of discussion includes all integers from 1 to 10, then the universal set is ξ={all integers from 1 to 10} 290.
16.3.2 Complement of a set
The complement of a set A, denoted as A′, consists of all elements in the universal set ξ that are not in A.
Example: Given ξ={all integers from 1 to 10} and A={2,3,4,5,7,8,9}, then A′={1,6,10} 292.
In a Venn diagram, the complement A′ is represented by the shaded region within ξ that lies outside of A 293.
16.4 Set operations
16.4.1 Intersection of sets
The intersection of two sets, A and B, denoted by A∩B, is the set containing all elements that are common to both A and B.
Example: If A={1,3,5,8} and B={2,3,5,7}, then A∩B={3,5} because 3 and 5 are present in both sets 294.
Example: Given P={M,A,T,H,E,I,C} and Q={E,N,G,L,I,S,H}, then P∩Q={E,H,I} 295.
In a Venn diagram, the intersection A∩B is represented by the overlapping region of sets A and B 296.
16.4.2 Complement of the intersection of sets
The complement of the intersection of sets, denoted as (A∩B)′, represents all elements in the universal set ξ that are not in the intersection A∩B. This is visualized in a Venn diagram as the shaded area within ξ but outside the overlapping region of A and B 297.
The concept extends to more than two sets, such as (P∩Q∩R)′, which includes elements not common to P, Q, and R simultaneously. Similarly, expressions like A∩B∩C′ and A∩(B∩C)′ involve intersections with complements of other sets 298 299.
16.4.3 Union of sets
The union of two sets, A and B, denoted by A∪B, is the set of all elements that belong to A, or to B, or to both.
Example: Given A={1,3,5} and B={2,3,4}, the union of A and B is A∪B={1,2,3,4,5}. The symbol ∪ is used to denote the union of two sets 300.
17. Sets and set operations (part 2)
This section delves into advanced set operations, including set difference, symmetric difference, and the concept of disjoint sets, building upon foundational set theory.
17.1 Set difference
The difference between two sets, A and B, denoted as A−B, is the set containing all elements that are present in set A but not in set B. Mathematically, this is defined as: A−B={x∣x∈A and x∈/B}.
To find the difference A−B:
- Identify all elements that are common to both sets A and B.
- From set A, remove any elements that are also present in set B.
- The remaining elements in A constitute the set difference A−B.
Similarly, the difference B−A contains all elements that are in set B but not in set A. B−A={x∣x∈B and x∈/A}.
Example: Given A={1,3,5} and B={4,5,6}. Then, A−B={1,3} because 1 and 3 are in A but not in B, while 5 is common to both. And, B−A={4,6} because 4 and 6 are in B but not in A, while 5 is common to both 306.
17.2 Symmetric difference
The symmetric difference between two sets, A and B, denoted by A⊕B, is the set of all elements that belong to either A or B, but not to both. This can be expressed as: A⊕B={x∣(x∈A and x∈/B) or (x∈B and x∈/A)} 307.
An alternative way to define the symmetric difference is as the union of the differences of the two sets: A⊕B=(A−B)∪(B−A).
To calculate the symmetric difference A⊕B:
- Calculate the set difference A−B.
- Calculate the set difference B−A.
- Take the union of the results from steps 1 and 2.
Example: Let A={a,b,c,d} and B={a,c,e,f,g}. First, find the differences: A−B={b,d} B−A={e,f,g} Then, find the symmetric difference: A⊕B=(A−B)∪(B−A)={b,d}∪{e,f,g}={b,d,e,f,g} 308.
Remember: The steps for calculating set differences are crucial for finding the symmetric difference 309.
Exercise: If A={Counting numbers between 30 and 40} and B={Counting numbers between 20 and 50 which are divisible by 4}, find A−B and B−A. A={31,32,33,34,35,36,37,38,39} B={24,28,32,36,40,44,48}
a) A−B: Eliminate common elements (32, 36) from A. A−B={31,33,34,35,37,38,39}.
b) B−A: Eliminate common elements (32, 36) from B. B−A={24,28,40,44,48} 310.
17.3 Disjoint sets
Two sets are considered disjoint if they share no common elements. This means their intersection is the empty set (∅). Mathematically, sets A and B are disjoint if and only if A∩B=∅.
Note: If two sets are disjoint, their symmetric difference is equal to their union, i.e., if A∩B=∅, then A⊕B=A∪B 311.
Common mistakes to avoid
- Review all topics thoroughly before exams
- Pay attention to formulas and key definitions
- Practice with examples provided in each section
- Don't memorize without understanding the underlying concepts
© 2026 Maeve. All rights reserved. This content is protected by copyright.