evan's notes
cal 3discreteodeenv systems

On this page

  • Quantifier order and dependence
  • Game semantics
  • When quantifier order does not matter
  • Let the statement guide the proof
  • Example: the square of an odd integer
  • Direct proof
  • Proving a disjunction
  • Example with a product bound
  • Proof by contrapositive
  • Example: if the square is odd, the integer is odd
  • Combining both directions

Discrete Structures

§7 Direct Proofs and Contrapositives

Evan Luo · Sep 29, 2026

Discrete Structures

§7 Direct Proofs and Contrapositives

Evan LuoYesterday

11 min read

A proof has to meet the exact claim being made. “Every” asks for an argument that handles an arbitrary input. “There exists” asks us to establish that a suitable object exists. “If” lets us assume a hypothesis, while “if and only if” asks for two directions. Reading that structure first tells us what we may assume, what we can choose, and what we still need to show.

These proof methods build on predicates and quantifiers.

Quantifier order and dependence

Consider these two statements over the real numbers, written R\mathbb RR:

∀x∈R  ∃y∈R  (x+y=0),\forall x\in\mathbb R\;\exists y\in\mathbb R\;(x+y=0), ∀x∈R∃y∈R(x+y=0), ∃y∈R  ∀x∈R  (x+y=0).\exists y\in\mathbb R\;\forall x\in\mathbb R\;(x+y=0). ∃y∈R∀x∈R(x+y=0).

The equation is the same, but the order changes what is being claimed.

  • The first says that each real number xxx has some additive inverse yyy: a number that adds to xxx to give zero. We may choose a different yyy for each xxx.
  • The second says that one fixed real number yyy adds to zero with every real number xxx.

The first is true. Given any x∈Rx\in\mathbb Rx∈R, choose y=−xy=-xy=−x. This is a real number, and

x+y=x+(−x)=0.x+y=x+(-x)=0. x+y=x+(−x)=0.

The second is false. Whatever real number yyy is proposed, choose x=1−yx=1-yx=1−y. Then

x+y=(1−y)+y=1≠0.x+y=(1-y)+y=1\ne0. x+y=(1−y)+y=1=0.

This defeats every proposed yyy, not just one particular choice. In general, we cannot swap a universal and an existential quantifier and expect the statement to keep its meaning.

Game semantics

Game semantics makes this dependence explicit by imagining two players reading a quantified statement from left to right:

  • Adam chooses the value at each universal quantifier, ∀\forall∀.
  • Eve chooses the value at each existential quantifier, ∃\exists∃.
  • Each value must belong to the quantifier's domain. A choice may depend on earlier moves, but not on moves that have not happened yet.

For the two formulas above, the players evaluate the equation after choosing both values. Eve wins if it is true; Adam wins if it is false.

A winning strategy is a rule that guarantees a win against every legal choice by the other player. Winning one play is not enough. In this quantifier game, a true statement gives Eve a winning strategy, while a false statement gives Adam one.

For ∀x ∃y (x+y=0)\forall x\,\exists y\,(x+y=0)∀x∃y(x+y=0), Adam moves first and Eve responds with y=−xy=-xy=−x. For ∃y ∀x (x+y=0)\exists y\,\forall x\,(x+y=0)∃y∀x(x+y=0), Eve must commit first, and Adam responds with x=1−yx=1-yx=1−y. The order determines who can respond to whom.

This viewpoint is useful when writing a proof: describe a choice or argument that still works when the universally quantified inputs are arbitrary. It is not enough to show that a few convenient choices work.

When quantifier order does not matter

Two adjacent universal quantifiers can be swapped, as can two adjacent existential quantifiers. Here the quantifiers must range over fixed domains, each independent of the other variable. Let AAA and BBB be sets, and let P(x,y)P(x,y)P(x,y) be a predicate with x∈Ax\in Ax∈A and y∈By\in By∈B. Then

(∀x∈A  ∀y∈B  P(x,y))≡(∀y∈B  ∀x∈A  P(x,y)),\bigl(\forall x\in A\;\forall y\in B\;P(x,y)\bigr) \equiv \bigl(\forall y\in B\;\forall x\in A\;P(x,y)\bigr), (∀x∈A∀y∈BP(x,y))≡(∀y∈B∀x∈AP(x,y)), (∃x∈A  ∃y∈B  P(x,y))≡(∃y∈B  ∃x∈A  P(x,y)).\bigl(\exists x\in A\;\exists y\in B\;P(x,y)\bigr) \equiv \bigl(\exists y\in B\;\exists x\in A\;P(x,y)\bigr). (∃x∈A∃y∈BP(x,y))≡(∃y∈B∃x∈AP(x,y)).

The two universal statements both require every pair to satisfy PPP. The two existential statements both require at least one pair to satisfy PPP. Reordering these same-type quantifiers does not change either requirement. In the game, the same player makes both choices: Adam for two universal quantifiers, Eve for two existential quantifiers.

For example, R2\mathbb R^2R2 is the set of ordered pairs of real numbers. These three statements all say that every real pair satisfies the given equation:

∀x∈R  ∀y∈R  (x2+y2=1),∀y∈R  ∀x∈R  (x2+y2=1),∀(x,y)∈R2  (x2+y2=1).\begin{aligned} &\forall x\in\mathbb R\;\forall y\in\mathbb R\;(x^2+y^2=1),\\ &\forall y\in\mathbb R\;\forall x\in\mathbb R\;(x^2+y^2=1),\\ &\forall(x,y)\in\mathbb R^2\;(x^2+y^2=1). \end{aligned} ​∀x∈R∀y∈R(x2+y2=1),∀y∈R∀x∈R(x2+y2=1),∀(x,y)∈R2(x2+y2=1).​

They are equivalent, and all three are false. Adam can choose x=10x=10x=10 and y=4y=4y=4, since

102+42=116≠1.10^2+4^2=116\ne1. 102+42=116=1.

One counterexample defeats a universal claim. This is different from exchanging ∀\forall∀ with ∃\exists∃, where the players' dependence on each other's choices can change the truth of the statement.

Let the statement guide the proof

A direct proof starts from the given assumptions and establishes the conclusion. Its steps follow the logical structure of the statement.

Let UUU be the universe of objects under discussion, let P(x)P(x)P(x) be a predicate on UUU, and let ppp and qqq be propositions. An object that makes an existential claim true is called a witness. The following are useful ways to approach different goals:

GoalWhat to do
∀x∈U P(x)\forall x\in U\,P(x)∀x∈UP(x)Let xxx be an arbitrary element of UUU, then prove P(x)P(x)P(x) without assuming anything special about xxx.
∃x∈U P(x)\exists x\in U\,P(x)∃x∈UP(x)Construct a witness xxx, check that x∈Ux\in Ux∈U, and show that P(x)P(x)P(x) holds.
Implication: p⇒qp\Rightarrow qp⇒qAssume ppp is true and prove qqq.
Conjunction: p∧qp\land qp∧qProve both ppp and qqq.
Disjunction: p∨qp\lor qp∨qProve at least one of ppp and qqq. Which one is convenient may depend on the given inputs.
Negation: ¬p\neg p¬pRewrite the negation into a useful equivalent statement and prove it. Another method is to assume ppp and derive a contradiction.
Biconditional: p⇔qp\Leftrightarrow qp⇔qProve p⇒qp\Rightarrow qp⇒q and q⇒pq\Rightarrow pq⇒p.

For a conjunction, both claims must stand up to a challenge: Adam could ask for either one. For a disjunction, Eve can choose which claim to establish; each of the two claims is called a disjunct. The connective ∨\lor∨ is inclusive OR, so proving both is allowed, but not required.

These are proof strategies, not claims that there is only one possible method. For example, an existence claim can also be proved indirectly rather than by explicitly constructing a witness.

A conjecture is a claim whose truth we have not yet established. Once it is proved, it becomes a theorem. To investigate a conjecture, first make its assumptions and conclusion precise. Definitions often show what the proof needs to produce.

Example: the square of an odd integer

Write Z\mathbb ZZ for the set of integers. For an integer nnn, the definitions of even and odd are

n is even⟺∃k∈Z  (n=2k),n is odd⟺∃k∈Z  (n=2k+1).\begin{aligned} n\text{ is even} &\quad\Longleftrightarrow\quad \exists k\in\mathbb Z\;(n=2k),\\ n\text{ is odd} &\quad\Longleftrightarrow\quad \exists k\in\mathbb Z\;(n=2k+1). \end{aligned} n is evenn is odd​⟺∃k∈Z(n=2k),⟺∃k∈Z(n=2k+1).​

Every integer is exactly one of even or odd. Whether an integer is even or odd is its parity. This matters later: for integers, “not odd” means “even,” and “not even” means “odd.”

We want to prove:

If nnn is an odd integer, then n2n^2n2 is odd.

Expanding the definition of odd makes the required witnesses visible:

∀n∈Z  [(∃k∈Z  (n=2k+1))⇒(∃ℓ∈Z  (n2=2ℓ+1))].\forall n\in\mathbb Z\; \left[ \left(\exists k\in\mathbb Z\;(n=2k+1)\right) \Rightarrow \left(\exists\ell\in\mathbb Z\;(n^2=2\ell+1)\right) \right]. ∀n∈Z[(∃k∈Z(n=2k+1))⇒(∃ℓ∈Z(n2=2ℓ+1))].

The two witnesses have different roles. The assumption supplies an integer kkk representing nnn. The conclusion asks us to produce an integer ℓ\ellℓ representing n2n^2n2.

Direct proof

Let n∈Zn\in\mathbb Zn∈Z be arbitrary and assume nnn is odd. Then n=2k+1n=2k+1n=2k+1 for some integer kkk. Our goal is to write n2=2ℓ+1n^2=2\ell+1n2=2ℓ+1 with ℓ∈Z\ell\in\mathbb Zℓ∈Z.

Square the expression for nnn, then separate one from an even term:

n2=(2k+1)2=4k2+4k+1=2(2k2+2k)+1.\begin{aligned} n^2 &=(2k+1)^2\\ &=4k^2+4k+1\\ &=2(2k^2+2k)+1. \end{aligned} n2​=(2k+1)2=4k2+4k+1=2(2k2+2k)+1.​

Choose ℓ=2k2+2k\ell=2k^2+2kℓ=2k2+2k. Because kkk is an integer, its products and sums are integers too, so ℓ\ellℓ is an integer. We now have n2=2ℓ+1n^2=2\ell+1n2=2ℓ+1, which is exactly the definition of odd. This proves the claim for every odd integer nnn.

Notice which choices were available. We could not set kkk to a convenient value: once nnn was given, kkk had to satisfy n=2k+1n=2k+1n=2k+1. We were free to construct ℓ\ellℓ using that kkk. Choosing a witness means meeting the required equation and domain, not choosing an arbitrary number.

Proving a disjunction

To prove p∨qp\lor qp∨q, it is enough to establish either disjunct. Sometimes neither one is guaranteed by itself, so we split according to whether ppp is true:

  • If ppp is true, the disjunction is already true.
  • If ppp is false, prove qqq.

This is captured by the logical equivalence

p∨q≡(¬p⇒q).p\lor q\equiv(\neg p\Rightarrow q). p∨q≡(¬p⇒q).

So we may prove p∨qp\lor qp∨q by assuming ¬p\neg p¬p and deriving qqq. This does not mean that we are allowed to prove qqq only when ppp is false. Either disjunct always suffices; the equivalence just gives a useful conditional strategy.

Example with a product bound

Let aaa, bbb, and ccc be positive real numbers. We want to prove that if ab≤cab\le cab≤c, then

a≤corb≤c.a\le\sqrt c\quad\text{or}\quad b\le\sqrt c. a≤c​orb≤c​.

The conclusion bounds at least one factor, not necessarily both. If the first factor is larger than c\sqrt cc​, the product bound will force the second factor to be smaller than c\sqrt cc​.

Let aaa, bbb, and ccc be arbitrary positive real numbers, and assume ab≤cab\le cab≤c. If a≤ca\le\sqrt ca≤c​, there is nothing more to prove. Otherwise,

¬(a≤c)⟺a>c.\neg(a\le\sqrt c)\quad\Longleftrightarrow\quad a>\sqrt c. ¬(a≤c​)⟺a>c​.

Because b>0b>0b>0, multiplying this strict inequality by bbb preserves its direction:

c b<ab≤c.\sqrt c\,b<ab\le c. c​b<ab≤c.

Since c>0c>0c>0, we also have c>0\sqrt c>0c​>0. We may therefore divide by c\sqrt cc​ without reversing the inequality:

b<cc=c.b<\frac{c}{\sqrt c}=\sqrt c. b<c​c​=c​.

In particular, b≤cb\le\sqrt cb≤c​, which proves the other disjunct. The desired OR statement holds in either case.

There is also a shorter route through fractions. With a fixed positive numerator, increasing a positive denominator makes the fraction smaller. Since ab≤cab\le cab≤c and a>c>0a>\sqrt c>0a>c​>0, we can write

b≤ca<cc=c.b\le\frac ca<\frac c{\sqrt c}=\sqrt c. b≤ac​<c​c​=c​.

The first inequality comes from dividing the product bound by a>0a>0a>0; the second uses the larger denominator aaa.

Proof by contrapositive

For an implication p⇒qp\Rightarrow qp⇒q, distinguish two statements:

NameStatement
Contrapositive¬q⇒¬p\neg q\Rightarrow\neg p¬q⇒¬p
Converseq⇒pq\Rightarrow pq⇒p

The contrapositive reverses the direction and negates both propositions. It is logically equivalent to the original implication:

(p⇒q)≡(¬q⇒¬p).(p\Rightarrow q)\equiv(\neg q\Rightarrow\neg p). (p⇒q)≡(¬q⇒¬p).

Both are false in exactly the same situation: ppp is true and qqq is false. A proof by contrapositive therefore proves the original implication by assuming ¬q\neg q¬q and deriving ¬p\neg p¬p.

The converse merely reverses the direction. It is not generally equivalent to the original implication and needs its own proof. For example, when ppp is false and qqq is true, p⇒qp\Rightarrow qp⇒q is true but q⇒pq\Rightarrow pq⇒p is false.

Example: if the square is odd, the integer is odd

For an integer nnn, we now want to prove

n2 is odd⟹n is odd.n^2\text{ is odd}\quad\Longrightarrow\quad n\text{ is odd}. n2 is odd⟹n is odd.

This is the converse of the odd-square result proved above, so the earlier proof alone does not establish it.

A direct attempt begins with n2=2k+1n^2=2k+1n2=2k+1 for some integer kkk. Taking square roots gives

n=±2k+1.n=\pm\sqrt{2k+1}. n=±2k+1​.

But this expression does not immediately exhibit an integer ℓ\ellℓ with n=2ℓ+1n=2\ell+1n=2ℓ+1. The contrapositive avoids square roots and gives an easier starting point:

n is not odd⟹n2 is not odd.n\text{ is not odd}\quad\Longrightarrow\quad n^2\text{ is not odd}. n is not odd⟹n2 is not odd.

Because both nnn and n2n^2n2 are integers, this is the same as

n is even⟹n2 is even.n\text{ is even}\quad\Longrightarrow\quad n^2\text{ is even}. n is even⟹n2 is even.

Let n∈Zn\in\mathbb Zn∈Z be arbitrary and assume it is even. Then n=2kn=2kn=2k for some integer kkk, so

n2=(2k)2=4k2=2(2k2).n^2=(2k)^2=4k^2=2(2k^2). n2=(2k)2=4k2=2(2k2).

Choose ℓ=2k2\ell=2k^2ℓ=2k2. This is an integer, and n2=2ℓn^2=2\elln2=2ℓ, so n2n^2n2 is even. We have proved the contrapositive, and therefore the original claim: if an integer's square is odd, that integer is odd.

The integer assumption is essential. It is what allows us to replace “not odd” with “even.”

Combining both directions

We have now proved both implications needed for

n is odd⟺n2 is odd(n∈Z).n\text{ is odd}\quad\Longleftrightarrow\quad n^2\text{ is odd} \qquad(n\in\mathbb Z). n is odd⟺n2 is odd(n∈Z).

The forward direction came from expanding the square of an odd integer. The reverse direction came from proving that an even integer has an even square.

Negating both sides preserves a biconditional:

(p⇔q)≡(¬p⇔¬q).(p\Leftrightarrow q)\equiv(\neg p\Leftrightarrow\neg q). (p⇔q)≡(¬p⇔¬q).

Using the integer parity distinction gives the corollary, a consequence of the result we just proved:

n is even⟺n2 is even(n∈Z).n\text{ is even}\quad\Longleftrightarrow\quad n^2\text{ is even} \qquad(n\in\mathbb Z). n is even⟺n2 is even(n∈Z).

In short, an integer and its square have the same parity. The two directions are justified by the proofs, not just by checking examples.

Source: https://notes.ohevan.com/notes/discrete-structures/07-proof-techniques

© 2026 Evan Luo. All rights reserved.

Back to Discrete Structures

0 reads

·Last edited Today
  • newsletter

  • about me

  • sponsor

© 2026 Evan Luo. All rights reserved.