What is a Boolean Expression?
A Boolean Expression is simply writing a mathematical expression for a logic circuit using letter variables like A, B, C and logic operators like AND, OR, and NOT.
Each variable in the expression is an input that can have a value of either TRUE (1) or FALSE (0).
The expression describes how the inputs should be processed produce an output.
The operators we saw in the previous section can be represented in expressions using a particular notation.
The Boolean operators can be joined together to form complex logical expressions to represent our logic circuits (very much like arithmetic expressions e.g. 3 + 4 - 6.3 * 5).
As examples, we have gives three logical circuits with their equivalent Boolean expressions:
What is a Truth Table?
A Truth Table is a chart used to show all possible input combinations for a logic circuit or Boolean expression and their corresponding output. It’s a way to visualize how the logic works step by step.
Each row in the truth table represents a unique combination of inputs.
The output column shows the result for each combination.
For example, if we had to look at the AND operator, we have all the combinations of inputs represented in this truth table:
In the above table T stands for true and F for false. It shows the output for all possible inputs. In the computer environment, T and F are changed respectively to 1 and 0 as shown below.
Truth Tables for AND OR and NOT
The following are all the truth tables for AND, OR and NOT.
Truth Tables for NAND, NOR and XOR (IGCSE Only)
The following are all the truth tables for NAND, NOR and XOR.
Equivalent Boolean Expressions
We use truth tables to test whether two Boolean expressions produce the same result.
Real World Scenarios
In Part 1 we looked into real-world examples and represented them as logic gates. We can instead express Boolean expressions from the scenarios.
Example: Security System Logic System
Consider a security system with four components — three sensors (inputs) and a buzzer (output). The buzzer emits a sound when either of these conditions is met:
Both Sensor A AND Sensor B detect a breach (we can represent this using an AND gate).
OR (we can represent this using an OR gate)
Sensor C, indicating a stable system, is NOT off, (we can represent this as a NOT gate).
(A . B) + C'
Do You Remember? Pass O Level and Receive Certificate!
A student will receive an O Level certificate based on the following — they must be present (A) for the exam and pass the exam (B) or the student did not pass but was exempted (C) because of special reasons. To clarify:
If the student passed the exam and was present, they get a certificate.
If the student did not pass but was present and exempted for special reasons, they still get a certificate!
(A . B) + (A' . B . C)
Constructing a Truth Table for a Logic Circuit
Say we are presented with this logic circuit.
First, we can label each gate with the operator, and create some temporary values at the exit of each gate for example P and Q. We should also label the final output, which we can name R.
We can then create a truth table to show each possible value through this circuit. We have 3 inputs, so our truth table will have 2^3 lines, so 8 lines. We end up with a truth table showing us the possible values for P, Q, and most importantly R which is our final output. Notice in the working we are also using expression notation to show how P and Q were worked out.
If we had to represent this as an expression, this is how it would go:
R = Q . B
Q = A + P
P = C'
Replacing P and Q with the original inputs, since we cannot use temporary values.
R = ( A+ P ) . B
R = ( A + C' ) . B
Comments