Boolean Algebra
Boolean Algebra
Basic terminology
In the previous topic, we studied the branch of symbolic logic called propositional logic. One
of the earlier investigators of symbolic logic was George Boole, an English mathematician,
who invented a systematic way of manipulating logic symbols which became known as
𝐵𝐵𝐵𝐵𝐵𝐵𝐵𝐵𝐵𝐵𝐵𝐵𝐵𝐵 𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎. The striking feature of Boolean algebra, which distinguishes it from all
other branches of algebra, is that all the variables and constants must assume just one of two
values, which are usually called 𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡 and 𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓. It is also true that computers and most other
digital electronic devices do their work using only two symbols, which are usually called 𝑜𝑜𝑜𝑜𝑜𝑜
and 𝑧𝑧𝑧𝑧𝑧𝑧𝑧𝑧. In 1938 Claude Shannon, an American mathematician and engineer, discovered
that this is much more than just a coincidence, and that there is such a great similarity
between the way logicians reason and the way electronic devices calculate, that Boolean
algebra can be profitably applied to digital electronics. This section introduces the basics of
Boolean algebra. The key idea is that of a 𝐵𝐵𝐵𝐵𝐵𝐵𝐵𝐵𝐵𝐵𝐵𝐵𝐵𝐵 𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓.
Definition A Boolean function 𝑦𝑦 = 𝑓𝑓(𝑥𝑥1 , 𝑥𝑥2 , … , 𝑥𝑥𝑛𝑛 ) can assume either of the values 0 or 1, and that it
is a function of 𝑛𝑛 Boolean variables 𝑥𝑥1 , 𝑥𝑥2 , … , 𝑥𝑥𝑛𝑛 each of which is also assumes either of the values 0
or 1.
A Boolean function can be represented by 𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡ℎ 𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡. A Boolean variable is also called a 𝑏𝑏𝑏𝑏𝑏𝑏 (short
for 𝑏𝑏inary dig𝑖𝑖𝑖𝑖), e.g. input bit 𝑥𝑥, output bit 𝑦𝑦.
𝑥𝑥 𝑦𝑦 𝑧𝑧 𝑎𝑎 𝑏𝑏 𝑐𝑐
0 0 0 0 0 0
0 0 1 0 1 1
0 1 0 0 1 1
0 1 1 0 1 1
1 0 0 0 0 0
1 0 1 0 1 1
1 1 0 1 1 0
1 1 1 1 1 0
In fact any Boolean function of any number of Boolean variables can be built from basic logic gates.
Problem 2 Show that the logic circuit on the left in the following figure, which consists of three NOR
gates, is equivalent to one XOR gate.
Solution
The truth tables for the logic diagram shown in the left of the figure is given below.
𝑥𝑥 𝑦𝑦 𝑎𝑎 𝑏𝑏 𝑧𝑧
0 0 1 1 0
0 0 1 1 0
0 1 1 0 1
0 1 1 0 1
1 0 0 1 1
1 0 0 1 1
1 1 0 0 0
1 1 0 0 0
This table can be summerized as follows.
𝑥𝑥 𝑦𝑦 𝑧𝑧
0 0 0
0 1 1
1 0 1
1 1 0
What we obtained is truth table of XOR gate, which proves the claim.
2|Page
Discrete Mathematics • Handouts
Problem 3 Write Boolean algebra expression corresponding to the following two logic diagrams.
Boolean Algebra
a)
b)
Solution
Both of these fonctions involve two ANDs, one OR, and one NOT, but, as we will see thay are different.
a) Here the first operation is 𝑥𝑥𝑥𝑥; this quantity is then complemented; then ORed with 𝑧𝑧; and finally
ANDed with 𝑤𝑤. This sequence of operations is equivalent to the Boolean expression
𝑓𝑓 = �(𝑥𝑥𝑥𝑥
���) + 𝑧𝑧�𝑤𝑤.
b) Similar deductions yields
�������
𝑓𝑓 = 𝑥𝑥(𝑦𝑦 + 𝑧𝑧)𝑤𝑤.
Problem 4 Describe the Boolean functions represented in the following figure.
a)
4|Page
Discrete Mathematics • Handouts
b)
Solution
a) We could proceed by calculating the truth tables for the two functions, by assigning the Boolean
variables their 25 = 32 different values. But these two Boolean functions are, on reflection, so simple
that most of the work can be avoided. The 𝑓𝑓 is a very simple Boolean function – it is 0 for 31 out of
32 values while 𝑓𝑓 = 1 only if 𝑥𝑥 = 𝑦𝑦 = 𝑧𝑧 = 𝑣𝑣 = 𝑤𝑤 = 1. In the Boolean algebra notation 𝑓𝑓 can be
represented by the function
𝑓𝑓 = ��(𝑥𝑥𝑥𝑥)𝑧𝑧�𝑣𝑣� 𝑤𝑤.
However, because of associate low of Boolean algebra parentheses are not really necessary, and so
we can write instead
𝑓𝑓 = 𝑥𝑥𝑥𝑥𝑥𝑥𝑥𝑥𝑥𝑥.
b) Similarly, in the case of logic diagram composed of four OR gates, 𝑓𝑓 = 1 for 31 values of Boolean
variables and 𝑓𝑓 = 0 when 𝑥𝑥 = 𝑦𝑦 = 𝑧𝑧 = 𝑣𝑣 = 𝑤𝑤 = 0. In the Boolean algebra notation, we have
Of cause the functions described in Problem 4 can be generalized to more than five Boolean variables.
By collecting 𝑛𝑛 − 1 AND gates in a tree like in Problem 4, we can build a Boolean function of 𝑛𝑛
variables 𝑥𝑥1 , 𝑥𝑥2 , … , 𝑥𝑥𝑛𝑛 , which is 1 if and only if 𝑥𝑥1 = 𝑥𝑥2 = ⋯ = 𝑥𝑥𝑛𝑛 = 1. Likewise, we can build an OR
tree that will yield a Boolean function of 𝑛𝑛 variables 𝑦𝑦1 , 𝑦𝑦2 , … , 𝑦𝑦𝑛𝑛 , which is 0 if and only if 𝑦𝑦1 = 𝑦𝑦2 =
⋯ = 𝑦𝑦𝑛𝑛 = 0.
Boolean Algebra
Problem 5 Describe the Boolean functions represented by the following two logic circuits.
a) b)
Solution
a) Obviously, 𝑓𝑓 = 1 only if 𝑥𝑥 = 0, 𝑦𝑦 = 1, 𝑧𝑧 = 0, 𝑣𝑣 = 1, 𝑤𝑤 = 0, that is, current logic circuits accepts
01010 only.
b) It is clear that 𝑔𝑔 = 0 when 𝑥𝑥 = 1, 𝑦𝑦 = 0, 𝑧𝑧 = 1, 𝑣𝑣 = 0, 𝑤𝑤 = 1, meaning that this logic circuit rejects
10101 only.
The point of Problem 5 is that given any pattern of 0s and 1s, it is easy to build a circuit that each
accepts or rejects that sequence and no other. To build an “accepter” we use a multipoint AND gate,
and invert the inputs to the gate corresponding to the 0s in the given pattern. To build a “rejecter”,
we use “big” OR gate, and invert the inputs corresponding to the 1s in the given sequence. Circuits
like this occur so often in practice that a simplified notation for them is often used. Below we see this
notation for the gates of Problem 5. The idea is simply that the inverters are represented by small
circles.
Now we are ready to show how to build any Boolean function using only ANDs, ORs, and NOTs. Below
we illustrate this general technique based on particular Boolean function 𝑦𝑦 of three variables
𝑥𝑥1 , 𝑥𝑥2 , 𝑥𝑥3 , which is represented by its truth table as follows. The function 𝑦𝑦 accepts any of the three
input patterns (or signals) 001, 100, 101. So to build 𝑦𝑦, we first construct separate accepters for
these inputs.
Since we want 𝑦𝑦 to be 1 when input is 001 or 100 or 101, we connect the outputs of the three
accepters to one three-input OR gate as shown in the following figure. In Boolean algebra notation,
this circuit is represented by the equation
6|Page
Discrete Mathematics • Handouts
This expression for 𝑦𝑦 is called the minterm expansion or sum of the products or disjunctive normal
form for 𝑦𝑦. Minterm expansion for 𝑦𝑦 is one way how this function can analitically be represented. The
configuration of the variables that turn 𝑦𝑦 into 1 called truth set. Truth set of 𝑦𝑦 is {001,100,101}. There
exists another way to represent the same function. The following expression for 𝑦𝑦 is called maxterm
expansion or product of the sums or conjunctive normal form for 𝑦𝑦.
𝑦𝑦 = ( 𝑥𝑥1 + 𝑥𝑥2 + 𝑥𝑥3 )( 𝑥𝑥1 + 𝑥𝑥̅2 + 𝑥𝑥3 )( 𝑥𝑥1 + 𝑥𝑥̅2 + 𝑥𝑥̅3 )( 𝑥𝑥̅1 + 𝑥𝑥̅2 + 𝑥𝑥3 )( 𝑥𝑥̅1 + 𝑥𝑥̅2 + 𝑥𝑥̅3 ).
𝑥𝑥1
𝑥𝑥1 𝑥𝑥2
𝑥𝑥2 𝑥𝑥3
𝑥𝑥3
𝑦𝑦 𝑦𝑦
�𝑥𝑥 + �𝑦𝑦 ∙ (𝑦𝑦� + 𝑧𝑧)�� (𝑦𝑦� + 𝑧𝑧) = (𝑥𝑥 + 𝑦𝑦) ∙ (𝑦𝑦� + 𝑧𝑧).
Below we illustrate twenty-three laws of Boolean algebra both in primal and dual forms.
Twenty-three laws of Boolean algebra
Name of Law Primal Form Dual Form
Associative 𝑥𝑥 + (𝑦𝑦 + 𝑧𝑧) = (𝑥𝑥 + 𝑦𝑦) + 𝑧𝑧 𝑥𝑥(𝑦𝑦𝑦𝑦) = (𝑥𝑥𝑥𝑥)𝑧𝑧
Commutative 𝑥𝑥 + 𝑦𝑦 = 𝑦𝑦 + 𝑥𝑥 𝑥𝑥𝑥𝑥 = 𝑦𝑦𝑦𝑦
Distributive 𝑥𝑥(𝑦𝑦 + 𝑧𝑧) = 𝑥𝑥𝑥𝑥 + 𝑥𝑥𝑥𝑥 𝑥𝑥 + (𝑦𝑦𝑦𝑦) = (𝑥𝑥 + 𝑦𝑦)(𝑥𝑥 + 𝑧𝑧)
DeMorgan �������
𝑥𝑥 + 𝑦𝑦 = 𝑥𝑥̅ 𝑦𝑦� ��� = 𝑥𝑥̅ + 𝑦𝑦�
𝑥𝑥𝑥𝑥
Weak Absoption 1 + 𝑥𝑥 = 1 0 ∙ 𝑥𝑥 = 0
Strong Absorption 𝑦𝑦 + 𝑥𝑥𝑥𝑥 = 𝑦𝑦 𝑦𝑦(𝑥𝑥 + 𝑦𝑦) = 𝑦𝑦
Involution 𝑥𝑥̅̅ = 𝑥𝑥 𝑥𝑥̅̅ = 𝑥𝑥
Idempotency 𝑥𝑥 + 𝑥𝑥 = 𝑥𝑥 𝑥𝑥 ∙ 𝑥𝑥 = 𝑥𝑥
Complentarity 𝑥𝑥 + 𝑥𝑥̅ = 1 𝑥𝑥 ∙ 𝑥𝑥̅ = 0
Redundancy 𝑥𝑥 + 𝑥𝑥̅ 𝑦𝑦 = 𝑥𝑥 + 𝑦𝑦 𝑥𝑥(𝑥𝑥̅ + 𝑦𝑦) = 𝑥𝑥𝑥𝑥
(𝑥𝑥 + 𝑦𝑦)(𝑥𝑥̅ + 𝑧𝑧)(𝑦𝑦 + 𝑧𝑧)
Consensus 𝑥𝑥𝑥𝑥 + 𝑥𝑥̅ 𝑧𝑧 + 𝑦𝑦𝑦𝑦 = 𝑥𝑥𝑥𝑥 + 𝑥𝑥̅ 𝑧𝑧
= (𝑥𝑥 + 𝑦𝑦)(𝑥𝑥̅ + 𝑧𝑧)
Identity 𝑥𝑥 + 0 = 𝑥𝑥 𝑥𝑥 ∙ 1 = 𝑥𝑥
8|Page