Maths and Computing:

menu
Home
Mathematics
Binary
Computing
Coding
Books

Boolean Expressions

Boolean Expressions: Two Variables


Input




Expression

Boolean Expression

Logical Notation



Q =

Binary Output

0 0 0 0

True/False Output

false false false false

Truth Table Output Values

A B Q
0 0 0
0 1 0
1 0 0
1 1 0

Q =

Truth Table with Calculations

A B Q
0 0 0
0 1 0
1 0 0
1 1 0


Q =

Simplifying the Boolean Expression

 Expression

Reason

 

Truth Table for Simplified Expression

A B Q
0 0 0
0 1 0
1 0 0
1 1 0

Q =

Simplified Logical Expression:

Karnaugh Map



Input




Expression

Boolean Expression

Logical Notation



Q =

Binary Output

0 0 0 0 0 0 0 0

True/False Output

false false false false false false false false

Truth Table Output Values

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

Q =

Truth Table with Calculations

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


Q =

Simplifying the Boolean Expression

 Expression

Reason

 

Truth Table for Simplified Expression

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

Q =

Simplified Logical Expression:

Karnaugh Map



Input




Expression

Boolean Expression

Logical Notation



Q =

Binary Output

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

True/False Output

false false false false false false false false false false false false false false false false

Truth Table Output Values

A B C D Q
0 0 0 0 0
0 0 0 1 0
0 0 1 0 0
0 0 1 1 0
0 1 0 0 0
0 1 0 1 0
0 1 1 0 0
0 1 1 1 0
1 0 0 0 0
1 0 0 1 0
1 0 1 0 0
1 0 1 1 0
1 1 0 0 0
1 1 0 1 0
1 1 1 0 0
1 1 1 1 0

Q =

Truth Table with Calculations

A B C D Q
0 0 0 0 0
0 0 0 1 0
0 0 1 0 0
0 0 1 1 0
0 1 0 0 0
0 1 0 1 0
0 1 1 0 0
0 1 1 1 0
1 0 0 0 0
1 0 0 1 0
1 0 1 0 0
1 0 1 1 0
1 1 0 0 0
1 1 0 1 0
1 1 1 0 0
1 1 1 1 0


Q =

Simplifying the Boolean Expression

 Expression

Reason

 

Truth Table for Simplified Expression

A B C D Q
0 0 0 0 0
0 0 0 1 0
0 0 1 0 0
0 0 1 1 0
0 1 0 0 0
0 1 0 1 0
0 1 1 0 0
0 1 1 1 0
1 0 0 0 0
1 0 0 1 0
1 0 1 0 0
1 0 1 1 0
1 1 0 0 0
1 1 0 1 0
1 1 1 0 0
1 1 1 1 0

Q =

Simplified Logical Expression:

Karnaugh Map



Boolean Algebra

Values

Boolean algebra uses two values: true or false.

True is represented by the numeric value 1.

False is represented by the numeric value 0.

Variables

Boolean expressions contain varibles that can represent either true(1) or false(0).

In this activity, the variables are represented by A, B, C and D, with reasons using X, Y and Z.

The values 1 and 0 can also be used in Boolean Expressions.

Logical Operators

Logical operators can be used to perform operations between the Boolean variables using.

There is only one possible operation that can be performed on a single variable.

  • NOT: takes the inverse of the value, changing true to false and false to true

Logical Operators for two variables

The standard logical operations on two variables that are used in this activity are:

  • AND
  • OR
  • XOR
  • NAND
  • NOR

Expressions

Boolean expressions contain a combination of Boolean variables and logical operator.

The result of a Boolean expression can be simplified using a given set of rules.

There are rules that govern how a complex Boolean expression can be simplified (See Rules Tab).

Truth Tables

The result of a Boolean expression can be worked through using a truthtable.

A truth table considers each possible set of values that the variables in a Boolean expression can take and works through the output.

The are four difference combinations of values for two variables with sixteen possible outcomes (See Truth Tables Tab).

The are eight difference combinations of values for three variables with 256 possible outcomes.

The are sixteen difference combinations of values for four variables with 65536 possible outcomes.


A AND B

True if both A and B are true

Boolean Expression

A · B

Logical Notation

A ∧ B

Truth Table for Q = A AND B

A B Q
0 0 0
0 1 0
1 0 0
1 1 1


A OR B

True if either A or B is true

Boolean Expression

A + B

Logical Notation

A ∨ B

Truth Table for Q = A OR B

A B Q
0 0 0
0 1 1
1 0 1
1 1 1


A XOR B (exclusive or)

True if either A or B is true but not both

Boolean Expression

A ⊕ B

Logical Notation

A ⊻ B

Truth Table for Q = A XOR B

A B Q
0 0 0
0 1 1
1 0 1
1 1 0


NOT A

True if A is false and false if A is true

Boolean Expression

~ A

Logical Notation

¬ A

Truth Table for Q = NOT A

A Q
0 1
1 0


A NAND B (not and)

True if (A AND B) is false

Boolean Expression

~ ( A · B )

Logical Notation

¬ ( A ∧ B )

Truth Table for Q = A NAND B

A B Q
0 0 1
0 1 1
1 0 1
1 1 0

NAND Definitions for the other logical operators

NOT A A NAND A
A AND B (A NAND B) NAND (A NAND B)
A AND B (A NAND B) NAND 1
A OR B (A NAND A) NAND (B NAND B)
A NOR B ( ( A NAND A ) NAND ( B NAND B ) ) NAND ( ( A NAND A ) NAND ( B NAND B ))
A NOR B ( ( A NAND A ) NAND ( B NAND B ) ) NAND 1)
A XOR B ( ( A NAND B ) NAND A ) NAND ( ( A NAND B ) NAND B )

A NOR B (not and)

True if (A OR B) is false

Boolean Expression

~ ( A + B )

Logical Notation

¬ ( A ∨ B )

Truth Table for Q = A NOR B

A B Q
0 0 1
0 1 0
1 0 0
1 1 0

NOR Definitions for the other logical operators

NOT A A NOR A
A AND B (A NOR A) NOR (B NOR B)
A OR B (A NOR B) NOR (A NOR B)
A OR B (A NOR B) NOR 0
A NAND B ((A NORA ) NOR (B NORB ) ) NOR ((A NOR A) NOR (B NOR B))
A NAND B ((A NOR A) NOR (B NOR B)) NOR 0
A XOR B (( A NOR B ) NOR A ) NOR ( ( A NOR B ) NOR B) NOR (( A NOR B ) NOR A ) NOR ( ( A NOR B ) NOR B)
A XOR B (( A NOR B ) NOR A ) NOR ( ( A NOR B ) NOR B) NOR 0

Truth tables for two Booleans variables

0

A B Q
0 0 0
0 1 0
1 0 0
1 1 0

A AND B

A B Q
0 0 0
0 1 0
1 0 0
1 1 1

A AND NOT B

A B Q
0 0 0
0 1 0
1 0 1
1 1 0

A

A B Q
0 0 0
0 1 0
1 0 1
1 1 1

NOT A AND B

A B Q
0 0 0
0 1 1
1 0 0
1 1 0

B

A B Q
0 0 0
0 1 1
1 0 0
1 1 1

A XOR B

A B Q
0 0 0
0 1 1
1 0 1
1 1 0

A OR B

A B Q
0 0 0
0 1 1
1 0 1
1 1 1

A NOR B

A B Q
0 0 1
0 1 0
1 0 0
1 1 0

NOT A XOR NOT B

A B Q
0 0 1
0 1 0
1 0 0
1 1 1

NOT B

A B Q
0 0 1
0 1 0
1 0 1
1 1 0

A OR NOT B

A B Q
0 0 1
0 1 0
1 0 1
1 1 1

NOT A

A B Q
0 0 1
0 1 1
1 0 0
1 1 0

NOT A OR B

A B Q
0 0 1
0 1 1
1 0 0
1 1 1

A NAND B

A B Q
0 0 1
0 1 1
1 0 1
1 1 0

1

A B Q
0 0 1
0 1 1
1 0 1
1 1 1

Simplifying Expressions

Brackets

Brackets take the highest priority in any Boolean expression.

The result of the expressions in the brackets are determined first before calculating the result of logical operators between bracketed expressions.

Brackets can be embedded within other brackets.

Operator Priority

As with mathematicsal algebra that uses BIDMAS to order the prioity of each operator, the same principle can be applied to logical operators.

This activity orders the priority of the logical operators as follows


Logical Operator Boolean Expression Priority
NOT ~A · B (~A) · B
AND X · Y + X · Y ⊕ Z (X · Y) + (X · Y) ⊕ Z
XOR X ⊕ Y + Z (X ⊕ Y) + Z
OR A + B · C + D A + (B · C) + D

Expanding Brackets

Brackets are expanded using a similar method to mathematical algebra with AND equating to times and OR equating to plus.


Boolean Expression Expanded
A · (B + C) = A · B + A · B
(A + B) · (C + D) = A · C + A · D + B · C + B · D

Rules and Laws

Rules and laws used when simplifying Boolean expressions.


Boolean Expression Simplified To Law/Concept
A · 1 A Identity
A · 0 0 Null
A + 1 1 Null
A + 0 A Identity
A ⊕ 1 ~A Inverse
A ⊕ 0 A Identity
A · A A Idempotent
A · ~A 0 Inverse
A + A A Idempotent
A + ~A 1 Inverse
A ⊕ A 0 Inverse
A ⊕ ~A 1
A + A · B A Absorption Law
A + B · C (A + B) · (A + C) Distributive law
A + ~A · B (A + ~A) · (A + B) = A + B Distributive and inverse
~(A · B) ~A + ~B De Morgan's Law
~(A + B) ~A · ~B De Morgan's Law
A ⊕ B A · ~B + ~A · B XOR Law
Contents Copyright 2025 Andy Abraham
Please email comments to info@mathsandcomputing.co.uk