Csa Unit-1 Final
Csa Unit-1 Final
Propositional Logic
Connectives are the operators that are used to combine one or more
propositions.
Negation Not ⌉ or ∼ or ‘ or –
Conjunction And 𝖠
Disjunction Or ∨
Conditional If-then →
Negation-
p ∼p
F T
T F
Example-
If p : It is raining
outside. Then,
Negation of p is-
∼p : It is not raining outside.
Conjunction-
p q p𝖠q
F F F
F T F
T F F
T T T
Example-
3. Disjunction-
If p and q are two propositions, then disjunction of p and q is a
proposition which is-
True when either one of p or q or both are true
False when both p and q are false
Truth Table-
p q p∨q
F F F
F T T
T F T
T T T
Example-
If p and q are two propositions where-
p:2+4=6
q : It is raining
outside Then, disjunction of
p and q is-
p ∨ q : 2 + 4 = 6 or it is raining outside
Conditional-
If p and q are two propositions, then-
Proposition of the type “If p then q” is called a conditional or
implication proposition.
It is true when both p and q are true or when p is false.
It is false when p is true and q is false.
Truth Table-
6 .
p q p→q
F F T
F T T
T F F
T T T
Examples-
If a = b and b = c then a = c.
If I will go to Australia, then I will earn more money.
Biconditional-
If p and q are two propositions, then-
Proposition of the type “p if and only if q” is called a biconditional or
bi- implication proposition.
It is true when either both p and q are true or both p and q are false.
p q p↔q
F F T
F T F
T F F
T T T
Examples-
He goes to play a match if and only if it does not rain.
Birds fly if and only if sky is clear.
The common binary connectives are:
qp ⊕ Exclusive or p x-or q
not or p nor q
qp↓
not and p n-and q
q
p | q or p ↑ q
In the conditional p → q, p is the antecedent and q is the consequent. The
conditional p → q is often read informally as “p implies q”.
Bi-
conditionals
DEFINITION 4
Let p and q be propositions. The bi-conditional statement p ↔ q is the
proposition “p if and only if q.” The bi-conditional statement p ↔ q is true
when p and q have the same truth values, and is false otherwise. Bi-
conditional statements are also called bi-implications.
T T T
T F F
F T F
F T
Example: Let p be the statement “You can take the flight,” and let q be the
statement “You buy a ticket.” Then p ↔ q is the statement
Answer “You can take the flight if and only if you buy a ticket.”
Precedence of Logical Operator
Operator precedence is an ordering of logical operators designed to allow
the dropping of parenthesis in logical expression.
Precedence of Logical
Operators
Operator Precedence
¬ 1
𝖠 2
∨ 3
→ 4
↔ 5
h
Bit Operators OR, AND, and XOR
Valu
x y x∨y x𝖠y x⊕y
e
T 1 0 0 0 0 0
F 0 0 1 1 0 1
1 0 1 0 1
DEFINITION 1 1 1 1 0
A bit string is a sequence of zero or
more bits. The length of this string is the number of bits in the string.
EXAMPLE Find the bitwise OR, bitwise AND, and bitwise XOR of the bit
strings 01 1011 0110 and 11 0001 1101.
Solution: The bitwise OR, bitwise AND, and bitwise XOR are:
01 1011 0110
11 0001 1101
11 1011 1111 Bitwise OR
01 0001 0100 Bitwise AND
10 1010 1011 Bitwise XOR
Propositional Equivalences
Tautologies and
contradictions
A compound proposition that is always true, regardless of the truth values of the
individual propositions involved, is called a tautology.
Example: 𝑝 ∨ ¬𝑝 is a tautology.
A compound proposition that is always false, regardless of the truth values of the
individual propositions involved, is called a contradiction.
Example: 𝑝 𝖠 ¬𝑝 is a contradiction.
A compound statement that is neither a tautology nor a contradiction is called a
contingency.
Logical Equivalences
Compound propositions that have the same truth values in all
possible cases are called logically equivalent.
The compound propositions p and q are called logically equivalent if
p ↔ q is a tautology. The notation p ≡ q denotes that p and q are
logically equivalent.
p ¬p p ∨ ¬p p 𝖠 ¬p
¬(p 𝖠 q) ≡ ¬p ∨ ¬q
Logica T F T F
l
F T T F
equiva ¬(p ∨ q) ≡ ¬p 𝖠 ¬q
l ence
The two algebraic expressions equal if they have the same value
for each possible value of the input variables.
For example, for all real numbers 𝑥, the left side and the right side
have the same value. 𝑥 2 − 1 = (𝑥 + 1) (𝑥 − 1)
The two compound statements 𝑝 and 𝑞 “equal” if they always
share the same truth value. 𝑝 ≡ 𝑞 means that 𝑝 ↔ 𝑞 is a
tautology.
In these equivalences, T denotes the compound proposition that is
always true and F denotes the compound proposition that is always
false.
Logical Equivalences
Equivalence Name
p𝖠T≡p Identity laws
p∨F≡p
p∨T≡T Domination laws
p𝖠F≡F
p∨p≡p Idempotent laws
p𝖠p≡p
¬(¬p) ≡ p Double negation law
p∨q≡q∨p Commutative laws
p𝖠q≡q𝖠p
(p ∨ q) ∨ r ≡ p ∨ (q ∨ Associative laws
r)
(p 𝖠 q) 𝖠 r ≡ p 𝖠 (q 𝖠
r)
p ∨ (q 𝖠 r) ≡ (p ∨ q) 𝖠 Distributive laws
(p
∨ r)
p 𝖠 (q ∨ r) ≡ (p 𝖠 q) ∨
(p
𝖠 r)
¬(p 𝖠 q) ≡ ¬p ∨ ¬q De Morgan’s laws
¬(p ∨ q) ≡ ¬p 𝖠 ¬q
p ∨ (p 𝖠 q) ≡ p Absorption laws
p 𝖠 (p ∨ q) ≡ p
p ∨ ¬p ≡ T Negation laws
p 𝖠 ¬p ≡ F
Logical Equivalences
involving
Conditional Statements.
p → q ≡ ¬p ∨ q
p → q ≡ ¬q →
¬p p ∨ q ≡ ¬p →
q
p 𝖠 q ≡ ¬(p → ¬q)
¬(p → q) ≡ p 𝖠 ¬q
(p → q) 𝖠 (p → r) ≡ p → (q
𝖠 r) (p → r) 𝖠 (q → r) ≡ (p ∨
q) → r
(p → q) ∨ (p → r) ≡ p → (q Logical Equivalences Involving
∨ r) (p → r) ∨ (q → r) ≡ (p 𝖠 Bi-conditional Statements.
q) →r p ↔ q ≡ (p → q) 𝖠 (q → p)
p ↔ q ≡ ¬p ↔ ¬q
p ↔ q ≡ (p 𝖠 q) ∨ (¬p 𝖠 ¬q)
¬(p ↔ q) ≡ p ↔ ¬q
Normal form
Observe that the max-term are the duals of min-terms. Therefore each
of the max-term has the truth value F for exactly one combination of the
truth values of the variables.
Predicates
For Example: Let P (x) denote the statement “x > 3.” What are the truth
values of P (4) and P (2)?
Solution: We obtain the statement P ―4‖ by setting x = 4 in the statement “x
> 3.” Hence, P ―4‖, which is the statement “4 > 3,” is true. However, P ―2‖,
which is the statement “2 > 3,”is false.
Quantifiers
The variable of predicates is quantified by quantifiers.
There are two types of quantifier in predicate logic − Universal Quantifier and
Existential Quantifier.
Example Let P (x) be the statement “x + 1 > x.” What is the truth value of the
quantification ∀ x P (x), where the domain consists of all real numbers?
Solution: Because P (x) is true for all real numbers x, the quantification ∀
x P (x) is True.
Existential Quantifier
Existential quantifier states that the statements within its scope are
true for some values of the specific variable. It is denoted by the symbol ∃.
∃x P(x) is read as for some values of x, P(x) is true.
Example
Let P (x) be the statement “x > 3” .What is the truth value of the
quantification ∃x P (x), where the domain consists of all real numbers?
Solution: x > 3 is true, when x = 4—the existential quantification of P (x), which is
∃x P (x), is true.
Precedence of Quantifiers
The quantifier’s ∀ and ∃ have higher precedence than all logical operators from
propositional calculus.
For example, ∀x P (x) ∨ Q(x) is the disjunction of ∀x P (x) and Q(x). In
other words, it means (∀x P (x)) ∨ Q(x) rather than ∀x (P (x) ∨ Q(x)).
Nested quantifiers, where one quantifier is within the scope of another, such as:
∀x ∃y (x + y = 0). Everything within the scope of a quantifier can be
thought of as a propositional function.
For example, ∀x ∃y(x + y = 0) is the same thing as ∀x Q(x), where Q(x) is
∃y P (x, y), where P (x, y) is x + y = 0.
Understanding Statements Involving Nested Quantifiers
For example, assume that the domain for the variables x and y consists of all real
numbers.
The statement ∀x ∀y(x + y = y + x) says that x + y = y + x for all real
numbers x and y. (Commutative law)
Likewise, the statement ∀x ∃y (x + y = 0) says that for every real
number x there is a real number y such that x+ y = 0. (Additive
Inverse)
Similarly, the statement ∀x ∀y ∀z(x+(y+ z) = (x + y) + z) (Associative law)
Example: Let Q(x, y) denote “x + y = 0.” What are the truth values of the
quantifications ∃y ∀x Q(x, y) and ∀x ∃y Q(x, y), where the domain for all
variables consists of all real numbers?
Solution: The quantification ∃y ∀x Q(x, y) denotes the proposition. “There
is a real number y such that for every real number x, Q(x, y‖.”
Quantification of two variables
∀x ∀y P(x, P(x, y) is true for every There is a pair x, y for which P(x,
y) pair x, y. y) is false.
∀y ∀x P(x,
y)
Important Definitions :
Rules of Inference :
Simple arguments can be used as building blocks to construct more
complicated valid arguments. Certain simple arguments that have been
established as valid are very important in terms of their usage. These
arguments are called Rules of Inference.
The most commonly used Rules of Inference are tabulated below
Similarly, we have Rules of Inference for quantified statements –
Resolution Principle :
To understand the Resolution principle, first we need to know certain definitions.
For example,
We can use the resolution principle to check the validity of arguments or deduce
conclusions from them. Other Rules of Inference have the same purpose, but
Resolution is unique. It is complete by it’s own. You would need no other
Rule of Inference to deduce the conclusion from the given argument.
To do so, we first need to convert all the premises to clausal form. The next
step is to apply the resolution Rule of Inference to them step by step until it
cannot be applied any further.
For example, consider that we have the following premises –
Venn diagrams
In Venn diagrams the universal set U, which contains all the objects
under consideration, is represented by a rectangle.
EXAMPLE 7 Draw a Venn diagram that represents V, the set of vowels in
the English alphabet.
U
A B
A
EXAMPLE Let A be the set of odd positive integers less than 10. Then |A| = 5.
Power Sets
DEFINITION 6 Given a set S, the power set of S is the set of all subsets of
the set S. The power set of S is denoted by P(S).
EXAMPLE What is the power set of the set {0, 1, 2}?
Solution: The power set P({0, 1, 2}) is the set of all subsets of {0, 1, 2}.
Hence, P({0, 1, 2}) = {∅,{0},{1},{2},{0, 1},{0, 2},{1, 2},{0, 1, 2}}.
Cartesian Products
The order of elements in a collection is often important. Because sets are
unordered, a different structure is needed to represent ordered
collections. This is provided by ordered n-tuples.
DEFINITION 7 The ordered n-tuple (a1, a2... a n) is the ordered collection
that has a1 as its first element, a2 as its second element... and a n as its nth
element.
DEFINITION 8 Let A and B be sets. The Cartesian product of A and B, denoted by A
× B, is the set of all ordered pairs (a, b), where a ∈ A and b ∈ B.
1. A𝖴B = {x: x ∈ A or x ∈ B}
Example: Let A = {1, 2, 3}, B= {3, 4, 5, 6}
A𝖴B = {1, 2, 3, 4, 5, 6}.
2. Intersection of Sets: Intersection of two sets A and B is the set of all
those elements which belong to both A and B and is denoted by A ∩ B.
1. A ∩ B = {x: x ∈ A and x ∈ B}
Example: Let A = {11, 12, 13}, B = {13,
14, 15} A ∩ B = {13}.
1. A - B = {x: x ∈ A and x ∉ B}
1. A ⨁ B = (A 𝖴 B) - (A ∩ B)
Example: Let A = {a, b, c,
d} B = {a, b, l, m}
A ⨁ B = {c, d, l, m}
Set Identities
EXAMPLE Use set builder notation and logical equivalences to establish the
first De Morgan law A ∩ B =A 𝖴 B.
= {x | x ∈ A 𝖴 B} definition of union
=A𝖴B
= (B 𝖴 C) ∩ A Commutative law
= (C 𝖴 B) ∩ A by the commutative law for unions.
Introductio
Inverse Relation
Let R be any relation from a set A to a set B. The inverse of R, denoted by
R−1, is the relation from B to A which consists of those ordered pairs
which, when reversed, belong to R; that is,
Mij = 0 if (ai,bj) ∉ R
1 if (ai,bj )∈ R
Example
Example
1. Let P = {1, 2, 3, 4}
2. Q = {a, b, c, d}
3. R = {(1, a), (2, a), (3, a), (1, b), (4, b), (4, c), (4, d)
The arrow diagram of relation R is shown in fig:
R2 = {(a, l), (a, n), (b, l), (b, m), (c, l), (c, m), (c, n)}
Find the composition of relation (i) R1 o R2 (ii) R1 1o R -1
Solution:
R1 o R2 = {(4, l), (4, n), (4, m), (5, l), (5, m), (5, n), (6, l), (6, m), (6, n)}
R1o R1-1 = {(4, 4), (5, 5), (5, 6), (6, 4), (6, 5), (4, 6), (6, 6)}
Composition of Relations and Matrices
There is another way of finding R◦S. Let MR and MS denote respectively the
matrix representations of the relations R and S. Then
Example
1. Let P = {2, 3, 4, 5}. Consider the relation R and S on P
defined by 2. R = {(2, 2), (2, 3), (2, 4), (2, 5), (3, 4), (3,
5), (4, 5), (5, 3)}
3. S = {(2, 3), (2, 5), (3, 4), (3, 5), (4, 2), (4, 3), (4, 5), (5, 2), (5, 5)}.
4.
5. Find the matrices of the above relations.
(iii) Multiply the matrix MS with MR to obtain the matrix MS x MR as shown in fig:
Example: If A = {1, 2, 3, 4} then R = {(1, 1) (2, 2), (1, 3), (2, 4), (3, 3), (3, 4), (4,
4)}. Is
a relation reflexive?
Solution: The relation is reflexive as for every a ∈ A. (a, a) ∈ R, i.e. (1, 1),
(2, 2), (3, 3), (4, 4) ∈ R.
Example: Let A = {1, 2, 3} and R = {(1, 2), (2, 2), (3, 1), (1, 3)}. Is the
relation R reflexive or irreflexive?
Example1: Let A = {1, 2, 3} and R = {(1, 1), (2, 2)}. Is the relation R
antisymmetric?
Solution: The relation R is antisymmetric as a = b when (a, b) and (b,
a) both belong to R.
Example2: Let A = {4, 5, 6} and R = {(4, 4), (4, 5), (5, 4), (5, 6), (4, 6)}.
Is the relation R antisymmetric?
Solution: The relation R is not antisymmetric as 4 ≠ 5 but (4, 5) and (5,
4) both belong to R.
Example1: Let A = {1, 2, 3} and R = {(1, 2), (2, 1), (1, 1), (2, 2)}. Is the
relation transitive?
Solution: The relation R is transitive as for every (a, b) (b, c) belong to R,
we have (a, c) ∈ R i.e, (1, 2) (2, 1) ∈ R ⇒ (1, 1) ∈ R.
Transitive (R) = {(1, 2), (2, 3), (3, 3), (1, 3)}
EQUIVALENCE RELATIONS
1) For every a ∈ S, a R a.
2) If a R b, then b R a.
3) If a R b and b R c, then a R c.
S is an equivalence relation; that is:
(1) a = a, for every a ∈ S.
(2) If a = b, then b = a.
(3) If a = b, b = c, then a = c.
Equivalence Relations and Partitions
This subsection explores the relationship between equivalence relations
and partitions on a non-empty set S.
Partition P of S is a collection {Ai} of nonempty subsets of S with the
following two properties:
Solution:
Reflexive: We have a divides a, ∀ a∈N. Therefore, relation 'Divides' is reflexive.
Antisymmetric: Let a, b, c ∈N, such that a divides b. It implies b divides a
iff a = b. So, the relation is antisymmetric.
3. If A ⊆ B and B ⊆ C then A ⊆ C
Consider the relation R on the set A. If it is also called the case that for all,
a, b ∈ A, we have either (a, b) ∈ R or (b, a) ∈ R or a = b, then the relation R
is known total order relation on set A.
Example: Show that the relation '<' (less than) defined on N, the set of +ve
integers is neither an equivalence relation nor partially ordered relation
but is a total order relation.
Solution:
Reflexive: Let a ∈ N, then a < a
⟹ '<' is not reflexive.
As, the relation '<' (less than) is not reflexive, it is neither an equivalence
relation nor the partial order relation.
Circular Relation
Consider a binary relation R on a set A. Relation R is called circular if (a,
b) ∈ R and (b, c) ∈ R implies (c, a) ∈ R.
(2) Product Rule Principle: Let A × B be the Cartesian product of sets A and
B. Then n (A × B) = n (A) · n (B)
MATHEMATICAL FUNCTIONS
Two important mathematical functions frequently used are:
Factorial Function
The product of the positive integers from 1 to n inclusive is denoted by n!,
read “n factorial.” Namely:
n! = 1 · 2 · 3 · ... · (n−2)(n−1)n = n(n−1)(n−2) · ... · 3 · 2 · 1
Accordingly, 1! = 1 and n! = n (n − l) !. It is also convenient to define 0! = 1.
(a) (b)
Figure there are more Pigeons than Pigeonholes
Proof: We prove the pigeonhole principle using a proof by contraposition.
Suppose that none of the k boxes contains more than one object. Then the
total number of objects would be at most k. This is a contradiction,
because there is at least k + 1 objects. The pigeonhole principle is also
called the Dirichlet drawer principle.
COROLLARY 1 A function f from a set with k + 1 or more elements to a set
with k elements is not one-to-one.
EXAMPLE Among any group of 367 people, there must be at least two with
the same birthday, because there are only 366 possible birthdays.
The Generalized Pigeonhole Principle
THEOREM 2 If N objects are placed into k boxes, then there is at least one
box containing at least N/k objects.
Proof: Suppose that none of the boxes contains more than N/k − 1 objects.
Then, the total number of objects is at most
K ( [ N/k ] – 1) < k ( ( N/ k + 1 ) –1) = N , where the inequality N/k < (N/k)
+ 1 has been used.
EXAMPLE
What is the minimum number of students required in a discrete
mathematics class to be sure that at least six will receive the same grade,
if there are five possible grades, A, B, C, D, and F?
Solution: The smallest integer N such that N/5 = 6. The smallest such
integer is N = 5 · 5 + 1 = 26.
Permutations and
Combinations Permutations
A permutation of a set of distinct objects is an ordered arrangement of
these objects. An ordered arrangement of r elements of a set is called an r-
permutation.
EXAMPLE Let S = {1, 2, 3}. The ordered arrangement 3, 1, 2 is a
permutation of S. The ordered arrangement 3, 2 is a 2-permutation of S.
The number of r-permutations of a set with n elements is denoted by P (n,
r). P (n, r) using the product rule.
THEOREM 1 If n is a positive integer and r is an integer with 1 ≤ r ≤ n, then
there are P (n, r) = n (n − 1)(n − 2)···(n − r + 1) r-permutations of a set
with n distinct elements.
EXAMPLE How many ways are there to select a first-prize winner, a second-
prize winner, and a third-prize winner from 100 different people who have
entered a contest?
Solution: Number of 3-permutations of a set of 100
elements. P (100, 3) = 100 · 99 · 98 = 970,200.
Combinations
An r-combination of elements of a set is an unordered selection of r
elements from the set. Thus, an r-combination is simply a subset of the set
with r elements.
EXAMPLE Let S be the set {1, 2, 3, 4}. Then {1, 3, 4} is a 3-combination from S.
The number of r-combinations of a set with n distinct elements is denoted
by C (n, r).
THEOREM 2 The number of r-combinations of a set with n elements, where
n is a nonnegative integer and r is an integer with 0 ≤ r ≤ n, equals C ―n, r‖
= n! / r! (n − r)!
EXAMPLE How many poker hands of five cards can be dealt from a
standard deck of 52 cards? Also, how many ways are there to select 47
cards from a standard deck of 52 cards?
r-permutations No n! / (n − r)!
r-permutations No n! / r! ( n − r)!
r-permutations Yes nr
Mathematical Induction
The process to establish the validity of an ordinary result involving natural
numbers is the principle of mathematical induction.
Working Rule
Let n0 be a fixed integer. Suppose P (n) is a statement involving the
natural number n and we wish to prove that P (n) is true for all n ≥n0.
12 + 22 + 32 +.......+ n2 =
Solution: For n = 1,
P (1) = 12 = =1
It is true for n = 1.
Induction Step: For n = r, ............. (i)
As (i), (ii), and (iii) all are true, hence P (n) is divisible by 133.
PROVING RESULTS ABOUT SETS
Mathematical induction can be used to prove many results about sets.
a•
X
X
59 . S
a•
X𝖴 {a}
T
FIGURE:
Generating subsets of a set with k+1elements.Here T = S 𝖴 {a}.
a c a
db e
b d c f
FIGURE Convex and Non-convex Polygons.
THEOREM 1 A simple polygon with n sides, where n is an integer with n ≥
3, can be triangulated into n − 2 triangles.
LEMMA 1 Every simple polygon with at least four sides has an interior diagonal.
Proof (of Theorem 1): We will prove this result using strong induction. Let
T (n) be the statement that every simple polygon with n sides can be
triangulated into n − 2 triangles.
BASIS STEP: T (3) is true because a simple polygon with three sides is a
triangle. Consequently, every simple polygon with n = 3 has can be
triangulated into n − 2 = 3 − 2 = 1triangle.
INDUCTIVE STEP: For the inductive hypothesis,T(j ) is true for all integers j
with 3 ≤ j ≤ k. That is, we assume that we can triangulate a simple polygon
with j sides into j − 2 triangles whenever 3 ≤ j ≤ k. To complete the
inductive step, we must show that when we assume the inductive
hypothesis, P (k + 1) is true, that is, that every simple polygon with k + 1
sides can be triangulated into (k + 1) − 2 = k − 1 triangles.
Proofs Using the Well-Ordering Property
The validity of both the principle of mathematical induction, strong
induction follows from a fundamental axiom of the set of integers, the well-
ordering property.
Thus, if an event can happen in m ways and fails to occur in n ways and
m+n ways is equally likely to occur then the probability of happening of
the event A is given by
Example: Two dice are tossed once. Find the probability of getting an
even number on first dice or a total of 8.
Solution: An even number can be got on a die in 3 ways because any one
of 2, 4, 6, can come. The other die can have any number. This can
happen in 6 ways.
∴ P (a total of 8) =
∴ Total Probability =
Theorem2: If A and B are two events that are not mutually exclusive,
then P(A 𝖴B)=P(A)+P(B)- P (A∩B).
Proof: Let n = total number of exhaustive
cases n1=number of cases
favorable to A n2= number of
cases favorable to B
n3= number of cases favorable to both A and B
But A and B are not mutually exclusive. Therefore, A and B can occur
simultaneously. So,n1+n2-n3 is the number of cases favorable to A or B.
(A∩B).
Example1: Two dice are tossed once. Find the probability of getting an
even number on first dice or a total of 8.
Solution: P(even number on Ist die or a total of 8) = P (even number on
Ist die)+P (total of 8)= P(even number on Ist die and a total of 8)
∴ Probability; P(total of 8) =
∴ Required Probability =
E: (4,6),(5,5),(5,6),(6,5),(6,6),(6,4)
F:
(1,2),(1,4),(1,6)
(2,1),(2,3),(2,5)
(3,2),(3,4),(3,6)
(4,1),(4,3),(4,5)
(5,2),(5,4),(5,6)
(6,1),(6,3),(6,5)
1. (A∩B) =∅ and (A𝖴B)=S
A, B are a mutually exclusive and exhaustive event.
Multiplication Theorem
Theorem: If A and B are two independent events, then the probability
that both will occur is equal to the product of their individual
probabilities.
P(A∩B)=P(A)xP(B)
Proof: Let event
A can happen is n1ways of which p are
successful B can happen is n2ways of which q
are successful
Now, combine the successful event of A with successful event of
B. Thus, the total number of successful cases = p x q
We have, total number of cases = n1 x
n2. Therefore, from definition of
probability
P (A and B) =P(A∩B)=
So, P(A∩B)=P(A)xP(B)
If, there are three independent events A, B and C, then
P(A∩B∩C)=P((A∩B)∩C)= P(A∩B)xP(C)
=P(A) x P(B) x P(C).
In general, if there are n independent events, then
Example: A bag contains 5 green and 7 red balls. Two balls are drawn. Find the
probability that one is green and the other is red.
P(B) =
CONDITIONAL PROBABILITY
RANDOM VARIABLES
Definition: A random variable X is a rule that assigns a numerical value to
each outcome in a sample space S.
EXAMPLE A pair of fair dice is tossed. The sample space S consists of the
36 ordered pairs (a, b) where a and b can be any of the integers from 1 to
6.
Solution: Let x assign to each point in S the sum of the numbers; then x is
a random variable with range space
Rx = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}
Let y assign to each point the maximum of the two numbers; then y is a
random variable with range space
R y = {1, 2, 3, 4, 5, 6}
Probability Distribution of a Random Variable
Theorem: Let S be an equiv.-probable space, and let f be the distribution of
a random variable X on S with the range space Rx = {x1, x2,...,x t}.
P i = f (x i) = No. of points in S whose image is x i /No. of points in S
EXAMPLE Let X be the random variable in Example 7.13 which assigns the
sum to the toss of a pair of dice. Note n(S) = 36, and Rx = {2, 3,..., 12}.
Solution: Using Theorem, we obtain the distribution f of X as
follows: f (2) = 1/36, since there is one outcome (1, 1) whose
sum is 2.
f (3) = 2/36, since there are two outcomes, (1, 2) and (2,1), whose sum is 3.
f (4) = 3/36, since there are three outcomes, (1, 3), (2, 2) and (3, 1), whose sum
is
4.
Similarly, f (5) = 4/36, f (6) = 5/36... f (12) = 1/36. Thus the distribution
of X follows:
x 2 3 4 5 6 7 8 9 10
F(x) 1/36 2/36 3/36 4/36 5/36 6/36 7/36 8/36 7/36
Binomial Distribution
Theorem: Consider the binomial distribution B (n, p). Then:
(i) Expected value E(X) = μ = n p.
Solution: Man will hit the target and the standard deviation σ.
Here p = 1/5 and so q = 4/5. Hence
μ = n p = 100 *1/5 = 20 and σ = √n p q =√ 100 *1/5 *4/5 = 4
Bayes' theorem in Artificial
intelligence Bayes' theorem:
Bayes' theorem is also known as Bayes' rule, Bayes' law, or Bayesian
reasoning, which determines the probability of an event with uncertain
knowledge.
In probability theory, it relates the conditional probability and marginal
probabilities of two random events.
Bayes' theorem was named after the British mathematician Thomas Bayes.
The Bayesian inference is an application of Bayes' theorem, which is
fundamental to Bayesian statistics.
It is a way to calculate the value of P(B|A) with the knowledge of P(A|B).
Bayes' theorem allows updating the probability prediction of an event by
observing new information of the real world.
Example: If cancer corresponds to one's age then by using Bayes'
theorem, we can determine the probability of cancer more accurately with
the help of age.
Bayes' theorem can be derived using product rule and conditional
probability of event A with known event B:
As from product rule we can write:
1. P(A ⋀ B)= P(A|B) P(B) or
The above equation (a) is called as Bayes' rule or Bayes' theorem. This
equation is basic of most modern AI systems for probabilistic inference.
It shows the simple relationship between joint and conditional probabilities. Here,
P(A|B) is known as posterior, which we need to calculate, and it will be
read as Probability of hypothesis A when we have occurred an evidence B.
P(B|A) is called the likelihood, in which we consider that hypothesis is true,
then we calculate the probability of evidence.
P(A) is called the prior probability, probability of hypothesis before
considering the evidence
P(B) is called marginal probability, pure probability of an evidence.
In the equation (a), in general, we can write P (B) = P(A)*P(B|Ai), hence the
Bayes' rule can be written as:
Where A1, A2, A3, ...... , An is a set of mutually exclusive and exhaustive events.
Applying Bayes' rule:
Bayes' rule allows us to compute the single term P(B|A) in terms of P(A|B),
P(B), and P(A). This is very useful in cases where we have a good
probability of these three terms and want to determine the fourth one.
Suppose we want to perceive the effect of some unknown cause, and want
to compute that cause, then the Bayes' rule becomes:
Example-1:
Question: what is the probability that a patient has diseases meningitis
with a stiff neck?
Given Data:
A doctor is aware that disease meningitis causes a patient to have a stiff
neck, and it occurs 80% of the time. He is also aware of some more facts,
which are given as follows:
o The Known probability that a patient has meningitis disease is 1/30,000.
o The Known probability that a patient has a stiff neck is 2%.
Let a be the proposition that patient has stiff neck and b be the proposition
that patient has meningitis. , so we can calculate the following as:
P(a|b) = 0.8
P(b) =
1/30000
P(a)= .02
Hence, we can assume that 1 patient out of 750 patients has meningitis
disease with a stiff neck.
Example-2:
Group
Let G be a non-void set with a binary operation * that assigns to each ordered pair
(a, b) of elements of G an element of G denoted by a * b. We say that G is a
group under the binary operation * if the following three properties are
satisfied:
Note: If a group has the property that a*b=b*a i.e., commutative law holds
then the group is called an abelian.
Properties of Groups:
The following theorems can understand the elementary features of
Groups: Theorem1:-
1. Statement: - In a Group G, there is only one identity element
(uniqueness of identity) Proof: - let e and e' are two identities in G and
let a ∈ G
∴ ae = a ⟶(i)
∴ ae' = a ⟶(ii)
R.H.S of (i) and (ii) are equal ⇒ae =ae'
Thus by the left cancellation law, we obtain e= e'
There is only one identity element in G for any a ∈ G. Hence the theorem is
proved.
Then ab = e and ac = e
∵ c = ce {existence of identity element}
⟹ c = c (ab) {∵ ab = e}
⟹ c = (c a) b
⟹ c = (ac) b { ∵ ac = ca}
⟹ c = eb
⟹ c = b { ∵ b = eb}
Hence inverse of a G is
unique. Theorem 2:-
1. Statement: - In a Group G,(a-1)-1=a,∀ a∈ G
i.e., (a-1)-1=a,∀ a∈ G
Proof: - By associatively we
Similarly
(ab) (b-1 a-1)=a(b b-1) a-1
⟹(ab) (b-1 a-1)=a (e) a-1
⟹(ab) (b-1 a-1)=a a-1
⟹(ab) (b-1 a-1)=e {∵aa-1=e}
Thus ( b-1 a-1)ab=(ab)(b-1 a-1)=e
∴ b-1 a-1 is the inverse of
ab i.e., b-1 a-1= a b-1
Hence the theorem is
proved. Theorem3:-
In a group G, the left and right cancellation laws hold i.e.
(i) ab = ac implies b=c
* e x
e e x
x x e
The group of order 3 has three elements i.e., one identity element and two
other elements.
Symmetric Group S n
A one-to-one mapping σ of the set {1, 2...n} onto itself is called a permutation. σ =
1 2 3_ _ _ n
j1 j2 j3_ _ _ j n
Cyclic Subgroup:-
A Subgroup K of a group G is said to be cyclic subgroup if there exists an
element x∈ G such that every element of K can be written in the form xn for
some n ∈Z.
Example: The group G= {1, -1, i,-i} under usual multiplication is a finite
cyclic group with i as generator, since i1=i,i2=-1,i3=-i and i4=1
Abelian Group:
Let us consider an algebraic system (G,*), where * is a binary operation
on G. Then the system (G,*) is said to be an abelian group if it satisfies all
the properties of the group plus a additional following property:
Example: Consider an algebraic system (G, *), where G is the set of all non-
zero real numbers and * is a binary operation defined by
Identity: To find the identity element, let us assume that e is a +ve real
number. Then e * a = a, where a ∈G.
Now to verify that this is the exact inverse, we will compute a * a-1 and
Isomorphism:
Let (G1,*) and (G2,0) be two algebraic system, where * and 0 both are
binary operations. The systems (G1,*) and (G2,0) are said to be isomorphic
if there exists an isomorphic mapping f: G1→G2
When two algebraic systems are isomorphic, the systems are structurally
equivalent and one can be obtained from another by simply remaining the
elements and operation.
Example: Let (A1,*) and (A2,⊡) be the two algebraic systems as shown in
fig. Determine whether the two algebraic systems are isomorphic.
Solution: The two algebraic system (A1,*) and (A2,⊡) are isomorphic and
(A2,⊡) is an isomorphic image of A1, such that
f( a)=1
f (b)=w
f (c)=
w2
Automorphism:
Let (G1,*) and (G2,0) be two algebraic system, where * and 0 both are
binary operations on G1 and G2 respectively. Then an isomorphism from
(G1,*) to (G2,0) is called an automorphism if G1= G2
Rings:
An algebraic system (R, +,) where R is a set with two arbitrary binary
operations + and ., is called aring if it satisfies the following conditions
3. Ring with Zero Divisions: If a.b=0, where a and b are any two non-
zero elements of R in the ring (R, +) then a and b are called divisions of
zero and the ring (R, +) is called ring with zero division.
SubRings:
A subset A of a ring (R, +) is called a subring of R, if it satisfies following
conditions: (A, +) is a subgroup of the group (R,+)
A is closed under the multiplication operation i.e., a.b ∈A,for every a,b ∈A.
Example: The ring (I, +) of integers is a subring of ring (R, +) of real numbers.
Note:
1. If R is any ring then {0} and R are subrings of R.
2. Sum of two subrings may not be a subring.
3. Intersection of subring is a subring.
SemiGroup
Let us consider, an algebraic system (A, *), where * is a binary operation
on A. Then, the system (A, *) is said to be semi-group if it satisfies the
following properties:
Solution: (a) Closure Property: The operation + is closed since the sum of
two natural numbers.
(b) Associative Property: The operation + is an associative property since
we have (a+b)+c=a+(b+c) ∀ a, b, c ∈ N.
(c) Identity: There exists an identity element in set N the operation +. The
element 0 is an identity element, i.e., the operation +. Since the operation +
is a closed, associative and there exists an identity. Hence, the algebraic
system (N, +) is a monoid.
SubMonoid:
Let us consider a monoid (M, o), also let S ⊆M. Then (S, o) is called a
submonoid of (M, o), if and only if it satisfies the following properties:
Homomorphism
a ∈ R. [R4]For any a , b ∈ R.
Example
The ring Z of integers is the classical example of a unique factorization
domain. The units of Z are 1 and −1.
(v) If d and d are monic polynomials such that d divides d and d divides d,
then d = d
Graph Theory
Graph:
Solution: The number of vertices of degree odd is 8, and each has a degree
three in the above graph. Hence, we have even number of vertices of odd
degrees.
96 .
Path:
A path of length n is a sequence of n+1 vertices of a graph in which each
pair of vertices is an edge of the graph.
4. Simple Circuit Path: The simple circuit is a simple path which is a circuit.
Example: Consider the graph shown in fig: Give an example of the following:
1. Pendant Vertices
2. Pendant Edges
3. Odd vertices
4. Even Vertices
5. Incident Edges
6. Adjacent Vertices
Solution:
1. The vertex V5is the pendant vertex.
2. The edge (V4,V5) or e5 is the pendant edge.
Solution: For this graph, the edge set {(V1,V5),(V7,V5)} is a cut set. After the
removal of the set, we have left with a disconnected subgraph. While after
the removal of any of its proper subset, we have left with a connected
subgraph.
Cut Points or Cut Vertices: Consider a graph G=(V, E). A cut point for a
graph G is a vertex v such that G-v has more connected components than G
or disconnected.
The subgraph G-v is obtained by deleting the vertex v from graph G and
also deleting the entire edges incident on v.
Example: Consider the graph shown in fig. Determine the
subgraphs (i)G-v1 (ii) G-v3 (iii) G-v5
Solution:
1. The subgraph G-v1 is shown in fig
Bridge (Cut Edges): Consider a graph G=(V, E).A bridge for a graph G, is an
edge e such that G-e has more connected components than G or
disconnected.
Example: Consider the graph shown in fig. Determine the subgraphs
(i) G-e1 (ii) G-e3 (iii) G-e4
Solution:
1. The subgraph G-e1 is shown in fig
1. Null Graph: A null graph is defined as a graph which consists only the
isolated vertices.
Example: The graph shown in fig is a null graph, and the vertices are
isolated vertices.
Degree of a Vertex
The degree of a vertex v in a graph G, written deg (v), is equal to the
number of edges in G which contain v, that is, which are incident on v.
Bipartite Graphs
DEFINITION: A simple graph G is called bipartite if its vertex set V can be
partitioned into two disjoint sets V1 and V2 such that every edge in the
graph connects a vertex in V1 and a vertex in V2.
K2, 3 K3, 3
A Sub-graph of K5
DEFINITION
The union of two simple graphs G1 = (V1, E1) G2 = (V2, E2) is the simple graph
with vertex set V1 𝖴 V2 and edge set E1 𝖴 E2. The union of G1 and G2 is
denoted by G1 𝖴 G2.
EXAMPLE: Find the union of the graphs G1 and G2.
Solution: The vertex set of the union G1 𝖴 G2 is the union of the two
vertex sets as: {a, b, c, d, e, f}.
a b c a b c a b c
d e d f d e f
G1 (a) G2 (b) G1𝖴 G2
FIGURE (a) The Simple Graphs G1 and G2; (b) Their Union G1 𝖴
G2 .
Isomorphism of Graphs
The simple graphs G1 = (V1, E1) and G2 = (V2, E2) are isomorphic.
u3 u4 v3
v4
Paths
A path is a sequence of edges that begins at a vertex of a graph and
travels from vertex to vertex along edges of the graph.
Let n be a nonnegative integer and G an undirected graph.
A path of length n from u to v in G is a sequence of n edges e1,...,e n of G.
The path is a circuit if it begins and ends at the same vertex, that is,
if u = v, and has length greater than zero.
Connectedness in Undirected Graphs
a b
c Figure: The Directed Graphs G and H
d e
Paths and Isomorphism
A path in a multi-graph G consists of an alternating sequence of vertices
and edges of the form
v0, e1, v1, e2, v2 ... e n−1, v n−1, e n, v n , where each edge e i contains the vertices
v i−1 and vi (which appear on the sides of e i in the sequence). The number n
of edges is called the length of the path. The path is said to be closed if v 0
= v n. Otherwise, we say the path is from v 0, to v n or between v 0 and v n, or
connects v0 to v n.
Isomorphic Graphs
Graphs G (V, E) and G (V ∗, E∗) are said to be isomorphic if there exists a
one-to- one correspondence f : V → V ∗ such that {u, v} is an edge of G if
and only if {f (u), f (v)} is an edge of G∗.
The graph in Figure (a) is connected, but the graph in Figure (b) is not
connected since, for example, there is no path between vertices D and E.
A DDD D
B
Figure: Multi-graph Model of the Town of Konigsberg
THEOREM 1: A connected multi-graph with at least two vertices has an
Euler circuit if and only if each of its vertices has even degree.
THEOREM 2: A connected multi-graph has an Euler path but not an Euler
circuit if and only if it has exactly two vertices of odd degree.
b a g f e
a
d c b c d
G1 G2
Figure: Two Undirected Graph
a b c d
d c a b
Hamilton Paths and Circuits
DEFINITION: A simple path in a graph G that passes through every vertex
exactly once is called a Hamilton path, and a simple circuit in a graph G
that passes through every vertex exactly once is called a Hamilton circuit.
That is, the simple path x0, x1...x n−1, x n in the graph G = (V, E) is a
Hamilton path if V = {x0, x1,...,x n−1, x n} and xi = x j for 0 ≤ i<j ≤ n, and the
simple circuit x 0, x1,...,x n−1, x n, x0 (with n > 0) is a Hamilton circuit if x0,
x1,...,x n−1, x n is a Hamilton path.
A B
Labeled and Weighted graphs
A graph G is called a labeled graph if its edges and/or vertices are
assigned data of one kind or another. In particular, G is called a weighted
graph if each edge e of G is assigned a non negative number w (e) called
the weight or length of v.
A1 A2 6 A3
3 2 2 7 2
1
3
P 22 Q
4 A4 6 A5 4 A6
K3 K4
0-Regular 1-Regular
Bipartite Graphs
A graph G is said to be bipartite if its vertices V can be partitioned into two
subsets M and N such that each edge of G connects a vertex of M to a
vertex of N.
By a complete bipartite graph, we mean that each vertex of M is connected
to each vertex of N; this graph is denoted by K m, n where m is the number of
vertices in M and n is the number of vertices in N, and, for standardization,
we will assume m ≤ n.
This theorem also tells us that a finite tree T with n vertices must have
n − 1 edges. For example, the tree in
Fig. 8-17(a) has 9 vertices and 8 edges, and the tree in Figure has 13
vertices and 12 edges.
Spanning Tree
A subgraph T of a connected graph G is called spanning tree of G if T is a
tree and T include all vertices of G.
Solution: Using kruskal's algorithm arrange all the edges of the weighted
graph in increasing order and initialize spanning tree T with all the six
vertices of G. Now start adding the edges of G in T which do not form a
cycle and having minimum weights until five edges are not added as there
are six vertices.
Step2:
Step3:
Step4:
Step5:
Step6: Edge (A, B), (D, E) and (E, F) are discarded because they will form
the cycle in a graph.
So, the minimum spanning tree form in step 5 is output, and the total cost is 18.
Example2: Find all the spanning tree of graph G and find which is the
minimal spanning tree of G shown in fig:
Solution: There are total three spanning trees of the graph G which are
shown in fig:
To find the minimum spanning tree, use the KRUSKAL'S ALGORITHM. The
minimal spanning tree is shown in fig:
The first one is the minimum spanning having the minimum weight = 11.
127 .
Planner Graphs
A graph or multi-graph which can be drawn in the plane so that its edges
do not cross is said to be planar.
A B
1. Consider first the utility graph; that is, three houses A1, A 2 and A3 are
to be connected to outlets for water, gas and electricity, B1, B2 and B3,
as in Figure.
2. Observe that this is the graph K3, 3 and it has p = 6 vertices and q = 9 edges.
B B
C D C E
A G A
D
F
E
FIGURE 2 Dual Graphs of the Maps in Figure 1
The fact that a rooted tree T gives a direction to the edges means
that we can give a precedence relationship between the vertices.
Specifically, we will say that a vertex u precedes a vertex v or that v
follows u if there is a (directed) path from v to u.
In particular, we say that v immediately follows u if (u, v) is an edge,
that is, if v follows u and v is adjacent to u.
EXAMPLE
Suppose Marc and Erik are playing a tennis tournament such that the first
person to win two games in a row or who wins a total of three games wins
the tournament. Find the number of ways the tournament can proceed.
Solution: The rooted tree in Figure (b) shows the various ways that the
tournament could proceed. There are 10 leaves which correspond to the
10 ways that the tournament can occur:
MM, MEMM, MEMEM, MEMEE, MEE, EMM, EMEMM, EMEME, EMEE, EE
Specifically, the path from the root to the leaf describes who won which
games in the particular tournament.
Ordered Rooted Trees
Consider a rooted tree T in which the edges leaving each vertex are
ordered. Then we have the concept of an ordered rooted tree.
Boolean algebra
Boolean
Functions
Boolean algebra provides the operations and the rules for working with the set {0,
1}.The complement of an element, denoted with a bar, is defined by bar 0
= 1and bar 1 = 0.
The Boolean sum, denoted by + or by OR, has the following
values: 1+ 1 = 1, 1 + 0 = 1, 0 + 1 = 1, 0 + 0 = 0
The Boolean product, denoted by · or by AND, has the following
values: 1· 1 = 1, 1 · 0 = 0, 0 · 1 = 0, 0 · 0 = 0
EXAMPLE 1 Find the value of 1 · 0 + (0 + 1).
Solution: 1 · 0 + (0 + 1) = 0 + 1 = 0 + 0 = 0.
EXAMPLE 2 Translate 1 · 0 + (0 + 1) = 0, the equality into a logical equivalence.
Solution:
(T 𝖠 F) ∨ ¬ (T ∨ F) ≡ F
Boolean Expressions and Boolean Functions
x y F(x, y)
1 1 0
1 0 1
0 1 0
0 0 0
The Boolean expressions in the variables x1, x2...x n are defined recursively
as 0, 1, x1, x 2...x n are Boolean expressions;
If E1 and E2 are Boolean expressions, then E1, (E1E2), and (E1 + E2) are Boolean
expressions.
Identities of Boolean algebra
Law of the double complement: x`` = x
Idempotent laws: x + x = x, x · x = x
Identity laws: x + 0 = x, x · 1 = x
Domination laws: x + 1 = 1, x · 0 = 0
Commutative laws: x + y = y + x, x y =
yx
Associative laws: x + (y + z) = (x + y) + z, x (y z) = (x
y)z Distributive laws: x + y z = (x + y)(x + z), x(y + z) =
x y + x z De Morgan’s laws: (x y) = x + y, (x + y) = x y
Absorption laws: x + x y = x, x (x +
y) = x Unit property: x + x = 1
Zero property x x = 0
EXAMPLE: Prove the absorption law x(x + y) = x using the other identities
of Boolean algebra.
Solution: x(x + y) = (x + 0) (x + y) Identity law for the Boolean sum
= x + 0 · y Distributive law
= x + y · 0 Commutative law
=x+0 Domination law
=x Identity law
Duality
The dual of a Boolean expression is obtained by interchanging Boolean
sums and Boolean products and interchanging 0s and 1s.
Identity laws: x ∨ 0 = x, x 𝖠 1 = x
Complement laws: x ∨ x = 1, x 𝖠 x
=0
Associative laws: (x ∨ y) ∨ z = x ∨ (y ∨ z), (x 𝖠 y) 𝖠 z = x 𝖠
(y 𝖠 z) Commutative laws: x ∨ y = y ∨ x, x 𝖠 y = y 𝖠 x
x y z F G
1 1 1 0 0
1 1 0 0 1
1 0 1 1 0
1 0 0 0 0
0 1 1 0 0
0 1 0 0 1
0 0 1 0 0
0 0 0 0 0
Linear Programming
Subject to: Ax ≤ b
Where A is a given q × n matrix, c is a given row vector of length n, and b is
a given column vector of length q.
Linear programming problem
A linear programming problem is one that is concerned with finding the
optimal value (maximum or minimum) of a linear function of several
variables (called objective function) subject to the conditions that:
1. The variables are non-negative and satisfy a set of linear inequalities (called
linear constraints).
2. Variables are sometimes called decision variables and are non-negative.
Objective function: Linear function Z = ax+ by, where a, b are constants,
which has to be maximized or minimized is called a linear objective
function.
Constraints: The linear inequalities or equations or restrictions on the
variables of a linear programming problem are called constraints.
Optimization problem: A problem which seeks to maximize or minimize a
linear function subject to certain constraints as determined by a set of
linear inequalities is called an Optimization problem.
The common region determined by all the constraints including the non-
negative constraints x ≥ 0, y ≥ 0 of a linear programming problem is called
feasible region (or solution region) for the problem.
Subject to:
2x1 + x2 + s3 = 300
3x1 + 9x2 + s4 = 509
4x1 + 7x2 +s5 = 812
x1, x2, s3, s4, s5 ≥
0 The profit Z = 60x1 + 70x2 i.e. Maximize 60x1
+ 70x2
The standard form can be summarized in a compact table form as
CB Basic CJ 6 70 0 0 0
0
Variables XB x1 x2 s3 s4 s5
0 s3 300 2 1 1 0 0
0 s4 509 3 4 0 1 0
0 s5 812 4 7 0 0 1
Z -60 -70 0 0 0 0
So, x 2 ≥ 509/9
Third equation: 4x1 + 7x2 +s5 =
812 4x1 + s5 = 812 - 7x2 (x1 = 0, s5 ≥
0)
812 - 7x2 ≥ 0
So, x2 ≥ 812/7
Therefore the three equations: x2 ≤ 300, x 2 ≥ 509/9, x2 ≥
812/7 Thus x2=Min (x2 ≤ 300, x 2 ≥ 509/9, x2 ≥ 812/7)
So, x2=Min (x2 ≤ 300/1, x 2 ≥ 509/9, x2 ≥ 812/7) = 116
Therefore x2 = 116, if x2=116, you may be note from the third
equation 7x2 +s5 = 812 i.e. s5=0 So, x2 = 812/7 = 116
Thus, the variable s5 becomes non-basic in the next
iteration. The other two basic variables are
S3=300 - x2 = 184
S4=509 - 4*116 =
45
Using the following rules the Table 2 is computed from the Table 1.
i. The revised basic variables are s3, s4 and x2. Accordingly, we make
CB1=0, CB2=0 and CB3=70.
ii. As x2 is the incoming basic variable we make the coefficient of x2
one by dividing each element of row-3 by 7. Thus the numerical
value of the element corresponding to x1 is 4/7, corresponding to s5
is 1/7 in Table 2.
iii. The incoming basic variable should appear only in the third row. So
we multiply the third-row of Table 2 by 1 and subtract it from the
first-row of Table 1 element by element. Thus the element
corresponding to x2 in the first-row of Table 2 is 0.
Therefore the element corresponding to x1 is 2-1*4/7=10/7 and the element
corresponding to s5 is 0-1*1/7=-1/7
In this way we obtain the elements of the first and the second row in
Table 2. In Table 2 the numerical values can also be calculated in a similar
way.
CB Basic CJ 60 70 0 0 0
Variables XB x1 x2 s3 s4 s5
0 s3 184 10/7 1 1 0 -1/7
0 s4 45 5/7 4 0 1 -4/7
0 s5 116 4/7 7 0 0 1/7
CB Basic Cj 60 70 0 0 0
Variables XB x1 x2 s3 s4 s5
0 s3 94 10/7 1 1 -2 1
0 s4 63 5/7 4 0 7/5 -4/5
0 s5 80 4/7 7 0 -4/5 3/5
Zj–Cj 0 0 0 28 -6
1. Now we apply rule (1) to Table 2. Here the only negative Z j-C j is
z1-c1 = - 140/7
2. We compute the minimum of the ratio
CB Basic CJ 60 70 0 0 0
Variables XB x1 x2 s3 s4 s5
0 s3 94 10/7 1 1 2 1
0 s4 691/5 5/7 4 4/5 -1/5 0
0 s5 118/5 4/7 7 -3/5 2/5 0
Zj–Cj 0 0 6 16 0
Thus, the objective function is maximized for x1 = 691/5 and x2=118/5 and the
maximum value of the objective function is 9944.
Key Terms
Basic Variable: Variable of a basic feasible solution has n non-negative value.
Non Basic Variable: Variable of a feasible solution has a value equal to zero.
Artificial Variable: A non-negative variable introduced to provide basic
feasible solution and initiate the simplex procedures.
Slack Variable: A variable corresponding to a ≤ type constraint is a non-
negative variable introduced to convert the inequalities into equations.
Surplus Variable: A variable corresponding to a ≥ type constraint is a
non- negative variable introduced to convert the constraint into equations.
Basic Solution: System of m-equation and n-variables i.e. m<n is a solution
where at least n-m variables are zero.
Basic Feasible Solution: System of m-equation and n-variables i.e. m<n is
a solution where m variables are non-negative and n-m variables are zero.
Optimum Solution: A solution where the objective function is minimized
or maximized.
DUAL LINEAR PROGRAMMING PROBLEMS
For every linear programming problem there is a corresponding
linear programming problem called the dual.
Dual Problem Formulation
If the original problem is in the standard form then the dual problem can be
formulated using the following rules:
The number of constraints in the original problem is equal to the
number of dual variables. The number of constraints in the dual
problem is equal to the number of variables in the original problem.
The original problem profit coefficients appear on the right hand side
of the dual problem constraints.
If the original problem is a maximization problem then the dual
problem is a minimization problem. Similarly, if the original problem
is a minimization problem then the dual problem is a maximization
problem.
The original problem has less than or equal to ―≤‖ type of constraints
while the dual problem has greater than or equal to ―≥‖ type
constraints.
The coefficients of the constraints of the original problem which
appear from left to right are placed from top to bottom in the
constraints of the dual problem and vice versa.
Simple Way of Solving Dual Problem
Minimize: P = x1 +
2x2 Subject to: x1 +
x2 ≥ 8
2x1 + x2
≥12 X1 ≥1
Solution: Step 1: Set up the P-matrix and its transpose
1 1 8 1 2 1 1
2 1 12 1 1 0 2
1 0 1 8 12 1 0
1 2 0
Step 2: Form the objective function and constraints for the dual
w1 + 2w 2 + w 1 ≤ 1
w1 + w 2 + w 1 ≤ 2
Z = 8w1 = 12w 2
+2
w1 W2 W3 S1 S2 g z
1 2 1 1 0 0 1
1 1 0 0 1 0 2
-8 -12 -1 0 0 1 0
The most negative number in the bottom row to the left of the last column
is -12. This establishes the pivot column. The smallest non- negative ratio
is ½.
Step 4: Pivoting
Pivoting about the 2 we get:
w1 W2 W3 S1 S2 g z
1 2 1 1 0 0 1
1/2 0 - - 1 0 3/2
-2 0 1/2 1/2 0 1 6
5 6
w1 W2 W3 S1 S2 g z
1/2 1 1/2 1/2 0 0 1/2
1 1 0 0 1 0 2
-8 -12 -1 0 0 1 0
The most negative entry in the bottom row to the left of the last
column is -2 Pivoting about the 1/ 2
w1 W2 W3 S1 S2 g z
1/2 1 1/2 1/2 0 0 1/2
1/2 0 - - 1 0 3/2
-2 0 1/2 1/2 0 1 6
5 6
Therefore, the optimum solution providing by x1 = 8 and x2 = 0
w1 W2 W3 S1 S2 g z
1 2 1 1 0 0 1
0 -1 -1 -1 1 0 1
0 4 7 8 0 1 8