The NOT Operation
Learn how the NOT operation flips true to false and false to true, and how to negate sentences correctly.
Definition
- (mathematical notation, read "not P")
- NOT P (written out)
- !P (programming)
| T | F |
| F | T |
Try it now
Worked Examples
Let = "7 is an even number". Find the truth values of , and .
Evaluate P
7 is odd, so the statement "7 is an even number" is false → P = F
Write the negation in words
= "7 is not an even number" → ¬P in words
Apply NOT
→ ¬P = T
Apply NOT a second time
, which is the same as P → ¬(¬P) = F
Answer: P is false, ¬P is true, and ¬(¬P) is false again. Two NOTs cancel out: ¬(¬P) = P.
Common Mistakes
Negating "All cats are black" as "No cat is black"
Why it's wrong: Both sentences can be false at the same time (some cats are black, some are not), so the second one is not the negation of the first.
Correct: The negation is "Not all cats are black", which means "At least one cat is not black".
Writing the negation of as
Why it's wrong: This forgets the case . For both and are false.
Correct: is : every number that is not greater than 5.
Pulling NOT into a bracket without changing AND/OR:
Why it's wrong: Test it with P = T, Q = F: , but . The two sides are different.
Correct: When NOT goes into the bracket, AND turns into OR: .
Thinking that "not not" is still negative
Why it's wrong: In some languages a double negative in speech is just one negation for emphasis (Spanish "No veo nada", Italian "Non vedo niente"). In logic, however, every NOT counts.
Correct: Two NOTs cancel: . "It is not true that the shop is not open" means the shop is open.
Interactive Visual
Truth Table
| P | ¬P |
|---|---|
| T | |
| F |
T= TrueF= False
Interactive Sandbox
Expression Calculator
Try these:
History
No calculations yet
Practice Problems
18 problemsIf is true, what is ?
Why It Matters
- Everyday language: "The shop is not open" is the negation of "The shop is open"
- Programming: an app checks !loggedIn to show the login screen only to people who are NOT logged in
- Search engines: a search for pizza AND NOT pineapple finds pizza pages that do not mention pineapple
- Electronics: a NOT gate (inverter) turns a signal of 1 into 0 and a signal of 0 into 1
- Arguments: to show that someone is wrong, you need the exact negation of their claim, not just its "opposite"
Real World Applications
Programming and Apps
Programmers write ! in front of a condition to run code only when that condition is false.
Example:
A homework app uses the rule !done: it shows a reminder only when the homework is NOT done.
A homework app shows a reminder when NOT D is true, where D = "homework is done". Right now the homework is not done yet.
Will the reminder appear? (Use 1 for true and 0 for false.)
Step 1: Write the mathematical expression
The app's rule is NOT D. What is its value right now (1 or 0)?
NOT Gates in Electronics
A NOT gate (also called an inverter) has one input and one output. It always outputs the opposite signal.
Example:
A night light uses a light sensor that sends 1 when it is bright. After a NOT gate, the lamp gets 1 only when it is dark.
A signal of 1 goes through two NOT gates connected one after the other.
What signal comes out at the end?
Step 1: Write the mathematical expression
The circuit computes NOT (NOT 1). What is the result?
Shop Rules and Search Filters
Rules and searches often exclude something with AND NOT: the result must match one thing but not another.
Example:
A search for pizza AND NOT pineapple shows pizza pages, except the ones that mention pineapple.
A shop gives a member discount when M AND NOT S is true, where M = "the customer is a member" and S = "the item is already on sale". Lea is a member and buys an item that is already on sale.
Does Lea get the member discount? (Use 1 for true and 0 for false.)
Step 1: Write the mathematical expression
The shop's rule is M AND NOT S. What is its value for Lea (1 or 0)?
Key Takeaways
- 1The NOT operation flips the truth value: and
- 2NOT works on one statement. Symbols: in math, NOT P in words, !P in programming
- 3With 1 and 0: NOT 1 = 0, NOT 0 = 1, and
- 4Negate a sentence with the grammar of your language, and remember that the negation of "all" is "not all"
- 5Double negation: two NOTs cancel,
- 6Brackets matter: and (De Morgan's laws)
Frequently Asked Questions
Glossary
- NOT operation
- A logical operation with one input that turns true into false and false into true
- Negation
- The mathematical name for the NOT operation, written
- Double negation
- Applying NOT twice, which gives back the original value:
- Inverter (NOT gate)
- An electronic part that outputs 0 when the input is 1 and outputs 1 when the input is 0
- De Morgan's laws
- Two rules that show how NOT moves into a bracket and swaps AND with OR
Formula Card
NOT rule
NOT always flips the truth value
NOT with 1 and 0
NOT 1 = 0 and NOT 0 = 1, handy for checking with a calculator
Double negation
Two NOTs cancel each other out
De Morgan's laws
NOT moves into the bracket and AND and OR swap places