Skip to content

Proof by Contradiction and Contrapositive

In this lesson you’ll learn the two main indirect proof techniques: proof by contrapositive and proof by contradiction. You’ll see how each one is set up, why each is logically valid, and how to tell which one a problem is asking for.

Some statements resist a direct attack. If you assume the hypothesis and get stuck immediately, that’s usually a signal to try an indirect approach.

Recall from the conditionals lesson:

pq¬q¬pp \rightarrow q \equiv \neg q \rightarrow \neg p

The contrapositive is logically equivalent to the original, so proving it proves the original. Not “almost,” not “close enough.” It is the same claim.

The setup:

  1. State that you’ll prove the contrapositive.
  2. Assume ¬q\neg q.
  3. Derive ¬p\neg p directly.
  4. Conclude that pqp \rightarrow q follows.

When to use it: when the negation of the conclusion is more useful than the hypothesis. This happens a lot. “If n2n^2 is even, then nn is even” gives you almost nothing to work with, because ”n2n^2 is even” means n2=2kn^2 = 2k and you can’t take a clean square root of that. But the contrapositive assumes nn is odd, which hands you n=2j+1n = 2j+1 and you’re immediately doing algebra.

Rule of thumb: if the hypothesis is about a squared or composed quantity and the conclusion is about the raw quantity, try the contrapositive.

Also called reductio ad absurdum. The idea: assume your statement is false, and show that assumption forces an impossibility. Since the assumption leads to something that cannot be, the assumption must be wrong, so the statement is true.

To prove a statement SS:

  1. Assume ¬S\neg S.
  2. Reason until you reach a contradiction, meaning something and its own negation are both true.
  3. Conclude ¬S\neg S is impossible, so SS holds.

For an implication pqp \rightarrow q, the negation is p¬qp \wedge \neg q. So you assume the hypothesis holds and the conclusion fails, and hunt for the impossibility.

¬(pq)p¬q\neg(p \rightarrow q) \equiv p \wedge \neg q

When to use it: proving something does not exist, proving something is irrational, proving uniqueness, or any time the claim is hard to build toward but easy to break.

The contradiction you land on can be anything absurd: 1=01 = 0, a number both even and odd, a fraction in lowest terms that isn’t, a smallest element that has something smaller.

They look similar and they’re often confused.

ContrapositiveContradiction
What you assume¬q\neg q onlypp and ¬q\neg q together
What you aim for¬p\neg p, a specific targetany contradiction at all
Applies toimplications onlyany statement
Feels likea direct proof, relabeleda trap you set for yourself

Contrapositive is more constrained, which is usually an advantage. You know exactly what you’re trying to reach. Contradiction is more flexible but you have to notice the absurdity when you hit it.

If a problem is an implication and you can see how ¬q\neg q would give you traction, use the contrapositive. It’s cleaner and easier to check.

Example 1: Contrapositive.

Claim. For any integer nn, if n2n^2 is even, then nn is even.

Proof by contrapositive. The contrapositive is: if nn is odd, then n2n^2 is odd.

Assume nn is odd, so n=2k+1n = 2k+1 for some integer kk. Then

n2=4k2+4k+1=2(2k2+2k)+1n^2 = 4k^2 + 4k + 1 = 2(2k^2 + 2k) + 1

Since 2k2+2k2k^2 + 2k is an integer, n2n^2 is odd.

The contrapositive holds, so the original claim holds. ∎

Try the direct route to feel the difference. Assume n2=2kn^2 = 2k. Now what? You’d need to argue about square roots of a form you don’t control. The contrapositive is a two-line proof.

Example 2: Contrapositive with a sum.

Claim. If m+nm + n is odd, then mm and nn have opposite parity (one even, one odd).

Proof by contrapositive. The contrapositive: if mm and nn have the same parity, then m+nm + n is even.

Case 1: both even. m=2jm = 2j, n=2kn = 2k, so m+n=2(j+k)m + n = 2(j+k), even.

Case 2: both odd. m=2j+1m = 2j+1, n=2k+1n = 2k+1, so

m+n=2j+2k+2=2(j+k+1)m + n = 2j + 2k + 2 = 2(j + k + 1)

which is even.

Same parity forces an even sum, so the original claim holds. ∎

Example 3: Contradiction with a bound.

Claim. There is no largest even integer.

Proof by contradiction. Suppose there is a largest even integer. Call it NN.

Consider N+2N + 2. Since NN is even, N=2kN = 2k, so N+2=2(k+1)N + 2 = 2(k+1) is also even. And N+2>NN + 2 > N.

So N+2N + 2 is an even integer larger than NN, contradicting the assumption that NN was the largest.

The assumption is impossible, so no largest even integer exists. ∎

This is the standard shape for “no largest / no smallest” claims: assume one exists, then construct something bigger or smaller.

Example 4: The classic. 2\sqrt{2} is irrational.

Proof by contradiction. Suppose 2\sqrt{2} is rational. Then it can be written as a fraction in lowest terms:

2=ab\sqrt{2} = \frac{a}{b}

where aa and bb are integers, b0b \neq 0, and a,ba, b share no common factor.

Square both sides:

2=a2b2a2=2b22 = \frac{a^2}{b^2} \quad \Longrightarrow \quad a^2 = 2b^2

So a2a^2 is even. By Example 1, aa must be even. Write a=2ca = 2c:

(2c)2=2b24c2=2b2b2=2c2(2c)^2 = 2b^2 \quad \Longrightarrow \quad 4c^2 = 2b^2 \quad \Longrightarrow \quad b^2 = 2c^2

So b2b^2 is even, and by Example 1 again, bb is even.

But now aa and bb are both even, so they share a factor of 2. That contradicts “lowest terms.”

The assumption is impossible, so 2\sqrt{2} is irrational. ∎

This proof is roughly 2,500 years old and reportedly caused a crisis among the Pythagoreans, who had built a worldview on the idea that all quantities were ratios of whole numbers. Notice it leans on Example 1, which is why we proved that first.

Example 5: Contradiction with primes.

Claim. There are infinitely many prime numbers. (Euclid, around 300 BCE.)

Proof by contradiction. Suppose there are finitely many primes. List them all:

p1,p2,p3,,pnp_1, p_2, p_3, \ldots, p_n

Construct

N=(p1p2p3pn)+1N = (p_1 \cdot p_2 \cdot p_3 \cdots p_n) + 1

NN is larger than every prime in the list, so NN is not on the list, so NN is not prime. Every integer greater than 1 has a prime factor, so some pip_i from the list divides NN.

But pip_i divides the product p1p2pnp_1 p_2 \cdots p_n, so dividing NN by pip_i leaves a remainder of 1. So pip_i does not divide NN.

We have pip_i both dividing and not dividing NN. Contradiction.

Therefore there are infinitely many primes. ∎

Example 6: Contradiction with a rational and an irrational.

Claim. If rr is rational and xx is irrational, then r+xr + x is irrational.

Proof by contradiction. Assume rr is rational, xx is irrational, and r+xr + x is rational.

Write r=abr = \frac{a}{b} and r+x=cdr + x = \frac{c}{d} with integers a,b,c,da,b,c,d and b,d0b,d \neq 0. Then

x=(r+x)r=cdab=cbaddbx = (r + x) - r = \frac{c}{d} - \frac{a}{b} = \frac{cb - ad}{db}

The numerator and denominator are integers and db0db \neq 0, so xx is rational.

But xx was assumed irrational. Contradiction, so r+xr + x must be irrational. ∎

Contradiction is the everyday tool of debugging, whether or not anyone calls it that. “If the cache were working, this response would be fast. It’s slow. So the cache isn’t working.” You assume the thing you doubt, follow it to an observation that conflicts with reality, and eliminate it.

Impossibility results in computer science are all contradiction proofs. The halting problem is undecidable because assuming a halting-detector exists lets you build a program that must both halt and not halt. Similar arguments prove lower bounds on sorting and the impossibility of certain distributed-systems guarantees. These results save enormous effort, because they tell you to stop looking.

Cryptography depends on this style of reasoning. Security proofs are typically of the form “if an attacker could break this scheme, they could also solve a problem believed to be intractable.”

Legal and scientific reasoning use it too. A reductio argument in court (“if the defendant were at the scene, the timestamps would overlap, and they don’t”) is exactly this technique. And in science, the falsification model is contradiction-shaped: derive a consequence from the hypothesis, test it, and if it fails, the hypothesis goes.

To prove 'if p then q' by contrapositive, what do you assume and what do you derive?
When proving the implication 'if p then q' by contradiction, what do you assume?
In the classic proof that the square root of 2 is irrational, what contradiction is reached?
Why is proof by contrapositive often easier than a direct proof for 'if n squared is even, then n is even'?
Which type of claim is proof by contradiction especially well suited to?