Discrete Math • Logic and Proof

Proof by contrapositive

Proving a statement by establishing the logical equivalence of its contrapositive form.

A connected graph with binary values and set braces for discrete mathematics
Inside this lesson 10 sections 5 questions 8 figures

SECTION 1

Historical Context & Motivation

The technique of proving a statement by establishing its contrapositive has deep roots in the history of logic, stretching back to antiquity. Ancient Greek philosophers recognized that certain conditional statements could be reframed in logically equivalent ways, and this insight eventually matured into one of the most versatile proof strategies in mathematics. The development of contrapositive reasoning is intertwined with the broader evolution of formal logic, from Aristotle's syllogistic framework through the symbolic revolution of the nineteenth century. Understanding this lineage reveals why the contrapositive occupies such a central place in modern proof technique: it converts difficult direct arguments into tractable ones by shifting the logical perspective.

~350 BCE • Aristotle's Syllogistic Logic

In his Prior Analytics, Aristotle formalized the idea of converting propositions, noting that 'if A belongs to no B, then B belongs to no A.' This principle of conversion laid the groundwork for contrapositive reasoning within the syllogistic framework.

~300 BCE • Euclid's Indirect Methods

Euclid employed indirect proof methods extensively in the Elements. While his primary tool was proof by contradiction (reductio ad absurdum), many of his arguments implicitly rely on contrapositive reasoning, demonstrating the technique's utility in classical geometry.

1847 • Boole's Symbolic Logic

George Boole's The Mathematical Analysis of Logic introduced algebraic methods to propositional logic, making the equivalence between a conditional and its contrapositive formally verifiable through symbolic computation.

1879 • Frege's Predicate Calculus

Gottlob Frege's Begriffsschrift established first-order predicate logic, providing the rigorous formal system in which the law of contraposition — (P → Q) ≡ (¬Q → ¬P) — could be stated and proved as a theorem of propositional calculus.

20th Century • Modern Proof Pedagogy

With the rise of discrete mathematics as a core university subject, proof by contrapositive became a standard technique taught alongside direct proof, contradiction, and induction, recognized for its elegance and strategic value in number theory, analysis, and combinatorics.

The central question that contrapositive reasoning addresses is both simple and profound: when a direct proof of P → Q is difficult — perhaps because the hypothesis P does not yield enough structural information to work with — can we instead start from ¬Q and derive ¬P? The logical equivalence between these two forms guarantees that proving one is exactly as valid as proving the other. This strategic flexibility is what makes the contrapositive approach indispensable in a mathematician's toolkit.

SECTION 2

Core Principles & Definitions

Before diving into the mechanics of proof by contrapositive, it is essential to establish the logical foundations upon which the technique rests. At its heart, the method exploits a fundamental equivalence in propositional logic — the fact that a conditional statement and its contrapositive always share the same truth value. This equivalence is not merely a convenient trick; it is a theorem of propositional calculus, verifiable through truth tables, natural deduction, or algebraic manipulation of Boolean expressions. The following core principles outline the conceptual architecture of the method.

1

The Conditional (P → Q)

A conditional statement asserts that whenever P is true, Q must also be true. It is false only when the hypothesis P is true and the conclusion Q is false.
2

The Contrapositive (¬Q → ¬P)

The contrapositive of P → Q is ¬Q → ¬P. It negates both components and reverses their order. A conditional and its contrapositive are logically equivalent — they are true under exactly the same truth-value assignments.
3

Converse vs. Contrapositive

The converse of P → Q is Q → P, which is NOT logically equivalent to the original. Confusing the converse with the contrapositive is a common logical error. The converse is equivalent to the inverse (¬P → ¬Q), not to the original statement.
4

Logical Equivalence (≡)

Two propositions are logically equivalent when they have identical truth values in every possible truth-value assignment. The equivalence (P → Q) ≡ (¬Q → ¬P) can be verified by constructing a truth table with all four combinations of truth values for P and Q.
5

Strategic Advantage

The contrapositive is preferred when the negation of the conclusion (¬Q) provides more concrete structural information than the hypothesis (P) alone. Assuming ¬Q often 'unlocks' algebraic or set-theoretic properties that make the derivation of ¬P straightforward.
✦

KEY TAKEAWAY

Think of proof by contrapositive like navigating a one-way street system. If the direct route from P to Q is blocked by heavy traffic (i.e., the hypothesis doesn't give you much to work with), you can instead drive from ¬Q to ¬P — the contrapositive route. Because the two routes are logically equivalent, arriving at ¬P via ¬Q is just as valid as reaching Q from P directly. The key insight is that you are still proving exactly the same theorem; you have merely chosen a different starting point that makes the journey easier.

SECTION 3

Visual Explanation

The logical equivalence between a conditional and its contrapositive can be visualized effectively through a truth-table diagram and a relationship map of the four related conditional forms. The following diagram illustrates how the original statement P → Q connects to its converse, inverse, and contrapositive, highlighting which pairs are logically equivalent and which are not.

Four Related Conditional FormsORIGINALP → QCONTRAPOSITIVE¬Q → ¬PINVERSE¬P → ¬QCONVERSEQ → PLOGICALLY EQUIVALENT ≡LOGICALLY EQUIVALENT ≡Negate bothNegate bothNOT equivalent ✗NOT equivalent ✗Green lines = logically equivalent pairs · Red dashed = NOT equivalent
The four related forms of a conditional statement. The green connections indicate logically equivalent pairs: the original is equivalent to the contrapositive, and the converse is equivalent to the inverse. The red dashed lines indicate pairs that are NOT logically equivalent — confusing these is a common fallacy.

Notice that the two green-linked pairs occupy opposite corners of this conceptual square. The original statement and its contrapositive always share identical truth values, as do the converse and the inverse. However, the original and its converse can differ in truth value — for instance, 'if it is raining, then the ground is wet' is true, but its converse 'if the ground is wet, then it is raining' is not necessarily true (a sprinkler could be running). The diagram underscores a critical lesson: only the contrapositive preserves logical equivalence, making it a safe substitute for the original statement in any proof.

SECTION 4

Mathematical Framework

The law of contraposition is a theorem of propositional logic that can be derived from more primitive logical axioms or verified directly via truth tables. In this section we formalize the equivalence, present its truth-table verification, and discuss the proof template that arises from it.

LAW OF CONTRAPOSITION

(P→Q)≡(¬Q→¬P)(P → Q) ≡ (¬Q → ¬P)

where P and Q are propositions, → denotes the material conditional, ¬ denotes negation, and ≡ denotes logical equivalence.

EQUIVALENCE VIA MATERIAL CONDITIONAL

P→Q≡¬P∨Q≡¬Q→¬PP → Q ≡ ¬P ∨ Q ≡ ¬Q → ¬P

The material conditional P → Q can be rewritten as ¬P ∨ Q (by definition). Since disjunction is commutative, ¬P ∨ Q = Q ∨ ¬P, which is not directly useful; however, applying the conditional definition in reverse to ¬Q → ¬P gives ¬(¬Q) ∨ ¬P = Q ∨ ¬P = ¬P ∨ Q, confirming the equivalence.

PQP → Q¬Q¬P¬Q → ¬P
TTTFFT
TFFTFF
FTTFTT
FFTTTT

Truth-table verification that P → Q and ¬Q → ¬P have identical truth values in all four rows.

The truth table confirms that the columns for P → Q and ¬Q → ¬P are identical across all four possible truth-value assignments, which is the definition of logical equivalence. The only row where the conditional is false is when the hypothesis is true and the conclusion is false — this occurs in row 2 for both the original and the contrapositive.

PROOF TEMPLATE

Toprove:P→QProveinstead:¬Q→¬P1.Assume¬Q.2.[Chainoflogicaldeductions…]3.Conclude¬P.∎To prove: P → Q Prove instead: ¬Q → ¬P 1. Assume ¬Q. 2. [Chain of logical deductions…] 3. Conclude ¬P. ∎

The proof proceeds by assuming the negation of the conclusion and deriving the negation of the hypothesis. Once this is accomplished, the original conditional P → Q is established by logical equivalence.

SECTION 5

When to Use the Contrapositive

Knowing the mechanics of proof by contrapositive is only half the battle; the real skill lies in recognizing when the technique is the right strategic choice. There are several recurring structural signals in a problem that suggest the contrapositive may be more tractable than a direct proof. The following diagram categorizes these signals and contrasts the contrapositive approach with direct proof and proof by contradiction.

Decision Flowchart: Choosing a Proof StrategyGoal: Prove P → QDoes assuming P give useful structure?YESNOUse DIRECT PROOFAssume P, derive QDoes ¬Q give useful structure?YESNOUse CONTRAPOSITIVEAssume ¬Q, derive ¬PCONTRADICTIONAssume ¬(P→Q)Common Signals Favoring Contrapositive• Conclusion Q involves existence/disjunction that is hard to prove directly• Negating Q yields a concrete, algebraic, or divisibility condition to exploit
A decision flowchart for selecting among direct proof, proof by contrapositive, and proof by contradiction. The key question is whether the negation of the conclusion (¬Q) provides more workable structure than the hypothesis (P) alone.

Typical Scenarios for Contrapositive Proofs

  • The conclusion involves irrationality or non-divisibility. Proving that a number is irrational directly is often awkward, but assuming rationality (¬Q) provides an algebraic form p/q that is easy to manipulate.
  • The conclusion is a negation. If Q is of the form '… is not …', then ¬Q becomes an affirmative statement, which is typically easier to assume as a starting hypothesis.
  • The hypothesis is weak or broadly stated. When P says 'for all n in ℤ' but Q pins down a specific structural property, assuming ¬Q often gives you concrete values or cases to examine.
  • Parity and divisibility arguments. Statements like 'if n² is even then n is even' are naturally suited to the contrapositive ('if n is odd then n² is odd'), because odd-number arithmetic is self-contained.

SECTION 6

Worked Example

Let us work through a classic example that demonstrates the power of the contrapositive approach. The statement is one of the most frequently encountered in introductory proof courses, and it illustrates how negating the conclusion yields a hypothesis that is algebraically far more tractable.

Prove: If n² is even, then n is even (for n ∈ ℤ).

  1. 1

    Step 1 — Identify the Original Statement

    We wish to prove the conditional: P → Q, where P is 'n² is even' and Q is 'n is even.' A direct proof would assume n² is even and attempt to show n is even, but the parity of n² does not immediately reveal the parity of n in an obvious algebraic way.
    P = 'n² is even', Q = 'n is even'
  2. 2

    Step 2 — Formulate the Contrapositive

    The contrapositive is ¬Q → ¬P, which reads: 'If n is not even (i.e., n is odd), then n² is not even (i.e., n² is odd).' This version is much more amenable to direct computation.
    Contrapositive: 'If n is odd, then n² is odd.'
  3. 3

    Step 3 — Assume ¬Q

    Assume that n is odd. By the definition of odd integers, there exists an integer k such that n = 2k + 1.
    n = 2k + 1 for some k ∈ ℤ
  4. 4

    Step 4 — Derive ¬P

    Compute n²: n² = (2k + 1)² = 4k² + 4k + 1 = 2(2k² + 2k) + 1. Let m = 2k² + 2k, which is an integer since k is an integer. Then n² = 2m + 1, which is odd by definition. Hence n² is not even.
    n² = 2m + 1 is odd ⇒ ¬P holds.
  5. 5

    Step 5 — Conclude

    We have shown that ¬Q → ¬P. Since the contrapositive is logically equivalent to the original conditional, we conclude that if n² is even, then n is even. ∎
    The original statement P → Q is proved. ∎
💡

Why Contrapositive Was Better Here

In a direct proof, assuming 'n² is even' means n² = 2j for some integer j, so n = √(2j). This expression is not immediately useful because square roots of arbitrary products do not simplify cleanly over the integers. By contrast, the contrapositive assumption 'n is odd' gives us n = 2k + 1, a concrete algebraic form that squares neatly. This is a textbook example of how the negation of the conclusion can be more algebraically cooperative than the original hypothesis.

SECTION 7

Contrapositive vs. Other Proof Techniques

Proof by contrapositive is one member of a family of indirect proof strategies, and it is frequently confused with proof by contradiction. While both involve reasoning about negations, they differ in significant structural ways. Understanding these differences is essential for selecting the right technique and for writing proofs that are clean, well-organized, and logically precise.

FeatureDirect ProofContrapositiveContradiction
What you assumeP is true¬Q is trueP ∧ ¬Q is true
What you deriveQ¬PA logical contradiction
Logical foundationModus ponensLaw of contrapositionLaw of excluded middle
Goal is clear?Yes — derive QYes — derive ¬PNo — any contradiction suffices
Best when…P gives direct algebraic/structural leverage¬Q is more concrete or algebraic than PThe statement is existential or no clear direction exists
Constructive?YesYesNot necessarily

Comparison of three major proof techniques for conditional statements.

⚡

KEY DISTINCTION

The most important difference between contrapositive and contradiction is the specificity of the target. In a contrapositive proof, you know exactly what you need to derive: ¬P. In a proof by contradiction, you assume both P and ¬Q and then hunt for any contradiction — which can feel aimless if the logical landscape is large. When both methods are available, the contrapositive is usually more elegant because it has a definite endpoint. Think of it like solving a maze: the contrapositive is entering from the exit and walking backward to the start (you know your destination), while contradiction is wandering the maze looking for a wall that shouldn't be there.
⚠

Common Mistake

Many students write a 'proof by contrapositive' but actually structure it as a contradiction proof in disguise — they assume P ∧ ¬Q and derive a contradiction, rather than assuming only ¬Q and deriving ¬P. While both are valid, mislabeling the technique reveals a misunderstanding of the logical structure. Always check: did you assume just ¬Q, or did you also use P? If you used P, you are doing contradiction, not contrapositive.

SECTION 8

Connections to Advanced Theory

The contrapositive is not merely a pedagogical tool for introductory proofs — it appears naturally and frequently in advanced mathematics. In real analysis, many epsilon-delta arguments are most cleanly stated in contrapositive form. In abstract algebra, contrapositive reasoning underlies numerous results about group homomorphisms and ring ideals. In theoretical computer science, the relationship between a conditional and its contrapositive is central to program verification and automated theorem proving, where resolution-based provers routinely convert implications to their contrapositive forms as part of the clause normalization process.

Advanced TopicRole of ContrapositiveExample
Real AnalysisContinuity and convergence theorems often have contrapositives that are easier to apply as 'divergence detectors.'If f is continuous at a, then lim f(xₙ) = f(a) for every xₙ → a. Contrapositive: if some xₙ → a but f(xₙ) ↛ f(a), then f is discontinuous at a.
Abstract AlgebraContrapositive form of homomorphism properties yields practical tests for non-isomorphism.If G ≅ H, then |G| = |H|. Contrapositive: if |G| ≠ |H|, then G ≇ H — a quick non-isomorphism test.
Computability TheoryReductions between decision problems use the contrapositive to transfer undecidability results.If A ≤ₘ B and B is decidable, then A is decidable. Contrapositive: if A is undecidable and A ≤ₘ B, then B is undecidable.
Formal VerificationHoare logic's rule of consequence uses contrapositives of pre/postcondition implications during weakest precondition calculations.If {P} S {Q} and Q → R, then {P} S {R}. The contrapositive of postcondition strengthening guides refinement.

Applications of contrapositive reasoning in advanced mathematical and computational disciplines.

It is also worth noting the philosophical dimension: in constructive mathematics and intuitionistic logic, the law of contraposition does not hold in its full classical form. Specifically, (¬Q → ¬P) → (P → Q) is not an intuitionistic tautology, because it implicitly relies on the law of excluded middle (P ∨ ¬P). In the classical logic used throughout standard mathematics courses, this is a non-issue — but if you continue into mathematical logic, type theory, or programming language semantics, the distinction becomes significant.

SECTION 9

Practice Problems

Question 1: CONCEPTUAL

Consider the statement 'If n is a perfect square, then n is not prime (for n > 1).' Write its contrapositive. Is the contrapositive logically equivalent to the original? Explain why or why not, and identify which form — original or contrapositive — would be easier to prove directly.
Show answer
The contrapositive is: 'If n is prime, then n is not a perfect square (for n > 1).' Yes, the contrapositive is logically equivalent to the original because (P → Q) ≡ (¬Q → ¬P) is a tautology of propositional logic. In this case, the contrapositive is arguably easier to prove: if n is prime, then n = p for some prime p, and the only factors of p are 1 and p. A perfect square k² with k² > 1 requires k ≥ 2, so k² ≥ 4, and k² has k as a non-trivial factor, contradicting primality. Thus the contrapositive provides a cleaner proof path because the hypothesis 'n is prime' gives more structural information than 'n is a perfect square.'

Question 2: BASIC APPLICATION

Prove by contrapositive: For all integers n, if 3n + 2 is odd, then n is odd.
Show answer
We prove the contrapositive: 'If n is even, then 3n + 2 is even.' Assume n is even, so n = 2k for some integer k. Then 3n + 2 = 3(2k) + 2 = 6k + 2 = 2(3k + 1). Since 3k + 1 is an integer, 3n + 2 = 2m where m = 3k + 1, so 3n + 2 is even. This establishes ¬Q → ¬P. By logical equivalence, the original statement P → Q is proved. ∎ Note how the assumption 'n is even' immediately gave us the algebraic form n = 2k, which propagated cleanly through the arithmetic.

Question 3: INTERMEDIATE

Prove by contrapositive: For all integers a and b, if ab is odd, then both a and b are odd.
Show answer
The contrapositive is: 'If a is even or b is even (i.e., not both odd), then ab is even.' Note that ¬(a is odd ∧ b is odd) ≡ (a is even ∨ b is even) by De Morgan's law. Assume, without loss of generality, that a is even (the case where b is even is symmetric). Then a = 2k for some integer k, so ab = 2kb = 2(kb). Since kb is an integer, ab is even. Therefore ¬Q → ¬P is established. By logical equivalence, the original statement holds. ∎ This problem illustrates how the contrapositive handles a conjunctive conclusion (both a and b are odd) by converting it via De Morgan's law to a disjunctive hypothesis, which can be addressed by cases.

Question 4: APPLIED

In a directed graph G, define a path from vertex u to vertex v as a sequence of edges connecting u to v. Prove by contrapositive: If there is a path from u to v in G, then the removal of any single edge e not on that path leaves a path from u to v in G − e.
Show answer
The contrapositive states: 'If the removal of some edge e from G destroys all paths from u to v, then e lies on every path from u to v in G.' Assume that removing edge e eliminates all u-to-v paths in G − e. Suppose for contradiction that there existed a path π in G from u to v that did not use e. Then π would use only edges in G − {e}, which means π exists in G − e, contradicting our assumption. Therefore every path from u to v in G must traverse e — that is, e lies on every u-to-v path. This proves ¬Q → ¬P, establishing the original statement by contraposition. ∎ Note: within the contrapositive proof, we used a small contradiction argument to handle the 'every path' quantifier, which is a common and perfectly acceptable hybrid technique.

Question 5: CRITICAL THINKING

A student claims the following proof is a valid proof by contrapositive of 'If n² is divisible by 4, then n is even': 'Assume n² is divisible by 4 and n is odd. Then n = 2k + 1, so n² = 4k² + 4k + 1, which gives remainder 1 when divided by 4. This contradicts the assumption that 4 | n². Therefore n is even.' Identify the logical error in the student's labeling (not in the argument's validity), explain what proof technique was actually used, and then write a correct proof by contrapositive.
Show answer
The student's argument is valid, but it is mislabeled: it is a proof by contradiction, not by contrapositive. The student assumed both P (n² is divisible by 4) and ¬Q (n is odd) simultaneously, then derived a contradiction. A genuine contrapositive proof assumes only ¬Q and derives ¬P, without ever assuming P. Correct proof by contrapositive: Assume n is odd (¬Q). Then n = 2k + 1 for some integer k. Compute n² = (2k + 1)² = 4k² + 4k + 1. Now 4k² + 4k + 1 = 4(k² + k) + 1, so n² leaves remainder 1 upon division by 4. Therefore 4 ∤ n², i.e., n² is not divisible by 4 (¬P). Since ¬Q → ¬P is established, the original P → Q follows by contraposition. ∎ The critical distinction is that the correct contrapositive proof never mentions the hypothesis P; it derives ¬P purely from the assumption ¬Q.

SUMMARY

Lesson Summary

Summary

Proof by contrapositive is a powerful indirect proof technique that exploits the logical equivalence between a conditional statement P → Q and its contrapositive ¬Q → ¬P. Instead of assuming the hypothesis P and deriving the conclusion Q directly, you assume the negation of the conclusion (¬Q) and derive the negation of the hypothesis (¬P). The technique is most effective when ¬Q provides more concrete algebraic or structural information than P does — common scenarios include parity arguments, divisibility proofs, and statements whose conclusions involve negations or irrationality.

The contrapositive must not be confused with the converse (Q → P) or the inverse (¬P → ¬Q), neither of which is logically equivalent to the original. Furthermore, proof by contrapositive differs from proof by contradiction in that the contrapositive assumes only ¬Q (not P ∧ ¬Q) and derives a specific target (¬P), rather than hunting for an unspecified contradiction. This clarity of structure makes the contrapositive approach preferred whenever it is applicable, and it extends naturally to advanced contexts in analysis, algebra, and computer science.

Varsity Tutors • Discrete Math • Proof by contrapositive