Contrapositive (p ⇒ q) ⇔ (¬q ⇒ ¬p): Truth Table | Truth Tables

// laws and rules · Logical equivalence

Contrapositive law_

The contrapositive (or transposition) law states that “if p then q” says exactly the same as “if not q then not p”. The formula (p ⇒ q) ⇔ (¬q ⇒ ¬p) is a tautology. It is the basis of proof by contrapositive and the reason modus tollens is valid.

Example

(p ⇒ q) ⇔ (¬q ⇒ ¬p)

What the variables mean

  • p: “It is a square”
  • q: “It has four sides”

In plain words

“If it is a square, it has four sides” is equivalent to “if it does not have four sides, it is not a square”.

Truth table

pqp ⇒ q¬q¬p¬q ⇒ ¬p(p ⇒ q) ⇔ (¬q ⇒ ¬p)
TTTFFTT
TFFTFFT
FTTFTTT
FFTTTTT
4 combinations2 variables5 steps

Classification: Tautology · 4 rows

Statement

(p ⇒ q) ⇔ (¬q ⇒ ¬p). The contrapositive of an implication is formed by swapping antecedent and consequent and negating both.

Beware of two relatives that are not equivalent to the original: the converse q ⇒ p and the inverse ¬p ⇒ ¬q. Those two are equivalent to each other, but not to p ⇒ q.

Why it is a tautology: reading the table

An implication is F only when its antecedent is T and its consequent F. For p ⇒ q that happens in the row p = T, q = F. For ¬q ⇒ ¬p it happens when ¬q = T and ¬p = F, i.e. q = F and p = T: the very same row.

Since both implications are false in exactly the same row and true in the other three, their columns coincide and the biconditional is T in all four rows.

How it is used in proofs

Proof by contrapositive establishes p ⇒ q by proving ¬q ⇒ ¬p. It helps when the negation of the consequent gives a more workable hypothesis than the original antecedent.

Classic example: to prove “if n² is even, then n is even” one proves “if n is odd, then n² is odd”, which is far more direct.

Examples

Everyday: “If the package was delivered, I got a notification” is equivalent to “if I got no notification, the package was not delivered”.

Programming: the guarantee “if the function returns true, the file exists” is the same as “if the file does not exist, the function returns false”. Both forms describe the same contract.

Relation to other laws

Applying modus ponens to the contrapositive ¬q ⇒ ¬p with premise ¬q is exactly modus tollens on p ⇒ q.

It is proved by combining material implication and commutativity: p ⇒ q ⇔ ¬p ∨ q ⇔ q ∨ ¬p ⇔ ¬¬q ∨ ¬p ⇔ ¬q ⇒ ¬p.

Try it yourself

Edit the expression in the calculator and watch how every step of the table changes.

Open in the calculator →

Related operators

Frequently asked questions

Are contrapositive, converse and inverse the same?

No. From p ⇒ q, the converse is q ⇒ p, the inverse is ¬p ⇒ ¬q and the contrapositive is ¬q ⇒ ¬p. Only the contrapositive is equivalent to the original.

Why is it used so much in mathematics?

Because assuming ¬q is sometimes more convenient than assuming p. The contrapositive lets you choose the easier starting point without changing what is proved.

Is it the same as proof by contradiction?

They are similar but distinct. By contrapositive you prove ¬q ⇒ ¬p directly; by contradiction you assume p ∧ ¬q and derive an absurdity.

Logical equivalence

All laws and rules →