If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

Equivalent simple Booleans

A logical statement is equivalent to another statement if it is true in the same situations that the other statement is true, and false in the situations where the other statement is false.
Let's start off with some basic logical equivalences. These may seem simple, but they will serve as important building blocks for more complex logical equivalences later.

Equivalences with NOT

This may be the simplest equivalence rule:
Equivalence
NOT truefalse
NOT falsetrue
Whenever we see the expression in the first column, we can replace it with the expression in the last column, and our logical statement will have the same meaning.
The following statements are logically equivalent according to this rule:
  • when is_hot_out is NOT true, I wear a sweater
  • when is_hot_out is false, I wear a sweater

Two NOT 's

It is also important to know that two NOT operators on an expression have the same value as the expression without any NOT operators:
Equivalence
NOT (NOT A)A

NOT Equal

When programming, it's also possible to apply NOT to the result of an expression using the equality operator:
NOT (speedLimit = carSpeed)
Or in words: check if speedLimit is equal to carSpeed, then apply NOT to the result. This expression will be false when the variables are equal and true when they are not equal.
Programming languages typically include another operator to describe the same idea, the inequality operator:
speedLimit ≠ carSpeed
Or in words: check if speedLimit is not equal to carSpeed.
These two expressions describe the same idea, thus, we have another logical equivalence:
Equivalence
NOT (A = B)A ≠ B
Check Your Understanding
Which of the following statements is true?
Choose all answers that apply:

NOT <, NOT >

A similar idea can be applied to the less than (<) and greater than (>) operators.
Consider this expression:
NOT (carSpeed < speedLimit)
Or in words: check if carSpeed is less than speedLimit, then return the negation.
If carSpeed is less than speedLimit, the whole expression is false. Any other relationship makes the expression true.
Let's walk through this example with real values:
carSpeed ← 50
speedLimit ← 40
NOT (carSpeed < speedLimit)
We can replace the variables with their values:
NOT (50 < 40)
Since 50 < 40 is false, the inner portion is false:
NOT (false)
Then we negate false to find the final result:
true
Similarly, if carSpeed was 40, the result would also be true.
As you might see from this example, an expression of the form NOT (A < B) is equivalent to A ≥ B.
In words, this is saying:
If it's not ‘less than’, it must be ‘greater than or equal to’.
It should also make sense that the rule holds for the other pair:
If it's not ‘greater than’, it must be ‘less than or equal to’.
So, the rules are:
Equivalence
NOT (A < B)A ≥ B
NOT (A > B)A ≤ B.

Equivalences with ≤ and ≥

The symbols ≤ and ≥ are shortcuts for longer expressions. When we speak the names of these operators we say an expression like "less than OR equal to", and in fact, that gives us another set of equivalence rules:
Equivalence
A ≤ BA < B OR A = B
A ≥ BA > B OR A = B
Check Your Understanding
Which of the expressions are equivalent to this one?
days ≥ 365
Choose 1 answer:

Want to join the conversation?