Sei sulla pagina 1di 23

Boolean Algebra

Booklet 1
Version 0.5

Reid Bauermeister 2018


Contents

1. What is Boolean Algebra?


2. AND, OR, NOT, NAND, NOR, XOR Symbols
3. Order of Operations
4. Boolean Expressions to Logic Circuits
5. Logic Circuits to Boolean Expressions
6. Truth Tables from Boolean Expressions and Circuit Diagrams
7. Introduction to Simplification of Boolean Expressions
8. General Boolean Logic Identities
9. Boolean Logic Rules
10. Solutions
11. References

Reid Bauermeister 2018


What is Boolean Algebra?

Boolean algebra is a form of mathematics that deals with statements and their Boolean values. It is named
after its inventor George Boole, who is thought to be one of the founders of computer science. In Boolean
algebra variables and functions take on one of two values: true or false. These values can also be referred to
as 1 for true and 0 for false.

Example statements:

If we take a simple statement we can start to see the operations of Boolean algebra:
“I will wear a coat if it is very cold or if it is raining.”
The proposition ‘I will wear a coat’ will be true if either of the propositions ‘It is very cold’ or ‘It is raining’ are
true. We can represent this as a diagram:

It is very cold
OR I will wear a coat
It is raining

As a truth table – a table that shows the output for each possible input combination – this is:

It is very cold It is I will wear a It is very It is I will wear a


raining coat cold raining coat

False False False 0 0 0


or
False True True 0 1 1

True False True 1 0 1

True True True 1 1 1

We could then make our statement more complex by saying:


“If I do not go on the bus, I will wear a coat if it is very cold or if it is raining.”

We can represent this as a diagram:

It is very cold
OR
It is raining

AND I will wear a coat

I will go on the bus NO

If we look at the logic of our diagram we can see that if it is very cold or it is raining, and I am not going on the
bus, I will wear a coat. But if I go on the bus I will not wear a coat regardless of whether it is very cold, or it is
raining.

We can begin to create a Boolean expression from our diagram. Note that the brackets around the OR
statement mean that this will be evaluated before the AND statement:

Coat = ((NOT Bus) AND (Very cold OR Raining)

Reid Bauermeister 2018


AND, OR, NOT, NAND, NOR, XOR Symbols

Programming Boolean Algebra


Name Operator Logic Symbol Logic Gate
Symbol Symbol
Conjunction AND A&B 𝐴 ⋅𝐵 𝐴∗𝐵 𝐴 ∧𝐵

Disjunction OR A|B 𝐴+𝐵 𝐴∨𝐵

Negation NOT !A 𝐴̅ ¬𝐴

Not AND NAND !(A & B) ̅̅̅̅̅̅


𝐴⋅𝐵 ¬(𝐴 ∧ 𝐵)

Not OR NOR !(A | B) ̅̅̅̅̅̅̅̅


𝐴+𝐵 ¬(𝐴 ∨ 𝐵)

Exclusive
XOR A^B 𝐴⨁𝐵 A⊻B
Disjunction

Truth Tables & Venn Diagrams

AND OR NOT
Q = A AND B Q=A OR B Q = NOT A
𝑄 =𝐴⋅𝐵 𝑄 = 𝐴+𝐵 𝑄 = 𝐴̅
𝑄 =𝐴∗𝐵 𝑄 =𝐴∨𝐵 𝑄 = ¬𝐴
𝑄 =𝐴∧𝐵
A B Q A B Q A Q
0 0 0 0 0 0 0 1
0 1 0 0 1 1 1 0
1 0 0 1 0 1
1 1 1 1 1 1

NAND NOR XOR


Q = A NAND B Q = A NOR B Q = A XOR B
𝑄 = ̅̅̅̅̅̅
𝐴⋅𝐵 𝑄 = ̅̅̅̅̅̅̅̅
𝐴+𝐵 𝑄 = 𝐴 ⨁𝐵
𝑄 = ̅̅̅̅̅̅̅
𝐴∗𝐵 𝑄 = ¬(𝐴 ∨ 𝐵) 𝑄 =𝐴⊻B
𝑄 = ¬(𝐴 ∧ 𝐵)
A B Q A B Q A B Q
0 0 1 0 0 1 0 0 0
0 1 1 0 1 0 0 1 1
1 0 1 1 0 0 1 0 1
1 1 0 1 1 0 1 1 0

Reid Bauermeister 2018


Order of Operations

Boolean operations have an order in which they are carried out. This order is:

Brackets ()

Anything that appears inside brackets has the normal mathematical rule apply, that it is NOT
always carried out first.
AND
AND can be treated like multiplication ×, OR can be treated like addition +
OR

Remember the logical statement from the introduction:

Coat = ((NOT Bus) AND (Very cold OR Raining))

In Boolean algebra, parts of a statement are given a single letter. This means we can write our statement as a
Boolean expression like this:

C = (( ) (V + R))

Boolean operators have an order in which they are carried out. The NOT statement will be evaluated first, so we can
simplify our statement slightly by removing the brackets:

C= (V + R)

Also remember from your mathematics class that you evaluate each term separately in an expression. Each term is
separated by a + except if it is in a bracket. For example, you would evaluate the terms (shown in circles) in this
expression first:

5 × 3 + 2 × (8 + 7) + 4 × 2 + 6

In the same way you can evaluate the terms in a Boolean expression first. Multiplication is similar to AND and
addition is similar to OR. For example, you would evaluate the terms (shown in circles) in this Boolean expression
first:

𝐴 ⋅ 𝐵 + 𝐴 ⋅ (𝐵 + 𝐶) + 𝐴

Written another way:

𝐴 ∧ 𝐵 ∨ 𝐴 ∧ (𝐵 ∨ 𝐶) ∨ 𝐴

Reid Bauermeister 2018


Boolean Expressions to Logic Circuits

Note: Generally, you should make sure you have simplified your Boolean expression before you convert it to a Logic
Circuit. This is to avoid building a complex logic system in electronics when it can be simpler. We will learn how to
simplify Boolean expressions later.

Once the simplest Boolean expression has been obtained you will often need to draw the logic circuit diagram. This
just means working backwards from the Boolean expression. As a rule of thumb, we need to start inside the brackets
and work our way out. When we work inside a bracket we need to work in the order of NOT, AND then finally OR.
Let’s have a look at a few examples:

Example:

Question:
Draw the logic diagram for the simplified Boolean expression shown below:
Q = B.( A + C)

Answer:
First, we make up the logic for the bracketed term.
A

The output of this arrangement then needs to be connected to an AND gate with input B as shown below:
A

C
Q
B

Exercise A:
Draw the Logic Circuit diagram for the Boolean expressions given. Draw them first using the online tool
(https://logic.ly/demo/) and then draw them here.

1. 𝑨 ∗ (𝑩 + 𝑪) 2. (𝐀 ∨ 𝐁) ∧ (𝐁 ∨ 𝐂)

Reid Bauermeister 2018


3. (𝐀 ∧ 𝐁 ∨ 𝐂)𝐃 ̅+𝐁⋅𝐂
4. 𝐀 ⋅ 𝐁

5. ̅̅̅̅̅̅̅̅
𝐀+𝐁+𝐀 ̅ (𝐂 + 𝐁) 6. 𝑨 ∧ ¬𝑩 ∨ ¬𝑪 ∧ (𝑨 ∨ 𝑩)

Logic Circuits to Boolean Expressions

Example 1:

To start the process, try to divide the circuit into stages as shown below. This breaks down a large circuit into
smaller more manageable chunks. It would be virtually impossible to write down the expression for Q immediately
just by looking at the logic diagram, so don’t even try, you are more than likely to make a mistake.

B
Q

Stage 1 Stage 2
Stage 3
Reid Bauermeister 2018
Having identified the different stages in the circuit diagram, we now proceed to write down the Boolean expressions
for all of the output sections of stage 1, as shown below.

A A

B
B
Q

C
C

Stage 1 Stage 2
Stage 3
Now we move on to look at the outputs of stage 2, as shown below:

A A

A.B

B
B
Q
C

C
C

Stage 1 Stage 2
Stage 3

And finally, we can complete stage 3, to arrive at the expression for the system as:

Q = A.B + C

Reid Bauermeister 2018


Example 2:

D
Stage 1 Stage 2 Stage 3 Stage 4

First deal with stage 1’s outputs:

A
A

B
B

C
C

D
Stage 1 Stage 2 Stage 3 Stage 4

Reid Bauermeister 2018


Then deal with stage 2’s outputs:

A
A
A.B

B A.B
B
C
Q

A.B
C
C
C+D
C
D
C+D

D
Stage 1 Stage 2 Stage 3 Stage 4

Now for stage 3, we must be very careful as for the first time we are going to come across NAND gates, and it is
really important to keep terms together, so we use brackets to keep things together.

A
A
A.B

B A.B
A.B + C
B
C
Q

A.B
C
C
C+D ( A.B).(C + D)
C
D
C+D

D
Stage 1 Stage 2 Stage 3 Stage 4

Reid Bauermeister 2018


Finally, in stage 4 we combine these two large expressions with a NOR function. Notice the use of brackets to keep
terms together.

Q = ( A.B + C) + ( A.B).(C + D)

Exercise B:

1.

B Q

C Q = …………………………………………………………….

2.

D Q = …………………………………………………………….

Reid Bauermeister 2018


3.

D Q = …………………………………………………………….

4.

D Q = …………………………………………………………….

Reid Bauermeister 2018


Truth Tables from Boolean Expressions and Circuit Diagrams

Example 1:

Consider the following Boolean expression

𝑄 = 𝐵 ⋅ (𝐴̅ + 𝐶) + 𝐶
First, we need to draw our table with a list of our inputs with all possible combinations of zeros and ones:

A B C
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1

When we convert a Boolean expression to a truth table it is important to follow the order of operations. We write
down each operation building them up in the correct order finishing with the output in the last column.

A B C 𝐴̅ 𝐴̅ + 𝐶 𝐵 ⋅ (𝐴̅ + 𝐶) 𝑄 = 𝐵 ⋅ (𝐴̅ + 𝐶) + 𝐶
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1

Finally, we can fill in the columns from left to right.

A B C 𝐴̅ 𝐴̅ + 𝐶 𝐵 ⋅ (𝐴̅ + 𝐶) 𝑄 = 𝐵 ⋅ (𝐴̅ + 𝐶) + 𝐶
0 0 0 1 1 0 0
0 0 1 1 1 0 1
0 1 0 1 1 1 1
0 1 1 1 1 1 1
1 0 0 0 0 0 0
1 0 1 0 1 0 1
1 1 0 0 0 0 0
1 1 1 0 1 1 1

Reid Bauermeister 2018


Example 2:

Make a truth table from the following circuit diagram.

B
Q

In the same way we did when drawing a circuit diagram from a Boolean expression we need to convert the circuit
diagram into a Boolean expression by dividing the circuit into stages and filling in the outputs of each stage:

A A

A.B

B
B

C
C

Stage 1 Stage 2
Stage 3

We can then complete our truth table using the outputs of each stage as the column headers.

A B C 𝐴̅ 𝐶̅ 𝐴̅ ⋅ 𝐵 𝑄 = 𝐴̅ ⋅ 𝐵 + 𝐶̅
0 0 0 1 1 0 1
0 0 1 1 0 0 0
0 1 0 1 1 1 1
0 1 1 1 0 1 1
1 0 0 0 1 0 1
1 0 1 0 0 0 0
1 1 0 0 1 0 1
1 1 1 0 0 0 0

Reid Bauermeister 2018


Exercise C:

Complete the truth tables.

1. 𝑸 = 𝑨 ∗ (𝑩 + 𝑪)

A B C
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1

2. 𝑸 = (𝐀 ∨ 𝐁) ∧ (𝐁 ∨ 𝐂)

A B C
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1

̅ +𝐁⋅𝐂
3. 𝐐 = 𝐀 ⋅ 𝐁

A B C
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1

4. 𝑸 = ̅̅̅̅̅̅̅̅
𝐀+𝐁+𝐀 ̅ (𝐂 + 𝐁)

A B C
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1

Reid Bauermeister 2018


5.

A B C
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1

6.
A

A B C
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1

Reid Bauermeister 2018


Introduction to Simplification of Boolean Expressions

Boolean expressions are often very long and complex and can result in very complicated electronic logic systems
being built or complicated if statements in programming. What is needed is a method of simplifying these logic
expressions using Boolean algebra. The introduction of the word algebra may remind many of you of the algebra you
use in Mathematics to solve questions like:

Simplify: Giving an answer of: Sometimes it is necessary to factorise before you can simplify:
1 1
𝑎(𝑏 + 𝑎) 𝑎𝑏 + 𝑎 ⋅ Simplify: Giving an answer of:
𝑎
= 𝑎𝑏 + 1 2𝑥 2 − 2𝑥 2𝑥(𝑥 − 1)
𝑥−1 𝑥−1
= 2𝑥

Factorising first before simplifying is usually the approach we use in Boolean algebra. In the example above, we
𝑥−1 𝑎
needed to know that 𝑥−1 = 1. In general, this rule in algebra can be written as 𝑎 = 1.

𝑎
The rule 𝑎 = 1 is known as an identity. We need to learn these identities in Boolean algebra before we can simplify
Boolean expressions.

We will now have a look at these special identities or rules in the next section.

General Boolean Logic Identities

The general identities are derived directly from the truth tables for AND and OR. If you find it difficult to remember
these laws during an assessment, write down the AND and OR truth tables and use those to help you remember or
draw the logic gate and imagine the resulting output with certain inputs.

𝑨∧𝟎=𝟎 𝑨∧𝟏=𝑨 𝑨 ∧ ¬𝑨 = 𝟎 𝑨∧𝑨=𝑨

A A A A
0 0 0 0 0 0 0 0 0 0 0 0
0 1 0 0 1 0 0 1 0 0 1 0
AND 1 0 0 1 0 0 1 0 0 1 0 0
1 1 1 1 1 1 1 1 1 1 1 1

𝑨∨𝟎=𝑨 𝑨∨𝟏= 𝟏 𝑨 ∨ ¬𝑨 = 𝟏 𝑨∨𝑨=𝑨

A A A A
0 0 0 0 0 0 0 0 0 0 0 0
0 1 1 0 1 1 0 1 1 0 1 1
OR 1 0 1 1 0 1 1 0 1 1 0 1
1 1 1 1 1 1 1 1 1 1 1 1

Reid Bauermeister 2018


Boolean Logic Rules
Double Negation Rule

¬¬𝑨 = 𝑨

A ¬𝑨 ¬¬A
0 1 0
NOT 1 0 1

A ⌐A ⌐⌐A=A

Absorption Rules

𝑨 ∨ (𝑨 ∧ 𝑩) = 𝑨

𝑨 ∧ (𝑨 ∨ 𝑩) = 𝑨

Note!

The rest of the rules below are the same as the rules you learn in algebra in mathematics classes! Remember from the order of
operations that multiplication is similar to AND and addition is similar to OR.

Commutative Rules

So, you know from mathematics that 𝒂 × 𝒃 = 𝒃 × 𝒂 and 𝒂 + 𝒃 = 𝒃 + 𝒂 . The same rules apply in Boolean algebra:

𝑨∧𝑩= 𝑩∧𝑨

𝑨∨𝑩= 𝑩∨𝑨

Associative Rules

You know from mathematics that 𝑎 × (𝑏 × 𝑐) = (𝑎 × 𝑏) × 𝑐 and 𝑎 + (𝑏 + 𝑐) = (𝑎 + 𝑏) + 𝑐 . The same rules apply in Boolean
algebra:

𝑨 ∧ (𝑩 ∧ 𝑪) = (𝑨 ∧ 𝑩) ∧ 𝑪

𝑨 ∨ (𝑩 ∨ 𝑪) = (𝑨 ∨ 𝑩) ∨ 𝑪

Distributive Rules

You know from mathematics that 𝑎(𝑏 + 𝑐) = 𝑎𝑏 + 𝑎𝑐. The same rule applies in Boolean algebra:

𝑨 ∧ (𝑩 ∨ 𝑪) = (𝑨 ∧ 𝑩) ∨ (𝑨 ∧ 𝑪)

But unlike in normal algebra in Boolean algebra we are also allowed to use the following rule!!!

𝑨 ∨ (𝑩 ∧ 𝑪) = (𝑨 ∨ 𝑩) ∧ (𝑨 ∨ 𝑪)

Reid Bauermeister 2018


De Morgan’s Laws

De Morgan’s Law 1

¬(¬𝐴 ∧ ¬𝐵) = 𝐴 ∨ 𝐵

𝐴 𝐵 ¬𝐴 ¬𝐵 ¬𝐴 ∧ ¬𝐵 ¬(¬𝑨 ∧ ¬𝑩)
0 0 1 1 1 0
0 1 1 0 0 1
1 0 0 1 0 1
1 1 0 0 0 1

𝐴 𝐵 𝑨∨𝑩
0 0 0
0 1 1
1 0 1
1 1 1

De Morgan’s Law 2

¬(¬𝐴 ∨ ¬𝐵) = 𝐴 ∧ 𝐵

𝐴 𝐵 ¬𝐴 ¬𝐵 ¬𝐴 ∨ ¬𝐵 ¬(¬𝑨 ∨ ¬𝑩)
0 0 1 1 1 0
0 1 1 0 1 0
1 0 0 1 1 0
1 1 0 0 0 1

𝐴 𝐵 𝑨∧𝑩
0 0 0
0 1 0
1 0 0
1 1 1

Reid Bauermeister 2018


Solutions

Boolean Expressions to Logic Circuits – Exercise A

1. A 2.
B
C

3. 4. A

B
Q

5.
A

B
Q

6. A

Logic Circuits to Boolean Expressions – Exercise B

1. Q = C + ( A + B)
2. Q = ( A + B).C + ( A + B) + (C + D)
3. Q = A.B + C + ( A.B).(D.C)
4. Q = ( A.B).C + ( A.B).(C + D)

Reid Bauermeister 2018


Truth Tables from Boolean Expressions and Circuit Diagrams – Exercise C

1. 𝑸 = 𝑨 ∗ (𝑩 + 𝑪)

A B C 𝑩+𝑪 𝑸 = 𝑨 ∗ (𝑩 + 𝑪)
0 0 0 0 0
0 0 1 1 0
0 1 0 1 0
0 1 1 1 0
1 0 0 0 0
1 0 1 1 1
1 1 0 1 1
1 1 1 1 1

2. 𝑸 = (𝐀 ∨ 𝐁) ∧ (𝐁 ∨ 𝐂)

A B C 𝐀∨𝐁 𝐁∨𝐂 𝑸 = (𝐀 ∨ 𝐁) ∧ (𝐁 ∨ 𝐂)
0 0 0 0 0 0
0 0 1 0 1 0
0 1 0 1 1 1
0 1 1 1 1 1
1 0 0 1 0 0
1 0 1 1 1 1
1 1 0 1 1 1
1 1 1 1 1 1

̅ +𝐁⋅𝐂
3. 𝐐 = 𝐀 ⋅ 𝐁

A B C ̅
𝐁 𝐀⋅𝐁̅ 𝐁⋅𝐂 ̅ +𝐁⋅𝐂
𝐐=𝐀⋅𝐁
0 0 0 1 0 0 0
0 0 1 1 0 0 0
0 1 0 0 0 0 0
0 1 1 0 0 1 1
1 0 0 1 1 0 1
1 0 1 1 1 0 1
1 1 0 0 0 0 0
1 1 1 0 0 1 1

4. 𝑸 = ̅̅̅̅̅̅̅̅
𝐀+𝐁+𝐀 ̅ (𝐂 + 𝐁)

A B C 𝑨+𝑩 ̅̅̅̅̅̅̅̅
𝐀+𝐁 𝐂+𝐁 ̅
𝐀 ̅ (𝐂 + 𝐁)
𝐀 𝑸 = ̅̅̅̅̅̅̅̅
𝐀+𝐁+𝐀 ̅ (𝐂 + 𝐁)
0 0 0 0 1 0 1 0 1
0 0 1 0 1 1 1 1 1
0 1 0 1 0 1 1 1 1
0 1 1 1 0 1 1 1 1
1 0 0 1 0 0 0 0 0
1 0 1 1 0 1 0 0 0
1 1 0 1 0 1 0 0 0
1 1 1 1 0 1 0 0 0

Reid Bauermeister 2018


5.

A B C 𝑨∨𝑩 𝑩∨𝑪 𝑸 = (𝑨 ∨ 𝑩) ∧ (𝑩 ∨ 𝑪)
0 0 0 0 0 0
0 0 1 0 1 0
0 1 0 1 1 1
0 1 1 1 1 1
1 0 0 1 0 0
1 0 1 1 1 1
1 1 0 1 1 1
1 1 1 1 1 1

6.

A B C ¬𝑩 𝑨 ∧ ¬𝑩 𝑩∧𝑪 𝑄 = (𝑨 ∧ ¬𝑩) ∨ (𝑩 ∧ 𝑪)
0 0 0 1 0 0 0
0 0 1 1 0 0 0
0 1 0 0 0 0 0
0 1 1 0 0 1 1
1 0 0 1 1 0 1
1 0 1 1 1 0 1
1 1 0 0 0 0 0
1 1 1 0 0 1 1

Reid Bauermeister 2018


References:

Topic support guide 9608 Topic 3.3.2 Boolean algebra

http://www.cambridgeinternational.org/images/285024-topic-3.3.2-boolean-algebra-9608-.pdf

System simplification using Boolean Algebra

www.wjec.co.uk/uploads/publications/4891.doc?language_id=1

Chapter 4 Answers

http://web.nuu.edu.tw/~carlu/ecp_sc/Chapter4.ans.doc

https://www.ibiblio.org/kuphaldt/socratic/output/boolean.pdf

Summary of Boolean Algebra Laws

https://community.computingatschool.org.uk/resources/3720/single

Boolean_algebra_workbook

https://community.computingatschool.org.uk/resources/5558/single

Reid Bauermeister 2018

Potrebbero piacerti anche