The NOT Operation

Learn how the NOT operation flips true to false and false to true, and how to negate sentences correctly.

Intermediate20 minLesson

Definition

The NOT operation (also called logical negation) takes one statement and flips its truth value: true becomes false, and false becomes true.
We write NOT using these symbols:
  • ¬P\neg P (mathematical notation, read "not P")
  • NOT P (written out)
  • !P (programming)
Truth Table for NOT:
PP¬P\neg P
TF
FT
With 1 for true and 0 for false: NOT 1 = 0 and NOT 0 = 1. A handy trick is ¬P=1−P\neg P = 1 - P.
The key insight: unlike AND and OR, NOT needs only one input. A statement and its negation are never both true and never both false. Exactly one of them is true!

Try it now

If PP is true, what is ¬P\neg P?

Worked Examples

Let PP = "7 is an even number". Find the truth values of PP, ¬P\neg P and ¬(¬P)\neg(\neg P).

1

Evaluate P

7 is odd, so the statement "7 is an even number" is false → P = F

2

Write the negation in words

¬P\neg P = "7 is not an even number" → ¬P in words

3

Apply NOT

¬P=¬F=T\neg P = \neg F = T → ¬P = T

4

Apply NOT a second time

¬(¬P)=¬T=F\neg(\neg P) = \neg T = F, which is the same as P → ¬(¬P) = F

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 x>5x > 5 as x<5x < 5

Why it's wrong: This forgets the case x=5x = 5. For x=5x = 5 both x>5x > 5 and x<5x < 5 are false.

Correct: ¬(x>5)\neg(x > 5) is x≤5x \leq 5: every number that is not greater than 5.

Pulling NOT into a bracket without changing AND/OR: ¬(P∧Q)=¬P∧¬Q\neg(P \land Q) = \neg P \land \neg Q

Why it's wrong: Test it with P = T, Q = F: ¬(T∧F)=¬F=T\neg(T \land F) = \neg F = T, but ¬T∧¬F=F∧T=F\neg T \land \neg F = F \land T = F. The two sides are different.

Correct: When NOT goes into the bracket, AND turns into OR: ¬(P∧Q)=¬P∨¬Q\neg(P \land Q) = \neg P \vee \neg Q.

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: ¬(¬P)=P\neg(\neg P) = P. "It is not true that the shop is not open" means the shop is open.

Interactive Visual

Truth Table

¬P
P¬P
T
F

T= TrueF= False

Interactive Sandbox

Expression Calculator

Try these:

History

No calculations yet

Practice Problems

18 problems
Problem 1 of 18
Easy

If PP is true, what is ¬P\neg P?

Why It Matters

Negation is everywhere, even when we do not notice it:
  • 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"
Negating correctly helps you write clear rules and avoid misunderstandings.

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.

1Try It Yourself

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.

2Try It Yourself

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.

3Try It Yourself

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: ¬T=F\neg T = F and ¬F=T\neg F = T
  • 2NOT works on one statement. Symbols: ¬P\neg P in math, NOT P in words, !P in programming
  • 3With 1 and 0: NOT 1 = 0, NOT 0 = 1, and ¬P=1−P\neg P = 1 - P
  • 4Negate a sentence with the grammar of your language, and remember that the negation of "all" is "not all"
  • 5Double negation: two NOTs cancel, ¬(¬P)=P\neg(\neg P) = P
  • 6Brackets matter: ¬(P∨Q)=¬P∧¬Q\neg(P \vee Q) = \neg P \land \neg Q and ¬(P∧Q)=¬P∨¬Q\neg(P \land Q) = \neg P \vee \neg Q (De Morgan's laws)

Frequently Asked Questions

AND and OR combine two statements, but NOT simply changes one statement into its opposite truth value. That is why the NOT truth table has only two rows: P = T and P = F.
AND and OR combine two statements, but NOT simply changes one statement into its opposite truth value. That is why the NOT truth table has only two rows: P = T and P = F.
No. "Not happy" is the negation and covers everything that is not happy: sad, bored, calm and so on. "Sad" is only one of these. A negation is true exactly when the original statement is false.
It is x≤5x \leq 5. Every number is either greater than 5 or not, and "not greater than 5" includes 5 itself.
They tell you how NOT moves into a bracket: ¬(P∧Q)=¬P∨¬Q\neg(P \land Q) = \neg P \vee \neg Q and ¬(P∨Q)=¬P∧¬Q\neg(P \vee Q) = \neg P \land \neg Q. AND turns into OR and OR turns into AND. You will check them row by row in the lesson on truth tables.

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 ¬P\neg P
Double negation
Applying NOT twice, which gives back the original value: ¬(¬P)=P\neg(\neg P) = P
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

¬T=F,¬F=T\neg T = F, \quad \neg F = T

NOT always flips the truth value

NOT with 1 and 0

¬P=1−P\neg P = 1 - P

NOT 1 = 0 and NOT 0 = 1, handy for checking with a calculator

Double negation

¬(¬P)=P\neg(\neg P) = P

Two NOTs cancel each other out

De Morgan's laws

¬(P∧Q)=¬P∨¬Q,¬(P∨Q)=¬P∧¬Q\neg(P \land Q) = \neg P \vee \neg Q, \quad \neg(P \vee Q) = \neg P \land \neg Q

NOT moves into the bracket and AND and OR swap places

More in This Topic