Skip to content

Direct Proof and Counterexample

In this lesson you’ll learn what a mathematical proof actually is, how to write a direct proof of an if-then statement, the standard definitions for even, odd, and divisible that make these proofs possible, and how to disprove a universal claim with one counterexample.

A proof is a convincing argument that a statement is true for every case it claims to cover, built from definitions, previously established results, and valid logic.

The word “every” is what makes this hard, and it’s also why examples aren’t proofs. Checking a claim for n=1,2,3,,100n = 1, 2, 3, \ldots, 100 shows it works 100 times. It says nothing about n=101n = 101.

A proof can use:

  • Definitions. These are the workhorses. Most beginner proofs are just “unfold the definitions and do algebra.”
  • Axioms. Basic assumed truths, like the fact that the sum of two integers is an integer.
  • Previously proven theorems.
  • Valid logical steps.

A proof cannot use: examples, pictures alone, “it’s obvious,” or “everyone knows.”

Almost every proof in this lesson runs on these. Learn them as equations, not as English.

An integer nn is even if there exists an integer kk with

n=2kn = 2k

An integer nn is odd if there exists an integer kk with

n=2k+1n = 2k + 1

An integer aa divides bb, written aba \mid b, if there exists an integer kk with

b=akb = ak

Read aba \mid b as ”aa divides bb,” meaning bb is a multiple of aa with no remainder. The slashed version aba \nmid b means ”aa does not divide bb,” the same way \neq negates ==. So 3123 \mid 12 is true, and 373 \nmid 7 is true because 7 leaves a remainder. Careful not to confuse aba \mid b (a statement, either true or false) with the fraction a/ba/b (a number).

An integer n>1n > 1 is prime if its only positive divisors are 1 and nn.

Two integers are consecutive if they differ by 1, so they look like nn and n+1n+1.

The move that makes proofs work: when you’re told something is even, immediately write n=2kn = 2k. Now you have algebra to do instead of a vague property to reason about.

Most theorems have the form pqp \rightarrow q. A direct proof does this:

  1. Assume pp is true.
  2. Translate pp into equations using definitions.
  3. Work forward with algebra and logic.
  4. Arrive at qq, translated back into words.

The structure on the page:

Claim. If pp, then qq.

Proof. Assume pp. [definitions, algebra, reasoning] Therefore qq. ∎

The ∎ (or QED) marks the end. You’ll also see an open box, □.

“If nn is even, then n2n^2 is even” really means

nZ(n is evenn2 is even)\forall n \in \mathbb{Z} \, (n \text{ is even} \rightarrow n^2 \text{ is even})

That’s why you must work with a general nn and never with a specific one. Starting a proof with “let n=6n = 6” is fatal, no matter how the algebra goes afterward.

To disprove a universal claim, produce one case where it fails. That’s the negation rule from the quantifiers lesson:

¬xP(x)x¬P(x)\neg \forall x \, P(x) \equiv \exists x \, \neg P(x)

One counterexample is a complete disproof. You don’t need to explain why the claim is wrong in general, or find a second counterexample, or feel bad about how easy it was.

Be careful about what you’re negating. To disprove “if pp then qq” you need a case where pp holds and qq fails. A case where pp fails tells you nothing, because the implication is vacuously true there.

  • Assuming the conclusion - starting from what you want to prove and working backward to something true proves nothing on its own. Write it in the valid direction.
  • Using specific numbers - “let’s try n=4n = 4: 42=164^2 = 16, which is even, so it’s proved.” No. That’s one case.
  • Reusing a variable name - if mm and nn are both even, write m=2jm = 2j and n=2kn = 2k. Using 2k2k for both silently assumes they’re equal, which quietly proves a much weaker claim.
  • Circular reasoning - using the theorem, or something equivalent to it, as a step in its own proof.

Example 1: The sum of two even integers is even.

Proof. Let mm and nn be even integers. By definition there exist integers jj and kk with m=2jm = 2j and n=2kn = 2k.

Then

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

Since jj and kk are integers, j+kj + k is an integer. So m+nm + n equals 2 times an integer, which is the definition of even.

Therefore the sum of two even integers is even. ∎

Notice the shape. Unfold definitions, factor out the 2, point at the definition again. That last step, explicitly noting that j+kj+k is an integer, is what makes it rigorous rather than hand-wavy.

Example 2: If nn is odd, then n2n^2 is odd.

Proof. Let nn be an odd integer, so n=2k+1n = 2k + 1 for some integer kk.

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

Let m=2k2+2km = 2k^2 + 2k, which is an integer since kk is. Then n2=2m+1n^2 = 2m + 1, which is odd by definition.

Therefore if nn is odd, n2n^2 is odd. ∎

The trick every time: manipulate the expression into the exact form the definition demands, here 2(something)+12(\text{something}) + 1.

Example 3: The product of two consecutive integers is even.

Proof. Let the integers be nn and n+1n+1. Consider two cases.

Case 1: nn is even. Then n=2kn = 2k, so

n(n+1)=2k(n+1)=2(k(n+1))n(n+1) = 2k(n+1) = 2\big(k(n+1)\big)

which is even.

Case 2: nn is odd. Then n+1=2k+2=2(k+1)n + 1 = 2k + 2 = 2(k+1) is even, so

n(n+1)=n2(k+1)=2(n(k+1))n(n+1) = n \cdot 2(k+1) = 2\big(n(k+1)\big)

which is even.

Every integer is even or odd, so the cases are exhaustive. Therefore n(n+1)n(n+1) is always even. ∎

This is proof by cases. It’s completely legitimate as long as your cases cover every possibility.

Example 4: Divisibility is transitive.

Claim. If aba \mid b and bcb \mid c, then aca \mid c.

Proof. Assume aba \mid b and bcb \mid c. By definition there are integers jj and kk with

b=ajc=bkb = aj \qquad c = bk

Substitute the first into the second:

c=(aj)k=a(jk)c = (aj)k = a(jk)

Since jkjk is an integer, aca \mid c by definition. ∎

Short, clean, and it works for every integer at once. Notice again the two distinct variable names.

Example 5: Disprove a claim.

Claim. For every positive integer nn, the value n2+n+41n^2 + n + 41 is prime.

Disproof. Try small values: n=1n=1 gives 43 (prime), n=2n=2 gives 47 (prime), n=3n=3 gives 53 (prime). It keeps working for a while, which is exactly what makes this claim famous.

But take n=40n = 40:

402+40+41=1600+40+41=1681=41240^2 + 40 + 41 = 1600 + 40 + 41 = 1681 = 41^2

Since 1681=41411681 = 41 \cdot 41, it is not prime. The claim is false. ∎

This one holds for n=1n = 1 through 3939 and then breaks. Forty consecutive successes and the claim is still false. That’s the whole argument for why proofs exist.

Example 6: Disprove a converse.

Claim. If n2n^2 is divisible by 4, then nn is divisible by 4.

Disproof. Take n=6n = 6. Then n2=36n^2 = 36, and 36=4936 = 4 \cdot 9, so n2n^2 is divisible by 4. But 66 is not divisible by 4.

The hypothesis holds and the conclusion fails, so the implication is false. ∎

Proof is the difference between “my tests pass” and “this cannot fail.” Aerospace software, cryptographic protocols, and medical device firmware get formally verified precisely because testing can only ever check finitely many cases, and n=40n = 40 might be the one you skipped.

Counterexamples are how security research works. Nobody proves an encryption scheme is unbreakable by trying it a lot. They look for a single input that breaks the guarantee, and one is enough to retire the algorithm.

In everyday engineering, this shows up as edge cases. “Every user has a last name” is a universal claim, and one user in Indonesia with a single mononym is a counterexample that breaks your form validation. Learning to hunt for counterexamples makes you noticeably better at spotting bad assumptions in a spec before they become bugs.

The style of thinking transfers beyond math too. When someone makes a sweeping claim, the productive response is usually not a counter-sweep. It’s one well-chosen example.

In a direct proof of the statement 'if p then q', what do you begin by doing?
By definition, an integer n is odd when it can be written as...
Which of these is enough to disprove the claim 'for every integer n, n^2 + n + 1 is odd'?
A student writes: 'Let m and n be even. Then m = 2k and n = 2k, so m + n = 4k.' What is wrong?
To disprove the implication 'if a number is divisible by 3, then it is divisible by 9', which counterexample works?