Lectures Slides On Bolean Algebra
Lectures Slides On Bolean Algebra
COURSE INSTRUCTED
BY
Dr. Muhammad Sajjad
NUTECH, Islamabad.
Discrete Mathematics and its
Applications"
By
Kenneth H. Rosen
Truth Tables
Boolean algebra: Boolean algebra is a branch of mathematics that deals with
operations on logical values with binary variables. The concept of Boolean
algebra was first introduced by George Boole in his book “The Mathematical
Analysis of Logic,” and further expanded upon in his book “An Investigation of
the Laws of Thought.”
The distinguishing factor of Boolean algebra is that it deals only with the study
of binary variables. Most commonly Boolean variables are presented with the
possible values of 1 (“True”) or 0 (“False”). Variables can also have more
complex interpretations, such as in set theory. Boolean algebra is also known as
binary algebra.
The primary modern use of Boolean algebra is in computer programming
languages.
Elementary algebra: Elementary algebra deals with numerical operations, such
as addition, subtraction, multiplication, and division.
Boolean Operators:
There are three operators in Boolean algebra that we will use most are
complementation, the Boolean sum, and the Boolean product.
𝑝 𝑞
0 0
0 1
1 0
1 1
Possibilities of a statement for three variables:
Let 𝑝, 𝑞 and 𝑟 are three variables of a statements, then there
are 23 = 8 possibilities.
𝑝 𝑞 𝑟
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1
Possibilities of a statement for 𝒏 − 𝟏 variables:
Let 𝑝1 , 𝑝2 , 𝑝3 , . . . , 𝑝𝑛−1 are 𝑛 − 1 variables of a statement, then there
will 2𝑛−1 possibilities.
𝑝 𝒑
1 0
0 1
The Boolean Sum (Disjunction):
Disjunction
𝑝 𝑞 𝑝∨𝑞 =𝒑+𝒒
0 0 0
0 1 1
1 0 1
1 1 1
The Boolean Product (Conjunction):
Conjunction
𝑝 𝑞 𝑝 ∧ 𝑞 = 𝒑. 𝒒
0 0 0
0 1 0
1 0 0
1 1 1
Implication or Conditional
The implication of two statements 𝑝 and 𝑞 is denoted symbolically as
𝑝 → 𝑞 (𝑝 𝑖𝑚𝑝𝑙𝑖𝑒𝑠 𝑞). An implication is 0 only if 𝑝 is 1 and 𝑞 is 0. So, the
truth table of 𝑝 → 𝑞 is
𝑝 𝑞 𝑝→𝑞
0 0 1
0 1 1
1 0 0
1 1 1
Bi-conditional (if and only if):
Bi-conditional of two statements 𝑝 and 𝑞 is denoted symbolically as
𝑝 ↔ 𝑞 (𝑝 𝑖𝑓𝑓 𝑞). If both statement are same, then 1 otherwise 0. So,
the truth table of 𝑝 ↔ 𝑞 is
𝑝 𝑞 𝑝↔𝑞
0 0 1
0 1 0
1 0 0
1 1 1
Example: Construct the truth table for 𝐹 𝑥, 𝑦, 𝑧 = 𝑥. 𝑧 + 𝑦.
𝒙 𝒚 𝒛 𝑧 𝑥. 𝑧 𝐹 𝑥, 𝑦, 𝑧 = 𝑥. 𝑧 + 𝑦
0 0 0 1 0 0
0 0 1 0 0 0
0 1 0 1 0 1
0 1 1 0 0 1
1 0 0 1 1 1
1 0 1 0 0 0
1 1 0 1 1 1
1 1 1 0 0 1
Tautologies: A statement which is 1 for all the possible values of the
variables involved in it is called a tautology.
Example: Let 𝐹 𝑝, 𝑞 = [ 𝑝 → 𝑞 . 𝑝] → 𝑞
𝑝 𝑞 𝑝→𝑞 𝑝 → 𝑞 .𝒑 𝐹 𝑝, 𝑞 = [ 𝑝 → 𝑞 . 𝑝] → 𝑞
0 0 1 0 1
0 1 1 0 1
1 0 0 0 1
1 1 1 1 1
Hence 𝐹 𝑝, 𝑞 = [ 𝑝 → 𝑞 . 𝑝] → 𝑞 is tautology.
Absurdity or Contradiction: A statement which is always 0 is called an
absurdity or a contradiction.
Example: Let 𝐹 𝑥 = 𝑝 → 𝑝 be a statement,
𝑝 𝒑 𝑭 𝒑 =𝑝↔𝑝
1 0 0
0 1 0
Hence 𝐹 𝑥 = 𝑝 → 𝑝 is Absurdity.
Contingency:
A statement which can be 1 or 0 depending upon the truth values of
the variables involved in it is called a contingency.
Example: Let 𝐹 𝑥, 𝑦, 𝑧 = 𝑥 . 𝑧 + 𝑦 be a statement, then the given
statement is the example of contingency.
𝒙 𝒚 𝒛 𝑧 𝑥. 𝑧 𝐹 𝑥, 𝑦, 𝑧 = 𝑥. 𝑧 + 𝑦
0 0 0 1 0 0
0 0 1 0 0 0
0 1 0 1 0 1
0 1 1 0 0 1
1 0 0 1 1 1
1 0 1 0 0 0
1 1 0 1 1 1
1 1 1 0 0 1
Exercise 1 Practice Questions
Conversion into Logical Form
The operations of sets are Union (∪), Intersection (∩) and
compliment. It can be convert into logical form OR (+), AND . and
Bar.
Example1: Let 𝐴 ∪ 𝐵 ∩ 𝐶 = (𝐴 ∪ 𝐵) ∩ (𝐴 ∪ 𝐶) convert into logical
form 𝐴 + 𝐵. 𝐶 = 𝐴 + 𝐵 . (𝐴 + 𝐶).
Example2: Let 𝐴 ∪ 𝐵 ′ = 𝐴′ ∩ 𝐵′ convert into logical form
𝐴 + 𝐵 = 𝐴 + 𝐵.
Exercise 2
Practice Questions
Exercise 3
Practice Questions
Simple and Compound Propositions
Proposition (Statement)
A declarative sentence that is either true or false, but not both.
Examples:
• CS19 is a required course for the CS major.
• Tolkien wrote The Lord of the Rings.
• Pigs can fly.
Non-examples:
• What is your name.
• What a beautiful evening
• Do your homework.
Simple Proposition
A simple statement is one that does not contain another statement as a
component.
Examples: Suppose there are two prepositions.
1) I am eating.
2) I am sleeping.
Such individual statements are called simple prepositions and we do
not need to write them every time. Instead, we can assign an alphabet
to each of these statements.
𝑝 =I am eating.
𝑞 =I am sleeping.
Compound Proposition
A compound statement contains at least one simple statement as a
component, along with a logical operator, or connectives
Examples:
1) I am eating and I am sleeping= 𝑝 ∧ q = p. q
2) I am eating or I am sleeping= 𝑝 ∨ 𝑞 = p + q
Example: If it is sunny outside then I walk to work; otherwise, I drive, and if it
is raining then I carry my umbrella.
This consists of several primitive propositions:
𝑝 = It is sunny outside,
𝑞 = I walk to work
𝑟 = I drive
𝑠 = it is raining
𝑡 = I carry my umbrella
If 𝑝 then 𝑞, otherwise 𝑟 and if 𝑠 then 𝑡.
If 𝑝 then 𝑞 and (if not 𝑝 then (𝑟 and (if 𝑠 then 𝑡))).
𝑝 implies 𝑞 and ((not 𝑝) implies (𝑟 and (𝑠 implies 𝑡))).
𝑝 → 𝑞 ∧ 𝑝 → (𝑟 ∧ 𝑠 → 𝑡 ))
Exercise 4 Practice Questions