Boolean Expression Help Guide PDF
Boolean Expression Help Guide PDF
Learning Objectives:
inputs]
Boolean Algebra.
In our previous unit we discovered that logic systems can become quite
complex if we don’t use any simplification techniques. In this topic you will be
introduced to the first method of simplification, Boolean Algebra.
A dot ‘.’, is used to represent the AND function. E.g. A and B = A.B
Exercise 1: Write down the Boolean Expressions for the following examples:
1. NOT X …………………………………………
2. R AND T …………………………………………
3. S OR R …………………………………………
4. C EXOR G …………………………………………
9. X NOR Y …………………………………………
Fawad Khan 0321-6386013
3
The following table should remind you of the work we did in Topic 1.1.1.
A
NOT Q
QA
A
AND B
Q Q A.B
A
OR B
Q
Q A B
A
NAND B
Q
Q A.B
A
NOR Q
Q A B
A
Q Q A B or
EXOR B
Q A.B A.B
A
Q Q A B or
EXNOR B
Q A.B A.B
Now let us put this into practice. There are two ways in which Boolean
expressions for a logic system can be formed, either from a truth table or
from a logic circuit diagram. We will now consider each of these in turn
starting with the easiest, which is to complete a Boolean expression from a
truth table.
Consider the following truth table of a particular logic system. (Note : at this
stage it does not matter what the system is meant to do).
C B A Q
0 0 0 0
0 0 1 1
0 1 0 0
0 1 1 1
1 0 0 1
1 0 1 1
1 1 0 0
1 1 1 0
In this table there are four combinations of inputs that will produce an
output at Q. In order to write down the Boolean Expression for the whole
system we first have to write down the Boolean Equation for each line in the
truth table where the output is a 1. All input variables (three in this case)
must be included in each Boolean Equation on each line, as shown below
C B A Q Boolean Equation
0 0 0 0
0 0 1 1 A.B.C
0 1 0 0
0 1 1 1 A.B.C
1 0 0 1 A.B.C
1 0 1 1 A.B.C
1 1 0 0
1 1 1 0
To obtain the Boolean expression for the whole system we simply take each
of these terms and ‘OR’ them together.
Q A.B.C A.B.C A.B.C A.B.C
Fawad Khan 0321-6386013
5
The expression we obtain from this may not be the simplest possible, we
will look at simplification later. We will concentrate to start with on obtaining
a correct Boolean expression for a logic system before we attempt to
simplify them. After all there is not a lot of point being able to simplify an
expression if this is not correct to start with.
1.
C B A Q Boolean Equation
0 0 0 1
0 0 1 0
0 1 0 0
0 1 1 1
1 0 0 0
1 0 1 0
1 1 0 1
1 1 1 0
……………………………………………………………………………………………………………………………………
2.
C B A Q Boolean Equation
0 0 0 0
0 0 1 0
0 1 0 1
0 1 1 0
1 0 0 0
1 0 1 1
1 1 0 0
1 1 1 1
……………………………………………………………………………………………………………………………………
3. Now try one with four inputs, the process is exactly the same, it’s just
that you now have four variables in each term.
D C B A Q Boolean Equation
0 0 0 0 0
0 0 0 1 0
0 0 1 0 0
0 0 1 1 0
0 1 0 0 1
0 1 0 1 0
0 1 1 0 1
0 1 1 1 0
1 0 0 0 0
1 0 0 1 0
1 0 1 0 0
1 0 1 1 1
1 1 0 0 0
1 1 0 1 0
1 1 1 0 1
1 1 1 1 0
……………………………………………………………………………………………………………………………………
Hopefully you will have found these tasks fairly straight forward as they are
quite easy once you understand how to write down the variables in Boolean
terms.
We will now look at how to generate the Boolean expressions from a logic
circuit diagram, which can be a little more difficult depending on the type of
gates involved.
Sometimes we are not given a truth table, but a logic circuit diagram from
which we have to derive the Boolean expression. This sounds complicated but
as long as you are careful in what you do and work sensibly from the inputs
across to the outputs you should be o.k.
Example 1: Derive the Boolean expression for the following logic circuit.
B
Q
To start the process try to divide the circuit into stages as shown above.
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.
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 on the following page.
A A
B
B
Q
C
C
A A
A.B
B
B
Q
C
C
C
And finally we can complete stage 3, to arrive at the expression for the
system as
Q A.B C
This was a relatively small system of logic gates, and the full system Boolean
expression was determined quite quickly. Now consider a much larger system
as shown below. Don’t be put off, we will again work through this slowly, one
stage at a time
D
Stage 1 Stage 2 Stage 3 Stage 4
A
A
B
B
C
C
D
Stage 1 Stage 2 Stage 3 Stage 4
A
A
A.B
B A.B
B
C
Q
A.B
C
C
CD
C
D
CD
D
Stage 1 Stage 2 Stage 3 Stage 4
Fawad Khan 0321-6386013
12
Now for stage 3, we have to 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
CD ( A.B).(C D)
C
D
CD
D
Stage 1 Stage 2 Stage 3 Stage 4
Q ( A.B C) ( A.B).(C D)
Exercise 3: Derive the Boolean Expression for the output of the following
logic systems.
1.
B Q
C Q = …………………………………………………………….
2.
D Q = …………………………………………………………….
3.
D Q = …………………………………………………………….
4.
D Q = …………………………………………………………….
Fawad Khan 0321-6386013
15
So now we are able to derive a Boolean Expression for a logic system either
from a truth table or from a logic diagram. The expression we end up with is
often very long and complex and can result in very complicated logic systems
being built. 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 used in GCSE Mathematics to solve questions like:
simplify 2x + 6y.
Or
Or
The solution involves looking for common elements that can be removed from
each term to simplify the expression by using brackets. The original
expression can be regenerated by multiplying everything inside the bracket
by the term outside. All we have done is to find an alternative way of writing
down the expression. Boolean algebra is very similar, we try to remove
common elements to simplify the expression. However there are a few things
that we can do to enable the expression to become much simpler if we can
remember some basic combinations that help to reduce terms significantly.
These special terms are called identities, and you will have to remember them
as they are not reproduced on the information sheet of the examination
paper.
A
Q
1
So wherever the term A.1 appears this can be replaced with A so our
first identity is
A.1 = A
A
Q
0
So wherever the term A.0 appears this can be replaced with 0 so our
second identity is
A.0 = 0
A
Q
A
So wherever the term A.A appears this can be replaced with 0 so our
third identity is
A.A 0
A
Q
1
So wherever the term A+1 appears this can be replaced with 1 so our
fourth identity is
A+1 = 1
A
Q
0
So wherever the term A+0 appears this can be replaced with A so our
fifth identity is
A+0 = A
A
Q
A
In all of these examples the variable A has been used, but the rules
apply for any variable. i.e. B.0 0, C 1 1, D 0 D, E.E 0 etc.
Now we can see that B is common to the first two terms inside the
bracket, but it is not common to the last term so we cannot include this
in the simplification, which now becomes:
Q A.(B.(C C)) B)
Q A.(B B)
Using our sixth identity again the term B B 1 so the expression now
becomes:
Q A.1
QA
Q A.B A.B
Q A.(B B)
QA
I’m sure you’ll agree this is a lot simpler than Q A.B.C A.B.C A.B .
Hopefully you will see the advantage of simplifying these expressions
whenever we have the opportunity. It is normal practice in electronics
to take the smaller groups and remove common factors to leave a useful
Fawad Khan 0321-6386013
22
Start by looking for possible common factors which will leave behind one
of our two key identities inside the bracket, in this case A.B in terms 2
and 3. This gives the following simplification.
Q A.B A.B.(C 1) C
Q A.B A.B C
Again we look for common terms, this time between the first two terms
to give the following:
Q B.( A A) C
Q BC
And so we arrive at the simplest solution once again. You would not be
expected to write out all of the steps as has been shown here in your
own simplifications. These have only been included to show you how each
step has been arrived at.
Q B.C.(C D) C.D C A
Solution:
Q B.C.(C D) C.D C A
Q B.C.C B.C.D C.D C A
Q B.0 B.C.D C.(D 1) A
Q B.C.D C A
Q C.(B.D 1) A
Q C.1 A
Q CA
In this last example, notice that the original expression first needed to
be expanded before the expression could be simplified. This is
sometimes necessary to be able to group terms together in different
ways.
The process may at first seem complicated and you may find it hard in
the beginning to identify the terms to group together, but this comes
from experience and the old phrase ‘practice makes perfect’ is very
true here. So why don’t you try the next few examples.
Exercise 4 : Simplify the following Boolean expressions.
1. Q A.B B
…………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………
2. Q C.( A C)
…………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………
4. Q A.B.(B C) B.C B
…………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………
5. Q B.( A C) A A.( A B)
…………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………
There are two special identities that we have not discussed in detail yet, even
though we have used one of them already, in our simplification process. These
are special because they will be printed on the information page on the exam
paper so you don’t have to remember them. The first of these is as follows:
A.B A A(B 1) A
This is quite a straightforward example but because more than one term is
involved, it has been decided to provide this for candidates just in case they
forget what to do in this case.
The second special identity is a little more difficult to explain. Let us take a
look at the identity first.
A A.B A B
A A.B A B
B.C C B C
A.C A C A
In every case you will notice that one variable appears in both terms and it is
inverted in one of these terms. The simplification requires the removal of
this variable from the AND term.
We can further prove this by considering the truth table for the same
function as shown below:
A B B A.B A.B B A B
0 0 1 0 0 0
0 1 0 0 1 1
1 0 1 1 1 1
1 1 0 0 1 1
If we look at the results in the last two columns we can see that they are
identical. This means that the expression A.B B must be equivalent to A B .
This identity is easily forgotten but it is surprising how many times we need
to use it when simplifying expressions, which is why it has been identified as
being special, and printed on the information sheet of the exam paper for you
to use. Here is a quick example to show you how this can be helpful.
Solution.
Q A.B.C A.C C.(D C) A
Q A.(B.C C) C.D C.C A
Q A.(B C) C.D 0 A
Q A.B A.C C.D A
Q A.(B 1) A.C C.D
Q A A.C C.D
Q A.(1 C) C.D
Q A C.D
In all of the examples we have considered so far we have only dealt with
AND, OR and NOT gates, however, as we know there are also NAND and NOR
gates that can be used in logic circuits. When these inverted gates are used
the inversion takes place after the AND or OR operation has been completed
which results in logic expressions like those shown below.
Q A.B
and
Q CD
A B A A.B A.B A
0 0 1 1 1
0 1 1 1 1
1 0 0 1 1
1 1 0 0 0
Clearly the two highlighted columns are not the same, and therefore we
cannot deal with these terms in the same way. Does this mean that we cannot
simplify expressions that have NAND or NOR functions in them ?
DeMorgan’s Theorem
ii. If you complete a ‘bar’ change the sign underneath where the bar is
joined. (We will use this in Topic 1.2.4)
A B A B A.B A B
0 0 1 1 1 1
0 1 1 0 1 1
1 0 0 1 1 1
1 1 0 0 0 0
This shows that the two logic expressions are the same.
A B A B A B A.B
0 0 1 1 1 1
0 1 1 0 0 0
1 0 0 1 0 0
1 1 0 0 0 0
This shows that the two logic expressions are the same.
The rule seems to work, according to the truth tables but we have only used
very basic logic expressions here to prove the rule. If we looked at a more
realistic problem then this would involve more terms and a more complex
expression.
We will put a few of our new skills to the test by looking at a typical problem.
You can work out some of the parts as we go through the example, but the
correct solution will be provided at each stage so that you can check that you
are on the correct path.
C Q
D Q = …………………………………………………………….
Use the process we looked at earlier to derive a Boolean expression for the
logic circuit shown above.
Q ( A.B).(C.D)
This looks quite complicated but by using DeMorgan’s theorem we can make
this a little bit easier. As a general ‘rule of thumb’ start from the top and
work downwards. So the first thing that we have to do is to break to top ‘bar’
between the two brackets. This gives us the following:
Q ( A.B) (C.D)
If we look at the first term we can see that there is a double ‘bar’ over the
expression. This means that the term is inverted and then inverted again,
which will return the original state of the term. Therefore the double
inversion as it is called can be removed.
Q ( A.B) (C.D)
We now apply DeMorgan’s theorem again to the second term to give the
following:
Q ( A.B) (C D)
Again we have a double inversion, applied only to the variable C, which can be
removed to leave the final expression as:
Q ( A.B) (C D)
Q A.B C D
If there were additional terms in the expression, this could now be simplified
using the normal rules of Boolean algebra as discussed previously.
……………………………………………………………………………………………………………………………………
……………………………………………………………………………………………………………………………………
……………………………………………………………………………………………………………………………………
……………………………………………………………………………………………………………………………………
……………………………………………………………………………………………………………………………………
……………………………………………………………………………………………………………………………………
……………………………………………………………………………………………………………………………………
……………………………………………………………………………………………………………………………………
……………………………………………………………………………………………………………………………………
2. Q A.C.B.D C.D
……………………………………………………………………………………………………………………………………
……………………………………………………………………………………………………………………………………
……………………………………………………………………………………………………………………………………
……………………………………………………………………………………………………………………………………
……………………………………………………………………………………………………………………………………
……………………………………………………………………………………………………………………………………
……………………………………………………………………………………………………………………………………
……………………………………………………………………………………………………………………………………
……………………………………………………………………………………………………………………………………
……………………………………………………………………………………………………………………………………
……………………………………………………………………………………………………………………………………
Once the simplest Boolean expression has been obtained from a logic
description or a truth table, you will often need to draw the logic circuit
diagram. This just means working backwards from the Boolean expression,
and as a general rule of thumb we start with any bracketed terms, then AND
and finally OR functions. Let’s have a look at a couple of examples.
Example 1: Draw the logic diagram for the simplified Boolean expression
shown below:
Q B.( A C)
A AC
A AC
C Q
Exercise 6: Draw the Logic Circuit diagram for the Boolean expressions given.
1. Q A.B B.C
2. Q A B A.(C B)
We have now covered all of the material needed for system simplification via
Boolean Algebra. Together with the work we have done on logic system
questions that brings all of the work we have done so far together.
The solutions which follow are the answers to the exercises given in this
topic, and after those will be a series of examination style questions for you
to practice with.
Solutions to Exercises:
Exercise 1.
1. X
2. R.T
3. SR
4. CG
5. B.C
6. XY
7. P B
8. ( A.B)
9. XY
Exercise 2.
Exercise 3.
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)
Exercise 4.
1.
Q A.B B
Q B.( A 1)
Q B.1
Q B
2.
Q C.( A C)
Q A.C C.C
Q A.C 0
Q A.C
3.
4.
Q A.B.(B C) B.C B
Q A.B.B A.B.C B.C B
Q A.0 A.B.C B.(C 1)
Q A.B.C B.1
Q A.B.C B
Q B.( A.C 1)
Q B.1
Q B
5.
Q B.( A C) A A.( A B)
Q A.B B.C A A.A A.B
Q A.B B.C A
Q A.(B 1) B.C
Q A B.C
6.
Q A.B.C B.C A.B.C A.B.B
Q B.C.( A A) B.C A.0
Q B.C.1 B.C
Q B.C B.C
Q B.(C C)
Q B.1
Q B
7.
Q A.B.C B.C.D B.C.D B.C.D A.B.C A.B.C
Q A.B.C B.C.(D D) B.C.D B.C.( A A)
Q A.B.C B.C.1 B.C.D B.C.1
Q A.B.C B.C B.C.D B.C
Q B.C.( A 1) B.C.(D 1)
Q B.C.1 B.C.1
Q B.C B.C
Q B.(C C)
Q B.1
Q B
8.
Q A.B.C.D A.B.D A.B.D A.B.C.D A.C.D A.C.D
Q A.B.D.(C 1) A.B.D A.C.D.(B 1) A.C.D
Q A.B.D.1 A.B.D A.C.D.1 A.C.D
Q A.B.D A.B.D A.C.D A.C.D
Q A.D.(B B) C.D.( A A)
Q A.D.1 C.D.1
Q A.D C.D
Q D.( A C)
Exercise 5:
1.
Q ( A B).( A.B) A.B
Q ( A B) ( A.B) A.B
Q ( A B) ( A.B) A.B
Q A B A.B A.B
Q A.(1 B) (B A.B)
Q A.1 (B A)
Q A B A
Q B ( A A)
Q B1
Q 1
2.
Q A.C.B.D C.D
Q A.C.B D C D
Q A.C.B D C
Q ( A C).B D C
Q A.B B.C D C
Q A.B C.(B 1) D
Q A.B C.1 D
Q A.B C D
Exercise 6:
1. Q A.B B.C
2. Q A B A.(C B)
B
Q
(a) A A …………………………………………………………………………………….
……………………………………………………………………………………………………….
[1]
2. (a) Name, and complete the truth table for the logic gate whose symbol is shown below.
A
Q
B
A B Q
0 0
0 1
1 0
1 1
(b) (i) Complete the truth table for the following system.
J
A 1 L
3
5 Q
4
B 2 M
K
[5]
A B J K L M Q
0 0
0 1
1 0
1 1
(ii) The system can be modified to perform the same function as the gate shown in part
(a). Explain what change needs to be made.
………………………………………………………………………………………………
………………………………………………………………………………………………
[1]
3. (a) Factorise the following Boolean expression, and simplify the result.
A.B A.B
………………………………………………………………………………………………
………………………………………………………………………………………………
[2]
(b) Apply DeMorgan’s theorem to the following expression, and simplify the result.
A.B
………………………………………………………………………………………………
………………………………………………………………………………………………
[2]
(c) Use the results to (a) and (b) to show that
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
[3]
4. Simplify the following expressions. Show all stages of your working for part (c) of the question.
..................................................................................................................................................
..................................................................................................................................................
[2]
X
A Y
Q
B
Write down Boolean expressions for the outputs X, Y and Q in terms of the inputs A and B
X = ......................................................
Y = ......................................................
Q = ......................................................
[3]
(b) Complete the following identities.
A.(B.A)
..................................................................................................................................................
..................................................................................................................................................
..................................................................................................................................................
..................................................................................................................................................
[2]
6. The diagram shows a cabinet designed to house machinery. Sliding panels allow easy access.
microswitch B microswitch C
enable switch A
The output Q of an electronic warning system triggers an alarm if the enable switch A is turned
on, when either panel is open, or both are open.
(b) Write a Boolean expression for the output Q in terms of inputs C, B and A.
There is no need to simplify the expression
...............................................................................................................................................
[2]
Fawad Khan 0321-6386013
52
A
Q1
Q3
Q2
B
(a) Give the Boolean expressions for each of the outputs Q1, Q2 and Q3 in terms of the inputs
A and B.
Q1 = ......................................................
Q2 = ......................................................
Q3 = ......................................................
[3]
(b) Complete the following truth table for Q1, Q2 and Q3.
[3]
INPUTS OUTPUTS
A B Q1 Q2 Q3
0 0
0 1
0 0
0 1
(c) Name the single 2-input gate that could produce the same function as the Q3 output.
..............................................................................................................................................
[1]
( A B) A ..........................................................................................................................
.................................................................................................................................................
.................................................................................................................................................
[3]
9. The diagram below shows a simple logic system.
A S
B T
(a) Complete the truth table for the signal at points S, T and Q.
B A S T Q
0 0
0 1
0 0
0 1
(b) (i) Name the single gate that can replace the combination of gates above.
.................................................................................................................................................
[1]
(ii) Draw the symbol for this gate.
[1]
10. (a) A security system is designed to switch on a powerful floodlight when movement is
detected or a panic button is pressed. The system should operate only when it is dark. The
specifications for the three input subsystems are given below:
Light A
Sensor
Movement B Logic
Q
Sensor System
Panic C
Button
(i) Complete the truth table for the logic system such that Q = logic 1 when the
floodlight is on.
[2]
Panic Button Movement Light Sensor
Output (Q)
(C) Sensor (B) (A)
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1
Q = ………………………………………………………………………………….
[2]
A
E
B Q1
C F
Give the Boolean expressions for the outputs D, E and F of the gates in the logic system in
terms of the inputs A and B.
D = ......................................................
E = ......................................................
F = ......................................................
[3]
C B A D E F Q1
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1
(b) Use DeMorgan’s theorem and Boolean Algebra to show that : ( A B).( A.B) A B
................................................................................................................................................
................................................................................................................................................
................................................................................................................................................
[3]
Fawad Khan 0321-6386013
57
A Q1
Q3
B Q2
(a) Write down the Boolean expressions for each of the outputs Q1, Q2 and Q3 in terms of the
inputs A and B.
Q1 = ......................................................
Q2 = ......................................................
Q3 = ......................................................
[3]
(b) Complete the following truth table for Q1, Q2 and Q3.
[3]
INPUTS OUTPUTS
A B Q1 Q2 Q3
0 0
0 1
0 0
0 1
(c) Name the single 2-input gate that could produce the same function as the Q3 output.
..............................................................................................................................................
[1]
Q C.B.A B.A
14. (a) Simplify the following expressions showing all appropriate working.
A (B.A) .............................................................................................................................
.................................................................................................................................................
.................................................................................................................................................
.................................................................................................................................................
.................................................................................................................................................
[3]
Targets: 1. ………………………………………………………………………………………………………………
………………………………………………………………………………………………………………
2. ………………………………………………………………………………………………………………
………………………………………………………………………………………………………………