Lecture 3: Working with Quantifiers


In the last lecture, we described the rules of Sudoku by requiring that no number appeared twice in any row, column, or box. For example,

Rule 1: For any row \(i\), and any two different columns \(j\) and \(j'\), \(s(i,j) \neq s(i,j')\).

We introduced the symbol \(\forall\), meaning "for all" (or "for any"), so that we could condense the above sentence to \(∀ i, ∀ j \neq j', s(i,j) \neq s(i,j')\)". As we mentioned in the last lecture, this form can be harder to read, so I often prefer the less symbol-heavy form. But it is important to be able to go back and forth.

An alternative way of specifying the rules of Sudoku is instead to require that every number appears at least once in every row, column, and box:

Rule 1': For any row \(i\), and any number \(n\), there is some column \(j\) such that \(s(i,j) = n\).

The symbol \(∃\) stands for "there exists", so that we can condense this version of the rule to \(∀ i, ∀ n, ∃ j, s(i,j) = n\) (as above, I usually prefer the less symbol- heavy version).

For-all and there-exists are called quantifiers. They tell the reader whether a variable represents a specific element of a set or an arbitrary element of the set.

The order of quantifiers matters. For example, if we tried to exchange the \(∀ n\) and \(∃ j\) in the statement of Rule 1', we would have "each row contains a cell that has all 9 numbers in it (\(∀i, ∃j, ∀n, s(i,j) = n\))", which is clearly impossible since \(s\) is a function and can therefore only output a single number.

As another example, it may be the case that everybody loves somebody (their mother, say). This would be written \(∀ x, ∃ y\) such that \(x\) loves \(y\). However, if we switch the quantifiers, we have \(∃ y\) such that \(∀ x\), \(x\) loves \(y\). There might not be somebody that everybody loves (though if there was, we might call him "Raymond").

However, you can rearrange two "there exist" quantifiers, or two "for all" quantifiers. You just can't mix the two. For example, rule 1' can be stated as "every number appears in every row" or "every row contains every number".

"for all" and "there exists" are dual in the following sense: to disprove "for all \(x\), P(x)", you must prove that there exists an \(x\) such that \(P\) is false. For example, disproving "for all \(x\), \(x ≥ 7\)" is the same as proving "for some \(x\), \(x\) is not \(≥ 7\)".


A proof is just a logical argument. If you have played Sudoku, you have done hundreds of proofs in your head. The important new skill you are developing in 2800 is writing proofs down so that they are clear to others.

To check whether an argument is a good proof, you should check the following:

  1. Is each sentence clear? Each word you use should have already been given a precise and unambiguous definition.

  2. Is each sentence true (in context)? As you are writing a proof, it is good to pause and try to think of examples and counterexamples to what you are saying. (Note: in the context of a proof by contradiction, you may some things that are not true by themselves, but follow based on faulty assumptions you have made, which is ok).

  3. Does each sentence obviously follow from the earlier sentences or other things that have already been proved?

The most common way that students fail the third condition is a backwards proof. This is a proof that starts with what the question asks, and reduces it to something that is known to be true.

It is useful to write down or simplify what you are trying to prove, but you must clearly distinguish your argument from your restatement of what you are trying to show. Otherwise, it looks like you are "begging the question"; assuming what you are trying to show. I often use the phrases "we want to show" (or "WTS" for short) and "well, ..." to demarcate what I want to show and my argument respectively, but it's just English, you can find your own style.

Some proof techniques

We briefly touched on a few proof techniques:

Finishing up Sudoku example

For a less trivial example, we started to show that the two styles of definition for "sudoku solution" are equivalent.

Recall that we defined a sudoku solution as a function \(s : C → N\) satisfying three properties, including:

Property 1: every number appears once in every row (\(∀ i, ∀ n, ∃ j, s(i,j) = n\)).

We could alternatively require a different property:

Property 1': no number appears twice in the same row (\(∀ i, j_1, j_2\), if \(j_1 \neq j_2\) then \(s(i,j_1) ≠ s(i,j_2)\)).

We can prove that these two properties are equivalent. That is, assuming one of them, you can prove that the other must hold, and vice-versa. We prove one direction here.

Claim: Property 1 implies property 1'. That is, if \(s : C → N\) satisfies property 1, then it must also satisfy property 1'.

Proof given in class: Suppose \(s\) satisfies property 1, that is, suppose that every number appears once in every row. We want to show that no number appears twice in any row. Well, if a number did appear twice, then there would only be 7 cells for the remaining 8 numbers. But each cell can only have one number, so one of the numbers must be left out. But that means you lied when you claimed that \(s\) satisfied property 1.

This is a pretty good proof. It would probably receive full credit. We could make it a little bit clearer:

Here is a rewrite:

Proof: Suppose \(s\) satisfies property 1, that is, suppose that every number appears once in every row. We want to show that no number appears twice in any row. Suppose for the sake of contradiction that some number \(n\) appeared in both column \(j_1\) and \(j_2 ≠ j_1\) of some row \(i\). By property 1, the remaining 8 numbers (those other than \(s(i,j_1)\)) must appear in the remaining 7 columns (those other than \(j_1\) and \(j_2\)). But this is impossible, because \(s\) is a function, so each column can give only one number. This is a contradiction, so our assumption that \(s\) did not satisfy property 1' was false.

Which proof is better? Whichever one is clearer. Remember always that the goal is clarity and communication.

Note: we used the duality of "for all" and "there exists" in this proof. To prove property 1' (\(∀ i, ∀j_1, ∀j_2\), if \(j_1 ≠ j_2\) then \(s(i,j_1) ≠ s(i,j_2)\)), we assumed that it was false by assuming (\(∃i, ∃j_1, ∃j_2\) such that \(j_1 ≠ j_2\) but \(s(i,j_1) = s(i,j_2)\)) and arrived at a contradiction. Note that the \(∀\)s turned into \(∃\)s, and the conclusion (\(s(i,j_1) ≠ s(i,j_2)\)) was negated.