Boolean
Logic
Operations
Let x, y, z be Boolean
variables. Boolean variables can
only have binary values i.e., they can
have values which are either 0 or 1
For example, if we represent the state of
a light switch with a Boolean variable x,
we will assign a value of 0 to x when the
switch is OFF, and 1 when it is ON
A few other names for the states
of these Boolean variables
0 1
Off On
Low High
False True
We define the following logic operations
or functions among the Boolean variables
Name Example Symbolically
NOT y = NOT(x) x´
AND z = x AND y x·y
OR z = x OR y x+y
z = x XOR
x⊕y
y
We’ll define these operations with the help of
truth tables
what is the truth table
of a logic function
?
A truth table defines the output of a
logic function for all possible inputs
Truth Table for the NOT Operation
(y true whenever x is false)
x y = x´
0
1
Truth Table for the NOT Operation
x y = x´
0 1
1 0
Truth Table for the AND Operation
(z true when both x & y true)
x y z=x·y
0 0
0 1
1 0
1 1
Truth Table for the AND Operation
x y z=x·y
0 0 0
0 1 0
1 0 0
1 1 1
Truth Table for the OR Operation
(z true when x or y or both true)
x y z=x+y
0 0
0 1
1 0
1 1
Truth Table for the OR Operation
x y z=x+y
0 0 0
0 1 1
1 0 1
1 1 1
Truth Table for the XOR Operation
(z true when x or y true, but not both)
x y z=x⊕y
0 0
0 1
1 0
1 1
Truth Table for the XOR Operation
x y z=x⊕y
0 0 0
0 1 1
1 0 1
1 1 0
Those 4 were the fundamental logic operations.
Here are examples of a few more complex situations
z = (x + y)´
z = y · (x + y)
z = (y · x) ⊕
w
STRATEGY: Divide & Conquer
z = (x + y)´
x y x + y z = (x + y)´
0 0 0 1
0 1 1 0
1 0 1 0
1 1 1 0
z = y · (x + y)
x y x + y z = y · (x + y)
0 0 0 0
0 1 1 1
1 0 1 0
1 1 1 1
z = (y · x) ⊕ w
x y w y · x z = (y · x) ⊕
w
0 0 0 0 0
0 0 1 0 1
0 1 0 0 0
0 1 1 0 1
1 0 0 0 0
1 0 1 0 1
1 1 0 1 1
1 1 1 1 0
Number of rows in a truth table?
2 n
n = number of input variables
Assignment # 3
A. Convert the following into binary numbers:
i. The last three digits of your roll number
ii. 256
B. x, y & z are Boolean variables. Determine the truth
tables for the following combinations:
i. (x · y) + y
ii. (x ⊕ y)´ + w
What have we learnt today?
[Link] logic operations for Boolean variables, i.e.
NOT, OR, AND, XOR, NOR, NAND, XNOR
[Link] of truth tables (How many rows?)