11 Boolean Algebra: Objectives
11 Boolean Algebra: Objectives
com
Chapter 11 Boolean Algebra
11 BOOLEAN
ALGEBRA
Objectives
After studying this chapter you should
• be able to use AND, NOT, OR and NAND gates;
• be able to use combinatorial and switching circuits;
• understand equivalent circuits;
• understand the laws of Boolean algebra;
• be able to simplify Boolean expressions;
• understand Boolean functions;
• be able to minimise circuits;
• understand the significance of half and full adder circuits.
11.0 Introduction
When George Boole (1815-186) developed an algebra for logic,
little did he realise that he was forming an algebra that has
become ideal for the analysis and design of circuits used in
computers, calculators and a host of devices controlled by
microelectronics. Boole's algebra is physically manifested in
electronic circuits and this chapter sets out to describe the
building blocks used in such circuits and the algebra used to
describe the logic of the circuits.
171
www.vagupu.com
NOT gate
The NOT gate is capable of reversing the input pulse. The truth
table for a NOT gate is as follows:
a ~a
Input Output
a ~a This is a NOT gate
0 1
1 0
The NOT gate receives an input, either a pulse (1) or no pulse (0)
and produces an output as follows :
If input a is 1, output is 0;
AND gate
The AND gate receives two inputs a and b, and produces an output
denoted by a∧ b . The truth table for an AND gate is as follows :
Input Output
a
a b a∧ b a∧b
b
0 0 0 This is an AND gate
0 1 0
1 0 0
1 1 1
The only way that the output can be 1 is when a AND b are both 1.
In other words there needs to be an electrical pulse at a AND b
before the AND gate will output an electrical pulse.
OR gate
Input Output
a b a∨ b
a
0 0 0 a∨b
b
0 1 1 This is an OR gate
1 0 1
1 1 1
172
www.vagupu.com
These three gates, NOT, AND and OR, can be joined together
to form combinatorial circuits to represent Boolean
expressions, as explained in the previous chapter.
Example
Use logic gates to represent
(a) ~ p∨ q
(b) ( x∨ y)∧ ~ x
Draw up the truth table for each circuit
Solution
(a) p q ~p ~ p∨ q
0 0 1 1
∼p
0 1 1 1 p
~p∨q
q
1 0 0 0
1 1 0 1
(b) x y x∨y ~x (x ∨ y) ∧ ~x
~x
0 0 0 1 0
(x∨y)∧ ~x
0 1 1 1 1 x (x∨y)
y
1 0 1 0 0
1 1 1 0 0
Exercise 11A
Use logic gates to represent these expressions and Write down the Boolean expression for each of the
draw up the corresponding truth tables. circuits below.
1. x∧ ( ~ y∨ x) 4. a
b
2. a∨ ( ~ b ∧ c)
c
3. [ a∨ ( ~ b ∨ c)]∧ ~ b
5.
p
q
173
www.vagupu.com
Example
Are these two combinatorial circuits equivalent?
a
a
b
b
Solution
The truth tables for both circuits will show if they are equivalent :
a b ~ ( a∧ b)
0 0 1
0 1 1 a
b
1 0 1
1 1 0
a b ~ a∨ ~ b
0 0 1
a
0 1 1
1 0 1 b
1 1 0
Work through the values in the truth tables for yourself. Since both
tables give the same results the two circuits are equivalent. Indeed
the two Boolean expressions are equivalent and can be put equal;
i.e. ~ ( a∧ b) = ~ a∨ ~ b
Exercise 11B
Show if these combinatorial circuits are equivalent by
working out the Boolean expression and the truth table
for each circuit.
1. a 2.
b a
b
a
a
b
b
174
www.vagupu.com
3. 4. a
a b
b c
a a
b b
c
One of the reasons for using switching circuits rather than logic
gates is that designers need to move from a combinatorial circuit
(used for working out the logic) towards a design which the
manufacturer can use for the construction of the electronic circuits.
A B C Circuit output
0 0 0 0
0 0 1 1
0 1 0 0
0 1 1 1
1 0 0 0
1 0 1 1
1 1 0 1
1 1 1 1
The table shows that there will be an output (i.e. 1) when A AND B
are 1 OR C is 1. This circuit can therefore be represented as
(A AND B) OR C
ie. (A ∧ B) ∨ C
175
www.vagupu.com
A
• a parallel circuit, often called an OR gate, A ∨ B.
B
The next step is to devise a way of representing negation. The
negation of the truth value 1 is 0 and vice versa, and in
switching circuits the negation of a 'closed' path is an 'open'
path.
A ~A
This circuit will always be 'open' whatever the state of A. In
other words the output will always be 0, irrespective of whether
A is 1 or 0. A
Example A B
Represent the circuit shown opposite symbolically and give the C ~A
switching table.
Solution
The symbolic representation can be built up by considering
the top line of the circuit (A ∧ B)
the top bottom of the circuit (C ∧ ~A).
A B C ~A A ∧B C∧ ~ A ( A ∧ B ) ∨ (C ∧ ~ A )
0 0 0 1 0 0 0
0 0 1 1 0 1 1
0 1 0 1 0 0 0
0 1 1 1 0 1 1
1 0 0 0 0 0 0
1 0 1 0 0 0 0
1 1 0 0 1 0 1
1 1 1 0 1 0 1
176
www.vagupu.com
A B C Output
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1
Exercise 11C
Represent the following circuits by Boolean
expressions:
B Draw switching circuits for these Boolean
1. A expressions:
D
~D C 3. A ∨ ( ~ B ∧ C )
4. A ∧ (( ~ B ∧ C ) ∨ ( B∧ ~ C ))
A
2. D
A C B
C
~D
177
www.vagupu.com
and a∧ b = b ∧ a
~ ( a∨ b) = ~ a∧ ~ b
and ~ ( a∧ b) = ~ a∨ ~ b
Two more laws complete the range of laws which are included
in the Boolean algebra.
178
www.vagupu.com
and a∧ ~ a = 0 a ~a 0
a b a∧ (a∨ b)
0 0 0
0 1 0
1 0 1
1 1 1
if a∧ ( a∨ b) = a
then a∧ ( a∨ b ∨ c) = a
and a∧ ( a∨ b ∨ c) ∧ ( a∨ b) ∧ ( b ∨ c) = a∧ ( b ∨ c) .
a a b
a b
c b c
Example
c b
Write down a Boolean expression for this circuit. Simplify the
a b c a
expression and draw the corresponding circuit. a d
179
www.vagupu.com
Solution
a∧ b ∧ ( a∨ c) ∧( b ∨ ( c∧ a) ∨ d)
a∧ ( a∨ c) ∧ b ∧ ( b ∨ ( c∧ a) ∨ d)
Since a∧ ( a∨ c) = a
and b ∧ ( b ∨ ( c∧ a) ∨ d) = b ,
an equivalent expression is a∧ b
a∧ b ∧ ( a∨ c) ∧ ( b ∨ ( c∧ a) ∨ d) = a∧ b
Exercise 11D
Simplify the following and check your answers by 3. Simplify the following circuit:
drawing up truth tables:
a b b a
1. a∨ ( ~ a∧ b)
2. a∧ [ b ∨ ( a∧ b)] ∧ [ a∨ ( ~ a∧ b)]
c c d d
f ( x1 ,x2 ,x3 ) = x1 ∧ ( ~ x2 ∨ x3 )
x1 ∧ ( ~ x2 ∨ x3 )
180
www.vagupu.com
Example
Draw the truth table for the Boolean function defined as
f ( x1 , x2 , x3 ) = x1 ∧ ( ~ x2 ∨ x3 )
Solution
The inputs and outputs of this Boolean function are shown in the
following table:
x1 x2 x3 f ( x1 ,x2 ,x3 )
0 0 0 0
0 0 1 0
0 1 0 0
0 1 1 0
1 0 0 1
1 0 1 1
1 1 0 0
1 1 1 1
Example
For the given truth table, form a Boolean function
a b c f ( a, b, c)
0 0 0 1
0 0 1 1
0 1 0 0
0 1 1 0
1 0 0 1
1 0 1 0
1 1 0 1
1 1 1 1
Solution
The first stage is to look for the places where f (a,b,c) is 1 and
then link them all together with 'OR's. For example, in the last
row f (a, b, c) = 1 and this is the row in which a, b and c are all
true; i.e. when a∧ b ∧ c= 1 .
181
www.vagupu.com
~ a∧ ~ b∧ ~ c= 1
( a∧ b ∧ c) ∨ ( a∧ b∧ ~ c) ∨ ( a∧ ~ b∧ ~ c) ∨ ( ~ a∧ ~ b ∧ c) ∨ ( ~ a∧ ~ b∧ ~ c)
If the values of a, b and c are as shown in the 1st, 2nd, 5th, 7th
and 8th row then the value of f ( a, b, c) = 1 in each case, and the
expression above has a value of 1. Similarly if a, b and c are as
shown in the table for which f ( a, b, c) = 0 then the expression
above has the value of 0.
f ( a, b, c) = ( a∧ b ∧ c) ∨ ( a∧ b∧ ~ c) ∨ ( a∧ ~ b∧ ~ c) ∨ ( ~ a∧ ~ b ∧ c) ∨ ( ~ a∧ ~ b∧ ~ c)
Exercise 11E
Find the disjunctive normal form of the Boolean
function for these truth tables:
1. a b f (a, b) 3. x y z f (x, y, z)
0 0 1 0 0 0 1
0 1 0 0 0 1 0
1 0 1 0 1 0 0
1 1 0 0 1 1 0
1 0 0 1
2. a b f (a, b)
1 0 1 0
0 0 1 1 1 0 0
0 1 1 1 1 1 1
1 0 0
1 1 1
182
www.vagupu.com
a
a b
b
a b a↑ b
0 0 1
0 1 1
1 0 1
1 1 0
a a∧b
~(a∧b)
b
Example
Use NAND gates alone to represent the function
f ( a, b, c, d) = ( a∧ b) ∨ ( c∧ d)
Solution
The use of NAND gates implies that there must be negation so
the function is rewritten using de Morgan's Laws:
( a∧ b) ∨ ( c∧ d) = ~ [( ~ a ∨ ~ b) ∧ ( ~ c ∨ ~ d)]
183
www.vagupu.com
a (~a∨~b)
b
f(a, b, c, d,)
c
d
(~c∨~d)
Example
Design combinatorial circuits to represent (a) the negation
function f ( x) =~ x and (b) the OR function f ( x, y) = x∨ y.
Solution
(a) ~ x = ~ ( x∨ x ) x ~x
= ~ x∧ ~ x
= x↑ x
(b) x∨ y = ~ ( ~ x ∧ ~ y) x
= ~ x↑ ~ y y
(
= x↑x ↑ y↑ y) ( )
Exercise 11F
Design circuits for each of the following using only
NAND gates.
1. a∧ b
2. a∧ ~ b
3. ( ~ a∧ ~ b)∨ ~ b
184
www.vagupu.com
When you are adding two numbers there are two results to note for
each column; the entry in the answer and the carrying figure.
254
178
432
11
When 4 is added to 8 the result is 12, 2 is noted in the answer and the
digit 1 is carried on to the next column.
When adding the second column the carry digit from the first column
is included, i.e. 5 + 7 + 1, giving yet another digit to carry on to the
next column.
Half adder
The half adder is capable of dealing with two inputs, i.e. it can only
add two bits, each bit being either 1 or 0.
a b Carry bit Answer bit
a
0 0 0 0 b
0 1 0 1
1 0 0 1
1 1 1 0 Carry Answer
bit bit
The first part of the circuit is shown opposite; complete the rest of the a
Carry bit
circuit which can be done with a NOT gate, an OR gate and an AND b
?
gate to give the answer bit. ?
Full Adder
A half adder can only add two bits; a full adder circuit is capable of
including the carry bit in the addition and therefore has three inputs.
1 1 1 111
1 1 0 110 +
1 1 0 1 1101
185
www.vagupu.com
Inputs
a b c Carry bit Answer bit a b
0 0 0 0 0
Full
0 0 1 0 1 carry bit c
adder
0 1 0
etc ↓ answer bit
1 1 1
a
b carry bit
answer bit
The dotted lines enclose the two half adders with the whole
circuit representing a full adder.
186
www.vagupu.com
(b) ( a∧ b)∨ ~ c 1 1 1 1 1
0 1 1 1 1
(c) ~ c∧ [( a∧ b)∨ ~ ( a∧ c)] 1 1 0 1 1
2. Write down the Boolean expression for each of 0 1 0 1 1
these circuits:
(a) 6. A burglar alarm for a house is controlled by a
p
switch. When the switch is on, the alarm sounds
q
if either the front or back doors or both doors are
opened. The alarm will not work if the switch is
r
off. Design a circuit of logic gates for the alarm
and draw up the corresponding truth table.
(b) p *7. A gallery displaying a famous diamond uses a
q special Security Unit to protect access to the
Display Room (D). The diagram below shows
the layout of the system.
r
D D
A B S S
(c) p
Y Z C
q
S S
r D D
The display cabinet (C) is surrounded by a screen
of electronic eyes (S).
3. Write down the Boolean expressions for these Access to the display room is through doors (Y),
circuits : (Z). Boxes (A), (B) are used in the system. The
(a) A following persons are involved in the system :
B Manager,
C C Deputy Manager,
Chief Security Officer.
~B The Display Room is opened as follows :
The Unit must be activated at box A.
(b) R
P Door (Y) is opened by any two of the
P
Q ~P above persons at box A.
S
~Q Box B is activated by the Manager and
Deputy Manager together.
The screen (S) is activated by the Chief
(c) A D
Security Officer alone at box B only.
C
Door (Z) can only be opened once the
B E
screen (S) is activated.
Draw a circuit of logic gates required inside the
4. Draw switching circuits for these Boolean Unit to operate it. Ensure your diagram is
expressions: documented.
(a) ( B ∧ C ) ∨ (C ∧ A ) ∨ ( A ∧ B ) (AEB)
(b) [ A ∧ (( B∧ ~ C ) ∨ ( ~ B ∧ C ))] ∨ ( ~ A ∧ B ∧ C )
187
www.vagupu.com
8. Simplify the following expressions and check 10. Design a circuit representing ~ a∨ b using
your answer by drawing up truth tables. NAND gates.
(a) ( a∧ b ∧ c) ∨ ( ~ a∧ b ∧ c) *11. Write a computer program or use a spreadsheet
that outputs a truth table for a given Boolean
(b) a∨ ( ~ a∧ b ∧ c) ∨ ( ~ a∧ b∧ ~ c) expression.
12. (a) Establish a truth table for the Boolean
(c) ( p ∧ q) ∨ ( ~ p∨ ~ q) ∧ ( r∨ s)
( )
function f x1 , x2, x3 = ( ~ x1 ∨ x2 ) ∧ ( ~ x3 ∨ x2 ) .
9. Find the disjunctive normal form of this function; (b) Design a circuit using as few AND, OR and
simplify and draw the combinatorial circuit. NOT gates as possible to model the function
a b c f ( a,b,c) in (a).
188