You are on page 1of 16

Module: Computer Number Systems and

Boolean Algebra
Boolean Algebra
Digital logic circuits are an important part of modern technology. In today’s world, electronics
are based on logic gates. We will now examine the basic building blocks of any logic system,
the AND, OR and NOT functions. We will also learn to relate between logic diagrams and
logic expressions, and how to construct truth tables to verify accuracy.

Logic Gates, Truth Tables and Boolean Expressions


Logic Variables
Boolean algebra is used in manipulating logic variables. A variable is either completely true or
completely false (partially true or partially false are not allowed). Because of this, Boolean algebra
is suited to variables that have two states, such as YES or NO answers, or the binary number
system where answers are either 0 or 1.

An appropriate example could be a switch. We can consider a switch a two-state variable because
it is either off or on. Digital inputs have two possible values and are Boolean in nature.

Voltage is present: Voltage is not present:


On Off
True False
Closed Open
High Low
1 0
Module: Computer Number Systems and Boolean Algebra

Logic Operations

We have 3 main logic gates that alter our inputs to produce specific output:

1. The conjunction (logical product), commonly called AND, symbolized by (⋅) Ex: 𝐴𝐴 ⋅ 𝐵𝐵
2. The disjunction (logical sum), commonly called OR, symbolized by (+) Ex: 𝐴𝐴 + 𝐵𝐵
3. The negation, commonly called NOT, symbolized by ( � ) Ex: 𝐴𝐴̅

From these we have negations:

1. NAND (not AND) ����


Ex: 𝐴𝐴𝐴𝐴
2. NOR (not OR) ��������
Ex: 𝐴𝐴 + 𝐵𝐵

As well we have exclusives:


1. XOR (exclusive OR), symbolized by (⊕) Ex: 𝐴𝐴 ⊕ 𝐵𝐵
2. XNOR (not exclusive OR) Ex: ��������
𝐴𝐴 ⊕ 𝐵𝐵

2
Module: Computer Number Systems and Boolean Algebra

The AND Function


FACT: For the AND function, the output is true only when ALL inputs are true. Otherwise, the
output is false. Note: 𝐴𝐴 ⋅ 𝐵𝐵 = 𝐴𝐴𝐴𝐴.

Below is a figure representing a two-input AND gate, where A and B are the input variables:
(a) logic symbol; (b) truth table.

a) A b) Condition A B 𝐴𝐴𝐴𝐴
𝐴𝐴𝐴𝐴
B 1 0 0 0
2 0 1 0
3 1 0 0
4 1 1 1

Truth tables are used to show ALL possible outcomes. Remember 𝐴𝐴𝐴𝐴 is only true when both A
AND B are both true.

Example: Construct a truth table using 0s and 1s (binary system) showing a three-input AND
gate. How many conditions produce a TRUE output?

𝑨𝑨 𝑩𝑩 𝑪𝑪 𝑨𝑨𝑨𝑨𝑨𝑨
0 0 0 A
0 0 1 B 𝐴𝐴𝐴𝐴𝐴𝐴
C
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1

3
Module: Computer Number Systems and Boolean Algebra

The OR Function
FACT: For the OR function, the output is true when any of the inputs is true. Otherwise, the
output is false.

Below is a figure representing a two-input AND gate, where A and B are the input variables:
(a) logic symbol; (b) truth table

a) A b) Condition A B 𝐴𝐴 + 𝐵𝐵
𝐴𝐴 + 𝐵𝐵
B 1 0 0 0
2 0 1 1
3 1 0 1
4 1 1 1

The NOT Function


FACT: For the NOT function, the output is the complement of the input.

The complement is best described as simply the opposite. If the condition is true, then the
complement is false; if the condition is false, the complement is true. Since Boolean systems are
one or the other (and that’s it), the complement is the opposite. A logic circuit producing the NOT
function is called an inverter.

Below is a figure representing an inverter, where A is the input variable: (a) logic symbol;
(b) truth table

𝐴𝐴 𝐴𝐴̅
𝐴𝐴 𝐴𝐴̅ 1 0
0 1

𝐴𝐴̅ 𝐴𝐴

4
Module: Computer Number Systems and Boolean Algebra

The XOR Function


FACT: The XOR function (exclusive-OR function) represents the inequality function, ie. the output
is true if the inputs are not alike, otherwise the output is false.

Below is a figure representing a two-input XOR gate, where A and B are the input variables: (a)
logic symbol; (b) truth table.

a) A b) Condition A B 𝐴𝐴 ⊕ 𝐵𝐵
𝐴𝐴 ⊕ 𝐵𝐵
B
1 0 0 0
2 0 1 1
3 1 0 1
4 1 1 0

Example: Draw the logic diagrams that represent the following Boolean expressions.

a) 𝐵𝐵 + 𝐶𝐶̅

b) (𝐴𝐴̅𝐵𝐵) ⊕ 𝐶𝐶

5
Module: Computer Number Systems and Boolean Algebra

More Logic Operations


Below are some additional building blocks of a logic system, the NAND, NOR and XNOR functions.

The NAND Function


FACT: For the NAND function (negative-AND function), the output is the complement of the AND
function, ie. NAND produces an output which is false only if all its inputs are true.

Below is a figure representing a two-input NAND gate, where A and B are the input variables: (a) logic
symbol; (b) truth table.

a) A ����
𝐴𝐴𝐴𝐴 b) Condition A B ����
𝐴𝐴𝐴𝐴
B 1 0 0 1
2 0 1 1
3 1 0 1
4 1 1 0

The NOR Function


FACT: For the NOR function (negative-OR function), the output is the complement of the OR
function, ie. NOR produces an output which is false when any of its inputs are true.

Below is a figure representing a two-input NOR gate, where A and B are the input variables: (a) logic
symbol; (b) truth table.

a) A b) Condition A B ��������
𝐴𝐴 + 𝐵𝐵
��������
𝐴𝐴 + 𝐵𝐵
B 1 0 0 1
2 0 1 0
3 1 0 0
4 1 1 0

The XNOR Function


FACT: The XNOR function (or NXOR) is the logical complement of the XOR gate, ie. the output is
true if the inputs are alike, otherwise the output is false.

Below is a figure representing a two-input NXOR gate, where A and B are the input variables: (a) logic
symbol; (b) truth table.

a) A b) Condition A B ��������
𝐴𝐴 ⊕ 𝐵𝐵
��������
𝐴𝐴 ⊕ 𝐵𝐵
B
1 0 0 1
2 0 1 0
3 1 0 0
4 1 1 1

6
Module: Computer Number Systems and Boolean Algebra

Summary

Order of operations
The three basic logic functions discussed, AND, OR and NOT, are the basic building blocks for all
computer logic circuits. Logic diagrams are drawn to symbolize logic expressions.

For Boolean algebra, we respect the following order of operations:

Brackets, NOT, AND, XOR, OR

7
Module: Computer Number Systems and Boolean Algebra

Example: Draw the logic diagrams that represent the following Boolean expressions:

a) 𝐴𝐴 ⊕ 𝐵𝐵(𝐴𝐴 + 𝐵𝐵�)

b) �������������
𝐵𝐵 + 𝐶𝐶̅ + 𝐷𝐷

c) ��������
𝐶𝐶̅ + 𝐵𝐵 (𝐴𝐴̅𝐵𝐵)

8
Module: Computer Number Systems and Boolean Algebra

Logic Diagrams to Algebraic Expressions


Example: Write the output as a Boolean expression.

Example: Write the output as a Boolean expression.

9
Module: Computer Number Systems and Boolean Algebra

Boolean Theorems and Truth Tables


We use rules to simplify Boolean expressions (and therefore our circuits).
There are 3 types of rules: Postulates, Algebraic Properties, Theorems

All of these rules will be given to you on a formula sheet. Your job is to tell me which one you are
using for each step of your simplification.

Postulates
Postulates describe truths in a short-abbreviated way. Here is a table describing the AND, OR and
NOT functions.

POSTULATES
1a. 𝐴𝐴 = 1 (if 𝐴𝐴 ≠ 0) 1b. 𝐴𝐴 = 0 (if 𝐴𝐴 ≠ 1)
2a. 0 ⋅ 0 = 0 2b. 0 + 0 = 0
3a. 1 ⋅ 1 = 1 3b. 1 + 1 = 1
4a. 1 ⋅ 0 = 0 4b. 1 + 0 = 1
5a. 1� = 0 5b. 0� = 1

Postulates 1a and 1b describe how Boolean expressions are binary (either 1 or 0). Postulates 2a,
3a and 4a describe the AND function. Postulates 2b, 3b and 4b describe the OR function.
Postulate 5a and 5b describe the NOT function.

Algebraic Properties
Below are algebraic properties that are not only true for ordinary algebra, but also Boolean
algebra. Remember, Boolean expressions contain variables having ONLY two possible values.

ALGEBRAIC PROPERTIES
Commutative
6a. 𝐴𝐴𝐴𝐴 = 𝐵𝐵𝐵𝐵 6b. 𝐴𝐴 + 𝐵𝐵 = 𝐵𝐵 + 𝐴𝐴
Associative
7a. 𝐴𝐴(𝐵𝐵𝐵𝐵) = 𝐴𝐴𝐴𝐴(𝐶𝐶) 7b. 𝐴𝐴 + (𝐵𝐵 + 𝐶𝐶) = (𝐴𝐴 + 𝐵𝐵) + 𝐶𝐶
Distributive
8a. 𝐴𝐴(𝐵𝐵 + 𝐶𝐶) = 𝐴𝐴𝐴𝐴 + 𝐴𝐴𝐴𝐴 8b. 𝐴𝐴 + 𝐵𝐵𝐵𝐵 = (𝐴𝐴 + 𝐵𝐵)(𝐴𝐴 + 𝐶𝐶)

The algebraic property 8b is the most unlike ordinary algebra. Let’s prove it’s true using a truth
table.

10
Module: Computer Number Systems and Boolean Algebra

Example: The distributive property 8b states that 𝐴𝐴 + 𝐵𝐵𝐵𝐵 = (𝐴𝐴 + 𝐵𝐵)(𝐴𝐴 + 𝐶𝐶). Prove that they
are equal by constructing a truth table.

𝑨𝑨 𝑩𝑩 𝑪𝑪 𝑩𝑩𝑩𝑩 𝑨𝑨 + 𝑩𝑩 𝑨𝑨 + 𝑪𝑪 𝑨𝑨 + 𝑩𝑩𝑩𝑩 (𝑨𝑨 + 𝑩𝑩)(𝑨𝑨 + 𝑪𝑪)


0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1

these should
be equal!

Theorem
The following theorems define the application of the operators to variables:
THEOREMS
9a. 𝐴𝐴 ⋅ 0 = 0 9b. 𝐴𝐴 + 0 = 𝐴𝐴
10a. 𝐴𝐴 ⋅ 1 = 𝐴𝐴 10b. 𝐴𝐴 + 1 = 1
11a. 𝐴𝐴 ⋅ 𝐴𝐴 = 𝐴𝐴 11b. 𝐴𝐴 + 𝐴𝐴 = 𝐴𝐴
̅
12a. 𝐴𝐴 ⋅ 𝐴𝐴 = 0 12b. 𝐴𝐴 + 𝐴𝐴̅ = 1
13a. 𝐴𝐴̅ = 𝐴𝐴 13b. 𝐴𝐴 = 𝐴𝐴̅

Example: Show that 𝐴𝐴 + 𝐵𝐵 + 𝐴𝐴𝐴𝐴 + 𝐴𝐴𝐴𝐴 = 𝐴𝐴 + 𝐵𝐵 by constructing a truth table.

𝑨𝑨 𝑩𝑩 𝑪𝑪 𝑨𝑨𝑨𝑨 𝑨𝑨𝑨𝑨 𝑨𝑨 + 𝑩𝑩 + 𝑨𝑨𝑨𝑨 + 𝑨𝑨𝑨𝑨 𝑨𝑨 + 𝑩𝑩


0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1

11
Module: Computer Number Systems and Boolean Algebra

Example: Simplify (𝐴𝐴 + 𝐵𝐵) + 𝐵𝐵� using Boolean algebra rules.

Example: Check your solution: Show that (𝐴𝐴 + 𝐵𝐵) + 𝐵𝐵� = 1 by constructing a truth table.

𝑨𝑨 𝑩𝑩
0 0
0 1
1 0
1 1

12
Module: Computer Number Systems and Boolean Algebra

Example: Simplify the following expressions using Boolean algebra rules.

a) 𝐴𝐴𝐴𝐴 + 𝐵𝐵𝐵𝐵 + 𝐵𝐵𝐶𝐶̅

b) 𝐴𝐴̅(𝐵𝐵 + 𝐴𝐴𝐴𝐴)

13
Module: Computer Number Systems and Boolean Algebra

De Morgan’s Theorem and Absorption Theorem


De Morgan’s Theorem allows us to simplify Boolean expressions.

DE MORGAN’S THEOREMS

14a. 𝐴𝐴̅𝐵𝐵� 𝐶𝐶̅ = �������������


𝐴𝐴 + 𝐵𝐵 + 𝐶𝐶 14b. 𝐴𝐴̅ + 𝐵𝐵� + 𝐶𝐶̅ = ������
𝐴𝐴𝐴𝐴𝐴𝐴

ABSORPTION THEOREM
15a. 𝐴𝐴(𝐴𝐴 + 𝐵𝐵) = 𝐴𝐴 15b. 𝐴𝐴 + 𝐴𝐴𝐴𝐴 = 𝐴𝐴
16a. 𝐴𝐴(𝐴𝐴̅ + 𝐵𝐵) = 𝐴𝐴𝐴𝐴 16b. 𝐴𝐴 + 𝐴𝐴̅𝐵𝐵 = 𝐴𝐴 + 𝐵𝐵

Example: Simplify the following expressions.

���� )(𝐴𝐴̅ + 𝐵𝐵� )(𝐴𝐴 + 𝐴𝐴̅)


a. (𝐴𝐴𝐴𝐴

14
Module: Computer Number Systems and Boolean Algebra

b. �������������
𝐴𝐴̅ + 𝐵𝐵 + 𝐶𝐶̅

c. 𝐴𝐴̅𝐵𝐵� + 𝐴𝐴̅𝐵𝐵 + 𝐴𝐴𝐴𝐴

15
Module: Computer Number Systems and Boolean Algebra

Example: For the logic diagram below (i) write the Boolean expression, (ii) simplify the Boolean
expression and justify each step, (iii) draw the simplified logic diagram, and (iv) construct a truth
table to prove that the two expressions are equal.

𝐴𝐴

𝐵𝐵

𝑨𝑨 𝑩𝑩
0 0
0 1
1 0
1 1

16

You might also like