Discuss Discrete Mathematics ”; Previous Next Discrete Mathematics is a branch of mathematics involving discrete elements that uses algebra and arithmetic. It is increasingly being applied in the practical fields of mathematics and computer science. It is a very good tool for improving reasoning and problem-solving capabilities. This tutorial explains the fundamental concepts of Sets, Relations and Functions, Mathematical Logic, Group theory, Counting Theory, Probability, Mathematical Induction and Recurrence Relations, Graph Theory, Trees and Boolean Algebra. Print Page Previous Next Advertisements ”;
Category: discrete Mathematics
Group Theory
Discrete Mathematics – Group Theory ”; Previous Next Semigroup A finite or infinite set $‘S’$ with a binary operation $‘omicron’$ (Composition) is called semigroup if it holds following two conditions simultaneously − Closure − For every pair $(a, b) in S, :(a omicron b)$ has to be present in the set $S$. Associative − For every element $a, b, c in S, (a omicron b) omicron c = a omicron (b omicron c)$ must hold. Example The set of positive integers (excluding zero) with addition operation is a semigroup. For example, $ S = lbrace 1, 2, 3, dots rbrace $ Here closure property holds as for every pair $(a, b) in S, (a + b)$ is present in the set S. For example, $1 + 2 = 3 in S]$ Associative property also holds for every element $a, b, c in S, (a + b) + c = a + (b + c)$. For example, $(1 + 2) + 3 = 1 + (2 + 3) = 5$ Monoid A monoid is a semigroup with an identity element. The identity element (denoted by $e$ or E) of a set S is an element such that $(a omicron e) = a$, for every element $a in S$. An identity element is also called a unit element. So, a monoid holds three properties simultaneously − Closure, Associative, Identity element. Example The set of positive integers (excluding zero) with multiplication operation is a monoid. $S = lbrace 1, 2, 3, dots rbrace $ Here closure property holds as for every pair $(a, b) in S, (a times b)$ is present in the set S. [For example, $1 times 2 = 2 in S$ and so on] Associative property also holds for every element $a, b, c in S, (a times b) times c = a times (b times c)$ [For example, $(1 times 2) times 3 = 1 times (2 times 3) = 6$ and so on] Identity property also holds for every element $a in S, (a times e) = a$ [For example, $(2 times 1) = 2, (3 times 1) = 3$ and so on]. Here identity element is 1. Group A group is a monoid with an inverse element. The inverse element (denoted by I) of a set S is an element such that $(a omicron I) = (I omicron a) = a$, for each element $a in S$. So, a group holds four properties simultaneously – i) Closure, ii) Associative, iii) Identity element, iv) Inverse element. The order of a group G is the number of elements in G and the order of an element in a group is the least positive integer n such that an is the identity element of that group G. Examples The set of $N times N$ non-singular matrices form a group under matrix multiplication operation. The product of two $N times N$ non-singular matrices is also an $N times N$ non-singular matrix which holds closure property. Matrix multiplication itself is associative. Hence, associative property holds. The set of $N times N$ non-singular matrices contains the identity matrix holding the identity element property. As all the matrices are non-singular they all have inverse elements which are also nonsingular matrices. Hence, inverse property also holds. Abelian Group An abelian group G is a group for which the element pair $(a,b) in G$ always holds commutative law. So, a group holds five properties simultaneously – i) Closure, ii) Associative, iii) Identity element, iv) Inverse element, v) Commutative. Example The set of positive integers (including zero) with addition operation is an abelian group. $G = lbrace 0, 1, 2, 3, dots rbrace$ Here closure property holds as for every pair $(a, b) in S, (a + b)$ is present in the set S. [For example, $1 + 2 = 2 in S$ and so on] Associative property also holds for every element $a, b, c in S, (a + b) + c = a + (b + c)$ [For example, $(1 +2) + 3 = 1 + (2 + 3) = 6$ and so on] Identity property also holds for every element $a in S, (a times e) = a$ [For example, $(2 times 1) = 2, (3 times 1) = 3$ and so on]. Here, identity element is 1. Commutative property also holds for every element $a in S, (a times b) = (b times a)$ [For example, $(2 times 3) = (3 times 2) = 3$ and so on] Cyclic Group and Subgroup A cyclic group is a group that can be generated by a single element. Every element of a cyclic group is a power of some specific element which is called a generator. A cyclic group can be generated by a generator ‘g’, such that every other element of the group can be written as a power of the generator ‘g’. Example The set of complex numbers $lbrace 1,-1, i, -i rbrace$ under multiplication operation is a cyclic group. There are two generators − $i$ and $–i$ as $i^1 = i, i^2 = -1, i^3 = -i, i^4 = 1$ and also $(–i)^1 = -i, (–i)^2 = -1, (–i)^3 = i, (–i)^4 = 1$ which covers all the elements of the group. Hence, it is a cyclic group. Note − A cyclic group is always an abelian group but not every abelian group is a cyclic group. The rational numbers under addition is not cyclic but is abelian. A subgroup H is a subset of a group G (denoted by $H ≤ G$) if it satisfies the four properties simultaneously − Closure, Associative, Identity element, and Inverse. A subgroup H of a group G that does not include the whole group G is called a proper subgroup (Denoted by $H < G$). A subgroup of a cyclic group is cyclic and a abelian subgroup is also abelian. Example Let a group $G = lbrace 1, i, -1, -i rbrace$ Then some subgroups are $H_1 = lbrace 1 rbrace,
Propositional Logic
Discrete Mathematics – Propositional Logic ”; Previous Next The rules of mathematical logic specify methods of reasoning mathematical statements. Greek philosopher, Aristotle, was the pioneer of logical reasoning. Logical reasoning provides the theoretical base for many areas of mathematics and consequently computer science. It has many practical applications in computer science like design of computing machines, artificial intelligence, definition of data structures for programming languages etc. Propositional Logic is concerned with statements to which the truth values, “true” and “false”, can be assigned. The purpose is to analyze these statements either individually or in a composite manner. Prepositional Logic – Definition A proposition is a collection of declarative statements that has either a truth value “true” or a truth value “false”. A propositional consists of propositional variables and connectives. We denote the propositional variables by capital letters (A, B, etc). The connectives connect the propositional variables. Some examples of Propositions are given below − “Man is Mortal”, it returns truth value “TRUE” “12 + 9 = 3 – 2”, it returns truth value “FALSE” The following is not a Proposition − “A is less than 2”. It is because unless we give a specific value of A, we cannot say whether the statement is true or false. Connectives In propositional logic generally we use five connectives which are − OR ($lor$) AND ($land$) Negation/ NOT ($lnot$) Implication / if-then ($rightarrow$) If and only if ($Leftrightarrow$). OR ($lor$) − The OR operation of two propositions A and B (written as $A lor B$) is true if at least any of the propositional variable A or B is true. The truth table is as follows − A B A ∨ B True True True True False True False True True False False False AND ($land$) − The AND operation of two propositions A and B (written as $A land B$) is true if both the propositional variable A and B is true. The truth table is as follows − A B A ∧ B True True True True False False False True False False False False Negation ($lnot$) − The negation of a proposition A (written as $lnot A$) is false when A is true and is true when A is false. The truth table is as follows − A ¬ A True False False True Implication / if-then ($rightarrow$) − An implication $A rightarrow B$ is the proposition “if A, then B”. It is false if A is true and B is false. The rest cases are true. The truth table is as follows − A B A → B True True True True False False False True True False False True If and only if ($ Leftrightarrow $) − $A Leftrightarrow B$ is bi-conditional logical connective which is true when p and q are same, i.e. both are false or both are true. The truth table is as follows − A B A ⇔ B True True True True False False False True False False False True Tautologies A Tautology is a formula which is always true for every value of its propositional variables. Example − Prove $lbrack (A rightarrow B) land A rbrack rightarrow B$ is a tautology The truth table is as follows − A B A → B (A → B) ∧ A [( A → B ) ∧ A] → B True True True True True True False False False True False True True False True False False True False True As we can see every value of $lbrack (A rightarrow B) land A rbrack rightarrow B$ is “True”, it is a tautology. Contradictions A Contradiction is a formula which is always false for every value of its propositional variables. Example − Prove $(A lor B) land lbrack ( lnot A) land (lnot B) rbrack$ is a contradiction The truth table is as follows − A B A ∨ B ¬ A ¬ B (¬ A) ∧ ( ¬ B) (A ∨ B) ∧ [( ¬ A) ∧ (¬ B)] True True True False False False False True False True False True False False False True True True False False False False False False True True True False As we can see every value of $(A lor B) land lbrack ( lnot A) land (lnot B) rbrack$ is “False”, it is a contradiction. Contingency A Contingency is a formula which has both some true and some false values for every value of its propositional variables. Example − Prove $(A lor B) land (lnot A)$ a contingency The truth table is as follows − A B A ∨ B ¬ A (A ∨ B) ∧ (¬ A) True True True False False True False True False False False True True True True False False False True False As we can see every value of $(A lor B) land (lnot A)$ has both “True” and “False”, it is a contingency. Propositional Equivalences Two statements X and Y are logically equivalent if any of the following two conditions hold − The truth tables of each statement have the same truth values. The bi-conditional statement $X Leftrightarrow Y$ is a tautology. Example − Prove $lnot (A lor B) and lbrack (lnot A) land (lnot B) rbrack$ are equivalent Testing by 1st method (Matching truth table) A B A ∨ B ¬ (A ∨ B) ¬ A ¬ B [(¬ A) ∧ (¬ B)] True True True False False False False True False True False False True False False True True False True False False False False False True True True True Here, we can see the truth values of $lnot (A lor B) and lbrack (lnot A) land (lnot B) rbrack$ are same, hence the statements are equivalent. Testing by 2nd method (Bi-conditionality) A B ¬ (A ∨ B ) [(¬ A) ∧ (¬ B)] [¬ (A ∨ B)] ⇔ [(¬ A ) ∧ (¬ B)] True True False False True True False False False True False True False False True False False True True True
Boolean Expressions & Functions ”; Previous Next Boolean algebra is algebra of logic. It deals with variables that can have two discrete values, 0 (False) and 1 (True); and operations that have logical significance. The earliest method of manipulating symbolic logic was invented by George Boole and subsequently came to be known as Boolean Algebra. Boolean algebra has now become an indispensable tool in computer science for its wide applicability in switching theory, building basic electronic circuits and design of digital computers. Boolean Functions A Boolean function is a special kind of mathematical function $f: X^n rightarrow X$ of degree n, where $X = lbrace {0, 1} rbrace$ is a Boolean domain and n is a non-negative integer. It describes the way how to derive Boolean output from Boolean inputs. Example − Let, $F(A, B) = A’B’$. This is a function of degree 2 from the set of ordered pairs of Boolean variables to the set $lbrace {0, 1} rbrace$ where $F(0, 0) = 1, F(0, 1) = 0, F(1, 0) = 0$ and $F(1, 1) = 0$ Boolean Expressions A Boolean expression always produces a Boolean value. A Boolean expression is composed of a combination of the Boolean constants (True or False), Boolean variables and logical connectives. Each Boolean expression represents a Boolean function. Example − $AB’C$ is a Boolean expression. Boolean Identities Double Complement Law $sim(sim A) = A$ Complement Law $A + sim A = 1$ (OR Form) $A . sim A = 0$ (AND Form) Idempotent Law $A + A = A$ (OR Form) $A . A = A$ (AND Form) Identity Law $A + 0 = A$ (OR Form) $A . 1 = A$ (AND Form) Dominance Law $A + 1 = 1$ (OR Form) $A . 0 = 0$ (AND Form) Commutative Law $A + B = B + A$ (OR Form) $A. B = B . A$ (AND Form) Associative Law $A + (B + C) = (A + B) + C$ (OR Form) $A. (B . C) = (A . B) . C$ (AND Form) Absorption Law $A. (A + B) = A$ $A + (A . B) = A$ Simplification Law $A . (sim A + B) = A . B$ $A + (sim A . B) = A + B$ Distributive Law $A + (B . C) = (A + B) . (A + C)$ $A . (B + C) = (A . B) + (A . C)$ De-Morgan”s Law $sim (A . B) = sim A + sim B$ $sim (A+ B) = sim A . sim B$ Canonical Forms For a Boolean expression there are two kinds of canonical forms − The sum of minterms (SOM) form The product of maxterms (POM) form The Sum of Minterms (SOM) or Sum of Products (SOP) form A minterm is a product of all variables taken either in their direct or complemented form. Any Boolean function can be expressed as a sum of its 1-minterms and the inverse of the function can be expressed as a sum of its 0-minterms. Hence, F (list of variables) = ∑ (list of 1-minterm indices) and F” (list of variables) = ∑ (list of 0-minterm indices) A B C Term Minterm 0 0 0 x’y’z’ m0 0 0 1 x’y’z m1 0 1 0 x’yz’ m2 0 1 1 x’yz m3 1 0 0 xy’z’ m4 1 0 1 xy’z m5 1 1 0 xyz’ m6 1 1 1 xyz m7 Example Let, $F(x, y, z) = x” y” z” + x y” z + x y z” + x y z $ Or, $F(x, y, z) = m_0 + m_5 + m_6 + m_7$ Hence, $F(x, y, z) = sum (0, 5, 6, 7)$ Now we will find the complement of $F(x, y, z)$ $F” (x, y, z) = x” y z + x” y” z + x” y z” + x y” z”$ Or, $F”(x, y, z) = m_3 + m_1 + m_2 + m_4$ Hence, $F”(x, y, z) = sum (3, 1, 2, 4) = sum (1, 2, 3, 4)$ The Product of Maxterms (POM) or Product of Sums (POS) form A maxterm is addition of all variables taken either in their direct or complemented form. Any Boolean function can be expressed as a product of its 0-maxterms and the inverse of the function can be expressed as a product of its 1-maxterms. Hence, F(list of variables) = $pi$ (list of 0-maxterm indices). and F”(list of variables) = $pi$ (list of 1-maxterm indices). A B C Term Maxterm 0 0 0 x + y + z M0 0 0 1 x + y + z’ M1 0 1 0 x + y’ + z M2 0 1 1 x + y’ + z’ M3 1 0 0 x’ + y + z M4 1 0 1 x’ + y + z’ M5 1 1 0 x’ + y’ + z M6 1 1 1 x’ + y’ + z’ M7 Example Let $F(x, y, z) = (x + y + z) . (x+y+z”) . (x+y”+z) . (x”+y+z)$ Or, $F(x, y, z) = M_0 . M_1 . M_2 . M_4$ Hence, $F (x, y, z) = pi (0, 1, 2, 4)$ $F””(x, y, z) = (x+y”+z”) . (x”+y+z”) . (x”+y”+z) . (x”+y”+z”)$ Or, $F(x, y, z) = M_3 . M_5 . M_6 . M_7$ Hence, $F ”(x, y, z) = pi (3, 5, 6, 7)$ Logic Gates Boolean functions are implemented by using logic gates. The following are the logic gates − NOT Gate A NOT gate inverts a single bit input to a single bit of output. A ~A 0 1 1 0 AND Gate An AND gate is a logic gate that gives a high output only if all its inputs are high, otherwise it gives low output. A dot (.) is used to show the AND operation. A B A.B 0 0 0 0 1 0 1 0 0 1 1 1 OR Gate An OR
Discrete Mathematics – Sets
Discrete Mathematics – Sets ”; Previous Next German mathematician G. Cantor introduced the concept of sets. He had defined a set as a collection of definite and distinguishable objects selected by the means of certain rules or description. Set theory forms the basis of several other fields of study like counting theory, relations, graph theory and finite state machines. In this chapter, we will cover the different aspects of Set Theory. Set – Definition A set is an unordered collection of different elements. A set can be written explicitly by listing its elements using set bracket. If the order of the elements is changed or any element of a set is repeated, it does not make any changes in the set. Some Example of Sets A set of all positive integers A set of all the planets in the solar system A set of all the states in India A set of all the lowercase letters of the alphabet Representation of a Set Sets can be represented in two ways − Roster or Tabular Form Set Builder Notation Roster or Tabular Form The set is represented by listing all the elements comprising it. The elements are enclosed within braces and separated by commas. Example 1 − Set of vowels in English alphabet, $A = lbrace a,e,i,o,u rbrace$ Example 2 − Set of odd numbers less than 10, $B = lbrace 1,3,5,7,9 rbrace$ Set Builder Notation The set is defined by specifying a property that elements of the set have in common. The set is described as $A = lbrace x : p(x) rbrace$ Example 1 − The set $lbrace a,e,i,o,u rbrace$ is written as − $A = lbrace x : text{x is a vowel in English alphabet} rbrace$ Example 2 − The set $lbrace 1,3,5,7,9 rbrace$ is written as − $B = lbrace x : 1 le x lt 10 and (x % 2) ne 0 rbrace$ If an element x is a member of any set S, it is denoted by $x in S$ and if an element y is not a member of set S, it is denoted by $y notin S$. Example − If $S = lbrace1, 1.2, 1.7, 2rbrace , 1 in S$ but $1.5 notin S$ Some Important Sets N − the set of all natural numbers = $lbrace1, 2, 3, 4, …..rbrace$ Z − the set of all integers = $lbrace….., -3, -2, -1, 0, 1, 2, 3, …..rbrace$ Z+ − the set of all positive integers Q − the set of all rational numbers R − the set of all real numbers W − the set of all whole numbers Cardinality of a Set Cardinality of a set S, denoted by $|S|$, is the number of elements of the set. The number is also referred as the cardinal number. If a set has an infinite number of elements, its cardinality is $infty$. Example − $|lbrace 1, 4, 3, 5 rbrace | = 4, | lbrace 1, 2, 3, 4, 5, dots rbrace | = infty$ If there are two sets X and Y, $|X| = |Y|$ denotes two sets X and Y having same cardinality. It occurs when the number of elements in X is exactly equal to the number of elements in Y. In this case, there exists a bijective function ‘f’ from X to Y. $|X| le |Y|$ denotes that set X’s cardinality is less than or equal to set Y’s cardinality. It occurs when number of elements in X is less than or equal to that of Y. Here, there exists an injective function ‘f’ from X to Y. $|X| lt |Y|$ denotes that set X’s cardinality is less than set Y’s cardinality. It occurs when number of elements in X is less than that of Y. Here, the function ‘f’ from X to Y is injective function but not bijective. $If |X| le |Y|$ and $|X| ge |Y|$ then $|X| = |Y|$. The sets X and Y are commonly referred as equivalent sets. Types of Sets Sets can be classified into many types. Some of which are finite, infinite, subset, universal, proper, singleton set, etc. Finite Set A set which contains a definite number of elements is called a finite set. Example − $S = lbrace x 😐 😡 in N$ and $70 gt x gt 50 rbrace$ Infinite Set A set which contains infinite number of elements is called an infinite set. Example − $S = lbrace x : | : x in N $ and $ x gt 10 rbrace$ Subset A set X is a subset of set Y (Written as $X subseteq Y$) if every element of X is an element of set Y. Example 1 − Let, $X = lbrace 1, 2, 3, 4, 5, 6 rbrace$ and $Y = lbrace 1, 2 rbrace$. Here set Y is a subset of set X as all the elements of set Y is in set X. Hence, we can write $Y subseteq X$. Example 2 − Let, $X = lbrace 1, 2, 3 rbrace$ and $Y = lbrace 1, 2, 3 rbrace$. Here set Y is a subset (Not a proper subset) of set X as all the elements of set Y is in set X. Hence, we can write $Y subseteq X$. Proper Subset The term “proper subset” can be defined as “subset of but not equal to”. A Set X is a proper subset of set Y (Written as $ X subset Y $) if every element of X is an element of set Y and $|X| lt |Y|$. Example − Let, $X = lbrace 1, 2, 3, 4, 5, 6 rbrace$ and $Y = lbrace 1, 2 rbrace$. Here set $Y subset X$ since all elements in $Y$ are contained in $X$ too and $X$ has at least one element is more than set $Y$. Universal Set It is a collection of all elements in a particular context or application. All the sets in that context or application are
Discrete Mathematics – Quick Guide ”; Previous Next Discrete Mathematics – Introduction Mathematics can be broadly classified into two categories − Continuous Mathematics − It is based upon continuous number line or the real numbers. It is characterized by the fact that between any two numbers, there are almost always an infinite set of numbers. For example, a function in continuous mathematics can be plotted in a smooth curve without breaks. Discrete Mathematics − It involves distinct values; i.e. between any two points, there are a countable number of points. For example, if we have a finite set of objects, the function can be defined as a list of ordered pairs having these objects, and can be presented as a complete list of those pairs. Topics in Discrete Mathematics Though there cannot be a definite number of branches of Discrete Mathematics, the following topics are almost always covered in any study regarding this matter − Sets, Relations and Functions Mathematical Logic Group theory Counting Theory Probability Mathematical Induction and Recurrence Relations Graph Theory Trees Boolean Algebra We will discuss each of these concepts in the subsequent chapters of this tutorial. Discrete Mathematics – Sets German mathematician G. Cantor introduced the concept of sets. He had defined a set as a collection of definite and distinguishable objects selected by the means of certain rules or description. Set theory forms the basis of several other fields of study like counting theory, relations, graph theory and finite state machines. In this chapter, we will cover the different aspects of Set Theory. Set – Definition A set is an unordered collection of different elements. A set can be written explicitly by listing its elements using set bracket. If the order of the elements is changed or any element of a set is repeated, it does not make any changes in the set. Some Example of Sets A set of all positive integers A set of all the planets in the solar system A set of all the states in India A set of all the lowercase letters of the alphabet Representation of a Set Sets can be represented in two ways − Roster or Tabular Form Set Builder Notation Roster or Tabular Form The set is represented by listing all the elements comprising it. The elements are enclosed within braces and separated by commas. Example 1 − Set of vowels in English alphabet, $A = lbrace a,e,i,o,u rbrace$ Example 2 − Set of odd numbers less than 10, $B = lbrace 1,3,5,7,9 rbrace$ Set Builder Notation The set is defined by specifying a property that elements of the set have in common. The set is described as $A = lbrace x : p(x) rbrace$ Example 1 − The set $lbrace a,e,i,o,u rbrace$ is written as − $A = lbrace x : text{x is a vowel in English alphabet} rbrace$ Example 2 − The set $lbrace 1,3,5,7,9 rbrace$ is written as − $B = lbrace x : 1 le x lt 10 and (x % 2) ne 0 rbrace$ If an element x is a member of any set S, it is denoted by $x in S$ and if an element y is not a member of set S, it is denoted by $y notin S$. Example − If $S = lbrace1, 1.2, 1.7, 2rbrace , 1 in S$ but $1.5 notin S$ Some Important Sets N − the set of all natural numbers = $lbrace1, 2, 3, 4, …..rbrace$ Z − the set of all integers = $lbrace….., -3, -2, -1, 0, 1, 2, 3, …..rbrace$ Z+ − the set of all positive integers Q − the set of all rational numbers R − the set of all real numbers W − the set of all whole numbers Cardinality of a Set Cardinality of a set S, denoted by $|S|$, is the number of elements of the set. The number is also referred as the cardinal number. If a set has an infinite number of elements, its cardinality is $infty$. Example − $|lbrace 1, 4, 3, 5 rbrace | = 4, | lbrace 1, 2, 3, 4, 5, dots rbrace | = infty$ If there are two sets X and Y, $|X| = |Y|$ denotes two sets X and Y having same cardinality. It occurs when the number of elements in X is exactly equal to the number of elements in Y. In this case, there exists a bijective function ‘f’ from X to Y. $|X| le |Y|$ denotes that set X’s cardinality is less than or equal to set Y’s cardinality. It occurs when number of elements in X is less than or equal to that of Y. Here, there exists an injective function ‘f’ from X to Y. $|X| lt |Y|$ denotes that set X’s cardinality is less than set Y’s cardinality. It occurs when number of elements in X is less than that of Y. Here, the function ‘f’ from X to Y is injective function but not bijective. $If |X| le |Y|$ and $|X| ge |Y|$ then $|X| = |Y|$. The sets X and Y are commonly referred as equivalent sets. Types of Sets Sets can be classified into many types. Some of which are finite, infinite, subset, universal, proper, singleton set, etc. Finite Set A set which contains a definite number of elements is called a finite set. Example − $S = lbrace x 😐 😡 in N$ and $70 gt x gt 50 rbrace$ Infinite Set A set which contains infinite number of elements is called an infinite set. Example − $S = lbrace x : | : x in N $ and $ x gt 10 rbrace$ Subset A set X is a subset of set Y (Written as $X subseteq Y$) if every element of X is an element of set Y. Example 1 − Let, $X = lbrace 1, 2, 3, 4, 5, 6 rbrace$ and $Y = lbrace 1, 2 rbrace$. Here set Y is a subset of set X
Graph & Graph Models
Graph & Graph Models ”; Previous Next The previous part brought forth the different tools for reasoning, proofing and problem solving. In this part, we will study the discrete structures that form the basis of formulating many a real-life problem. The two discrete structures that we will cover are graphs and trees. A graph is a set of points, called nodes or vertices, which are interconnected by a set of lines called edges. The study of graphs, or graph theory is an important part of a number of disciplines in the fields of mathematics, engineering and computer science. What is a Graph? Definition − A graph (denoted as $G = (V, E)$) consists of a non-empty set of vertices or nodes V and a set of edges E. Example − Let us consider, a Graph is $G = (V, E)$ where $V = lbrace a, b, c, d rbrace $ and $E = lbrace lbrace a, b rbrace, lbrace a, c rbrace, lbrace b, c rbrace, lbrace c, d rbrace rbrace$ Degree of a Vertex − The degree of a vertex V of a graph G (denoted by deg (V)) is the number of edges incident with the vertex V. Vertex Degree Even / Odd a 2 even b 2 even c 3 odd d 1 odd Even and Odd Vertex − If the degree of a vertex is even, the vertex is called an even vertex and if the degree of a vertex is odd, the vertex is called an odd vertex. Degree of a Graph − The degree of a graph is the largest vertex degree of that graph. For the above graph the degree of the graph is 3. The Handshaking Lemma − In a graph, the sum of all the degrees of all the vertices is equal to twice the number of edges. Types of Graphs There are different types of graphs, which we will learn in the following section. Null Graph A null graph has no edges. The null graph of $n$ vertices is denoted by $N_n$ Simple Graph A graph is called simple graph/strict graph if the graph is undirected and does not contain any loops or multiple edges. Multi-Graph If in a graph multiple edges between the same set of vertices are allowed, it is called Multigraph. In other words, it is a graph having at least one loop or multiple edges. Directed and Undirected Graph A graph $G = (V, E)$ is called a directed graph if the edge set is made of ordered vertex pair and a graph is called undirected if the edge set is made of unordered vertex pair. Connected and Disconnected Graph A graph is connected if any two vertices of the graph are connected by a path; while a graph is disconnected if at least two vertices of the graph are not connected by a path. If a graph G is disconnected, then every maximal connected subgraph of $G$ is called a connected component of the graph $G$. Regular Graph A graph is regular if all the vertices of the graph have the same degree. In a regular graph G of degree $r$, the degree of each vertex of $G$ is r. Complete Graph A graph is called complete graph if every two vertices pair are joined by exactly one edge. The complete graph with n vertices is denoted by $K_n$ Cycle Graph If a graph consists of a single cycle, it is called cycle graph. The cycle graph with n vertices is denoted by $C_n$ Bipartite Graph If the vertex-set of a graph G can be split into two disjoint sets, $V_1$ and $V_2$, in such a way that each edge in the graph joins a vertex in $V_1$ to a vertex in $V_2$, and there are no edges in G that connect two vertices in $V_1$ or two vertices in $V_2$, then the graph $G$ is called a bipartite graph. Complete Bipartite Graph A complete bipartite graph is a bipartite graph in which each vertex in the first set is joined to every single vertex in the second set. The complete bipartite graph is denoted by $K_{x,y}$ where the graph $G$ contains $x$ vertices in the first set and $y$ vertices in the second set. Representation of Graphs There are mainly two ways to represent a graph − Adjacency Matrix Adjacency List Adjacency Matrix An Adjacency Matrix $A[V][V]$ is a 2D array of size $V times V$ where $V$ is the number of vertices in a undirected graph. If there is an edge between $V_x$ to $V_y$ then the value of $A[V_x][V_y]=1$ and $A[V_y][V_x]=1$, otherwise the value will be zero. And for a directed graph, if there is an edge between $V_x$ to $V_y$, then the value of $A[V_x][V_y]=1$, otherwise the value will be zero. Adjacency Matrix of an Undirected Graph Let us consider the following undirected graph and construct the adjacency matrix − Adjacency matrix of the above undirected graph will be − a b c d a 0 1 1 0 b 1 0 1 0 c 1 1 0 1 d 0 0 1 0 Adjacency Matrix of a Directed Graph Let us consider the following directed graph and construct its adjacency matrix − Adjacency matrix of the above directed graph will be − a b c d a 0 1 1 0 b 0 0 1 0 c 0 0 0 1 d 0 0 0 0 Adjacency List In adjacency list, an array $(A[V])$ of linked lists is used to represent the graph G with $V$ number of vertices. An entry $A[V_x]$ represents the linked list of vertices adjacent to the $Vx-th$ vertex. The adjacency list of the undirected graph is as shown in the figure below − Planar vs. Non-planar graph Planar graph − A graph $G$ is called a planar graph if it can be drawn in a plane without any edges crossed. If we draw graph in the plane without edge crossing, it
Discrete Mathematics – Home
Discrete Mathematics Tutorial PDF Version Quick Guide Resources Job Search Discussion Discrete Mathematics is a branch of mathematics involving discrete elements that uses algebra and arithmetic. It is increasingly being applied in the practical fields of mathematics and computer science. It is a very good tool for improving reasoning and problem-solving capabilities. This tutorial explains the fundamental concepts of Sets, Relations and Functions, Mathematical Logic, Group theory, Counting Theory, Probability, Mathematical Induction and Recurrence Relations, Graph Theory, Trees and Boolean Algebra. Audience This tutorial has been prepared for students pursuing a degree in any field of computer science and mathematics. It endeavors to help students grasp the essential concepts of discrete mathematics. Prerequisites This tutorial has an ample amount of both theory and mathematics. The readers are expected to have a reasonably good understanding of elementary algebra and arithmetic. Print Page Previous Next Advertisements ”;
Operators & Postulates
Operators & Postulates ”; Previous Next Group Theory is a branch of mathematics and abstract algebra that defines an algebraic structure named as group. Generally, a group comprises of a set of elements and an operation over any two elements on that set to form a third element also in that set. In 1854, Arthur Cayley, the British Mathematician, gave the modern definition of group for the first time − “A set of symbols all of them different, and such that the product of any two of them (no matter in what order), or the product of any one of them into itself, belongs to the set, is said to be a group. These symbols are not in general convertible [commutative], but are associative.” In this chapter, we will know about operators and postulates that form the basics of set theory, group theory and Boolean algebra. Any set of elements in a mathematical system may be defined with a set of operators and a number of postulates. A binary operator defined on a set of elements is a rule that assigns to each pair of elements a unique element from that set. For example, given the set $ A = lbrace 1, 2, 3, 4, 5 rbrace $, we can say $otimes$ is a binary operator for the operation $c = a otimes b$, if it specifies a rule for finding c for the pair of $(a,b)$, such that $a,b,c in A$. The postulates of a mathematical system form the basic assumptions from which rules can be deduced. The postulates are − Closure A set is closed with respect to a binary operator if for every pair of elements in the set, the operator finds a unique element from that set. Example Let $A = lbrace 0, 1, 2, 3, 4, 5, dots rbrace$ This set is closed under binary operator into $(ast)$, because for the operation $c = a ast b$, for any $a, b in A$, the product $c in A$. The set is not closed under binary operator divide $(div)$, because, for the operation $c = a div b$, for any $a, b in A$, the product c may not be in the set A. If $a = 7, b = 2$, then $c = 3.5$. Here $a,b in A$ but $c notin A$. Associative Laws A binary operator $otimes$ on a set A is associative when it holds the following property − $(x otimes y) otimes z = x otimes (y otimes z)$, where $x, y, z in A $ Example Let $A = lbrace 1, 2, 3, 4 rbrace$ The operator plus $( + )$ is associative because for any three elements, $x,y,z in A$, the property $(x + y) + z = x + ( y + z )$ holds. The operator minus $( – )$ is not associative since $$( x – y ) – z ne x – ( y – z )$$ Commutative Laws A binary operator $otimes$ on a set A is commutative when it holds the following property − $x otimes y = y otimes x$, where $x, y in A$ Example Let $A = lbrace 1, 2, 3, 4 rbrace$ The operator plus $( + )$ is commutative because for any two elements, $x,y in A$, the property $x + y = y + x$ holds. The operator minus $( – )$ is not associative since $$x – y ne y – x$$ Distributive Laws Two binary operators $otimes$ and $circledast$ on a set A, are distributive over operator $circledast$ when the following property holds − $x otimes (y circledast z) = (x otimes y) circledast (x otimes z)$, where $x, y, z in A $ Example Let $A = lbrace 1, 2, 3, 4 rbrace$ The operators into $( * )$ and plus $( + )$ are distributive over operator + because for any three elements, $x,y,z in A$, the property $x * ( y + z ) = ( x * y ) + ( x * z )$ holds. However, these operators are not distributive over $*$ since $$x + ( y * z ) ne ( x + y ) * ( x + z )$$ Identity Element A set A has an identity element with respect to a binary operation $otimes$ on A, if there exists an element $e in A$, such that the following property holds − $e otimes x = x otimes e$, where $x in A$ Example Let $Z = lbrace 0, 1, 2, 3, 4, 5, dots rbrace$ The element 1 is an identity element with respect to operation $*$ since for any element $x in Z$, $$1 * x = x * 1$$ On the other hand, there is no identity element for the operation minus $( – )$ Inverse If a set A has an identity element $e$ with respect to a binary operator $otimes $, it is said to have an inverse whenever for every element $x in A$, there exists another element $y in A$, such that the following property holds − $$x otimes y = e$$ Example Let $A = lbrace dots -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, dots rbrace$ Given the operation plus $( + )$ and $e = 0$, the inverse of any element x is $(-x)$ since $x + (x) = 0$ De Morgan”s Law De Morgan’s Laws gives a pair of transformations between union and intersection of two (or more) sets in terms of their complements. The laws are − $$(A cup B)” = A” cap B”$$ $$(A cap B)” = A” cup B”$$ Example Let $A = lbrace 1, 2, 3, 4 rbrace ,B = lbrace 1, 3, 5, 7 rbrace$, and Universal set $U = lbrace 1, 2, 3, dots, 9, 10 rbrace$ $A” = lbrace 5, 6, 7, 8, 9, 10 rbrace$ $B” = lbrace 2, 4, 6, 8, 9, 10 rbrace$ $A cup B = lbrace 1, 2,
Recurrence Relation
Discrete Mathematics – Recurrence Relation ”; Previous Next In this chapter, we will discuss how recursive techniques can derive sequences and be used for solving counting problems. The procedure for finding the terms of a sequence in a recursive manner is called recurrence relation. We study the theory of linear recurrence relations and their solutions. Finally, we introduce generating functions for solving recurrence relations. Definition A recurrence relation is an equation that recursively defines a sequence where the next term is a function of the previous terms (Expressing $F_n$ as some combination of $F_i$ with $i < n$). Example − Fibonacci series − $F_n = F_{n-1} + F_{n-2}$, Tower of Hanoi − $F_n = 2F_{n-1} + 1$ Linear Recurrence Relations A linear recurrence equation of degree k or order k is a recurrence equation which is in the format $x_n= A_1 x_{n-1}+ A_2 x_{n-1}+ A_3 x_{n-1}+ dots A_k x_{n-k} $($A_n$ is a constant and $A_k neq 0$) on a sequence of numbers as a first-degree polynomial. These are some examples of linear recurrence equations − Recurrence relations Initial values Solutions Fn = Fn-1 + Fn-2 a1 = a2 = 1 Fibonacci number Fn = Fn-1 + Fn-2 a1 = 1, a2 = 3 Lucas Number Fn = Fn-2 + Fn-3 a1 = a2 = a3 = 1 Padovan sequence Fn = 2Fn-1 + Fn-2 a1 = 0, a2 = 1 Pell number How to solve linear recurrence relation Suppose, a two ordered linear recurrence relation is − $F_n = AF_{n-1} +BF_{n-2}$ where A and B are real numbers. The characteristic equation for the above recurrence relation is − $$x^2 – Ax – B = 0$$ Three cases may occur while finding the roots − Case 1 − If this equation factors as $(x- x_1)(x- x_1) = 0$ and it produces two distinct real roots $x_1$ and $x_2$, then $F_n = ax_1^n+ bx_2^n$ is the solution. [Here, a and b are constants] Case 2 − If this equation factors as $(x- x_1)^2 = 0$ and it produces single real root $x_1$, then $F_n = a x_1^n+ bn x_1^n$ is the solution. Case 3 − If the equation produces two distinct complex roots, $x_1$ and $x_2$ in polar form $x_1 = r angle theta$ and $x_2 = r angle(- theta)$, then $F_n = r^n (a cos(ntheta)+ b sin(ntheta))$ is the solution. Problem 1 Solve the recurrence relation $F_n = 5F_{n-1} – 6F_{n-2}$ where $F_0 = 1$ and $F_1 = 4$ Solution The characteristic equation of the recurrence relation is − $$x^2 – 5x + 6 = 0,$$ So, $(x – 3) (x – 2) = 0$ Hence, the roots are − $x_1 = 3$ and $x_2 = 2$ The roots are real and distinct. So, this is in the form of case 1 Hence, the solution is − $$F_n = ax_1^n + bx_2^n$$ Here, $F_n = a3^n + b2^n (As x_1 = 3 and x_2 = 2)$ Therefore, $1 = F_0 = a3^0 + b2^0 = a+b$ $4 = F_1 = a3^1 + b2^1 = 3a+2b$ Solving these two equations, we get $ a = 2$ and $b = -1$ Hence, the final solution is − $$F_n = 2.3^n + (-1) . 2^n = 2.3^n – 2^n $$ Problem 2 Solve the recurrence relation − $F_n = 10F_{n-1} – 25F_{n-2}$ where $F_0 = 3$ and $F_1 = 17$ Solution The characteristic equation of the recurrence relation is − $$ x^2 – 10x -25 = 0$$ So $(x – 5)^2 = 0$ Hence, there is single real root $x_1 = 5$ As there is single real valued root, this is in the form of case 2 Hence, the solution is − $F_n = ax_1^n + bnx_1^n$ $3 = F_0 = a.5^0 + (b)(0.5)^0 = a$ $17 = F_1 = a.5^1 + b.1.5^1 = 5a+5b$ Solving these two equations, we get $a = 3$ and $b = 2/5$ Hence, the final solution is − $F_n = 3.5^n +( 2/5) .n.2^n $ Problem 3 Solve the recurrence relation $F_n = 2F_{n-1} – 2F_{n-2}$ where $F_0 = 1$ and $F_1 = 3$ Solution The characteristic equation of the recurrence relation is − $$x^2 -2x -2 = 0$$ Hence, the roots are − $x_1 = 1 + i$ and $x_2 = 1 – i$ In polar form, $x_1 = r angle theta$ and $x_2 = r angle(- theta),$ where $r = sqrt 2$ and $theta = frac{pi}{4}$ The roots are imaginary. So, this is in the form of case 3. Hence, the solution is − $F_n = (sqrt 2 )^n (a cos(n .sqcap /4) + b sin(n .sqcap /4))$ $1 = F_0 = (sqrt 2 )^0 (a cos(0 .sqcap /4) + b sin(0 .sqcap /4) ) = a$ $3 = F_1 = (sqrt 2 )^1 (a cos(1 .sqcap /4) + b sin(1 . sqcap /4) ) = sqrt 2 ( a/ sqrt 2 + b/ sqrt 2)$ Solving these two equations we get $a = 1$ and $b = 2$ Hence, the final solution is − $F_n = (sqrt 2 )^n (cos(n .pi /4 ) + 2 sin(n .pi /4 ))$ Non-Homogeneous Recurrence Relation and Particular Solutions A recurrence relation is called non-homogeneous if it is in the form $F_n = AF_{n-1} + BF_{n-2} + f(n)$ where $f(n) ne 0$ Its associated homogeneous recurrence relation is $F_n = AF_{n–1} + BF_{n-2}$ The solution $(a_n)$ of a non-homogeneous recurrence relation has two parts. First part is the solution $(a_h)$ of the associated homogeneous recurrence relation and the second part is the particular solution $(a_t)$. $$a_n=a_h+a_t$$ Solution to the first part is done using the procedures discussed in the previous section. To find the particular solution, we find an appropriate trial solution. Let $f(n) = cx^n$ ; let $x^2 = Ax + B$ be the characteristic equation of the associated homogeneous recurrence relation and let $x_1$ and $x_2$ be its roots. If $x ne x_1$ and $x ne x_2$, then $a_t = Ax^n$ If $x = x_1$, $x ne x_2$, then $a_t = Anx^n$ If