📝 Preview Changes: This page has been modified in this pull request (~22% of content changed).
🎨 Highlighting Legend:
Modified text (yellow) shows changed words/phrases,
added text (green) shows new content, and
new sections (blue) highlight entirely new paragraphs.
Proof Writing
Published
Last modified: 2026-11-03 15:17:03 (PST)
This page collects general advice on how to write proofs and derivations. The goal of a proof is not just to convince yourself that a result is true; it is to convince a reader, and to show them why it is true. Each principle on this page serves that goal. The symbols for logical entailment are listed under Definitions for proofs below.
Definition 1 (Proposition, statement) A proposition[1], or statement, is a declarative sentence that is either true or false.
ExmExample 1 (Propositions, and a sentence that is not one)
Example 1 (Propositions, and a sentence that is not one)
“\(2 + 3 = 5\)” is a proposition, and it is true.
“\(7\) is even” is a proposition, and it is false.
“\(x > 2\)” is not a proposition on its own: it is true when \(x = 3\) and false when \(x = 1\), so it has no truth value until \(x\) is given a value.
Definition 2 (Predicate) A predicate[2]\(P(x)\) is a declarative sentence about a variable \(x\) that becomes a proposition (Definition 1) whenever a value is substituted for \(x\).
Example 2 (A predicate) Let \(P(x)\) be the predicate “\(x > 2\)”, for real numbers \(x\).
\(P(3)\) is the proposition “\(3 > 2\)”, which is true.
\(P(1)\) is the proposition “\(1 > 2\)”, which is false.
DefDefinition 3 (Domain of discourse, universe of discourse)
Definition 3 (Domain of discourse, universe of discourse) The domain of discourse (or universe of discourse) of a predicate\(P(x)\) is the set of values its variable \(x\) may take. A predicate in several variables has a domain of discourse for each variable.
Let \(P(x)\) be the predicate “\(x^2 = 2\)”. If its domain of discourse is the real numbers, then \(P(x)\) is true for \(x = \sqrt{2}\). If its domain of discourse is the integers, then \(P(x)\) is false for every \(x\), since the squares of the integers are \(0, 1, 4, 9, \ldots\), and none of them is \(2\).
Definition 4 (Logical connective) A logical connective[3] builds a new proposition (Definition 1) from one or two propositions \(P\) and \(Q\), with a truth value that depends only on the truth values of \(P\) and \(Q\). These notes use five, each defined next: not, and, or, implies, and if and only if.
Definition 5 (Not) The logical connective (Definition 4) not[4] is written \(\neg P\) (“not \(P\)”); it is true when \(P\) is false, and false when \(P\) is true.
ExmExample 4 (Negating a true and a false proposition)
Example 4 (Negating a true and a false proposition) Let \(P\) be “\(5 > 3\)”, which is true, and let \(Q\) be “\(2 > 3\)”, which is false.
\(\neg P\), “it is not true that \(5 > 3\)”, is false, because \(P\) is true.
\(\neg Q\), “it is not true that \(2 > 3\)”, is true, because \(Q\) is false.
Definition 6 (And) The logical connective (Definition 4) and is written [5]\(P \land Q\) (“\(P\) and \(Q\)”); it is true when \(P\) and \(Q\) are both true, and false otherwise.
Example 5 (Two propositions joined by “and”) Let \(P\) be “\(3 < 5\)”, which is true, let \(Q\) be “\(5 < 4\)”, which is false, and let \(R\) be “\(5 < 7\)”, which is true.
\(P \land R\) is true, because \(P\) and \(R\) are both true.
Definition 7 (Or) The logical connective (Definition 4) or is written [6]\(P \lor Q\) (“\(P\) or \(Q\)”); it is true when at least one of \(P\) and \(Q\) is true, and false when both are false.
Example 6 (Two propositions joined by “or”) Let \(P\) be “\(3 < 2\)”, which is false, let \(Q\) be “\(5 < 7\)”, which is true, and let \(R\) be “\(5 < 4\)”, which is false.
\(P \lor Q\) is true, because \(Q\) is true.
\(P \lor R\) is false, because \(P\) and \(R\) are both false.
Definition 8 (Implies) The logical connective (Definition 4) implies is written [7]\(P \Rightarrow Q\) (“if \(P\), then \(Q\)”, or “\(P\) implies \(Q\)”); it is false when \(P\) is true and \(Q\) is false, and true otherwise.
ExmExample 7 (Implications with a true and a false premise)
Example 7 (Implications with a true and a false premise) Take \(x = 3\).
\(x > 2 \Rightarrow x > 1\) is true: the premise \(3 > 2\) is true and the conclusion \(3 > 1\) is true.
\(x > 2 \Rightarrow x > 4\) is false: the premise \(3 > 2\) is true, but the conclusion \(3 > 4\) is false.
\(x > 5 \Rightarrow x > 4\) is true: the premise \(3 > 5\) is false, so the implication is true whatever the conclusion.
Definition 9 (If and only if) The logical connective (Definition 4) if and only if is written [8]\(P \Leftrightarrow Q\) (“\(P\) if and only if \(Q\)”); it is true when \(P\) and \(Q\) have the same truth value, and false otherwise.
ExmExample 8 (“If and only if” with equal and different truth values)
Example 8 (“If and only if” with equal and different truth values) Take \(x = 4\).
“\(x\) is even\(\Leftrightarrow x > 3\)” is true: \(4\) is even and \(4 > 3\), so both sides are true.
“\(x > 3 \Leftrightarrow x > 5\)” is false: \(4 > 3\) is true, but \(4 > 5\) is false.
Definition 10 (Truth table) A truth table[9] for a proposition built from propositions\(P_1, \ldots, P_n\) with logical connectives has one row for each of the \(2^n\) combinations of truth values of \(P_1, \ldots, P_n\), and gives the truth value of the proposition in each row.
ExmExample 10 (A truth table for \(P \Rightarrow Q\))
Example 10 (A truth table for \(P \Rightarrow Q\)) The proposition\(P \Rightarrow Q\) is built from two propositions, so its truth table has \(2^2 = 4\) rows. By the definition of implies, \(P \Rightarrow Q\) is false only in the row where \(P\) is true and \(Q\) is false:
Definition 11 (Logically equivalent) Two propositions\(A\) and \(B\), each built from some or all of the propositions \(P_1, \ldots, P_n\) with logical connectives, are logically equivalent[10], written \(A \equiv B\), when they have the same truth value in every row of a truth table on \(P_1, \ldots, P_n\).
ExmExample 11 (\(P \Rightarrow Q\) is logically equivalent to \(\neg P \lor Q\))
Example 11 (\(P \Rightarrow Q\) is logically equivalent to \(\neg P \lor Q\)) Adding a column for \(\neg P \lor Q\) to the truth table of Example 10 gives:
\(P\)
\(Q\)
\(\neg P\)
\(\neg P \lor Q\)
\(P \Rightarrow Q\)
T
T
F
T
T
T
F
F
F
F
F
T
T
T
T
F
F
T
T
T
The last two columns agree in every row, so \((P \Rightarrow Q) \equiv (\neg P \lor Q)\).
LemTheorem 1 (A biconditional is two conditionals)
Theorem 1 (A biconditional is two conditionals) For propositions\(P\) and \(Q\),
Theorem 2 (A cycle of conditionals) Let \(P_1, P_2, \ldots, P_k\) be propositions. If \(P_1 \Rightarrow P_2\), \(P_2 \Rightarrow P_3\), \(\ldots\), \(P_{k-1} \Rightarrow P_k\) and \(P_k \Rightarrow P_1\) are all true, then \(P_1, \ldots, P_k\) all have the same truth value.
ProofProof
Proof. There are two cases.
None of \(P_1, \ldots, P_k\) is true. Then all of them are false, so they all have the same truth value.
Some \(P_i\) is true. By the definition of implies, for any \(P\) and \(Q\), if \(P \Rightarrow Q\) and \(P\) are both true, then \(Q\) is true. So \(P_i \Rightarrow P_{i+1}\) makes \(P_{i+1}\) true, then \(P_{i+1} \Rightarrow P_{i+2}\) makes \(P_{i+2}\) true, and so on around the cycle, with \(P_k \Rightarrow P_1\) carrying the truth of \(P_k\) back to \(P_1\). After at most \(k - 1\) steps, every proposition in the list is true.
If \(n = 2m\), then \(n + 1 = 2m + 1\), so \(P_1 \Rightarrow P_2\). If \(n + 1 = 2m + 1\), then \(n + 2 = 2(m + 1)\), so \(P_2 \Rightarrow P_3\). If \(n + 2 = 2m\), then \(n = 2(m - 1)\), so \(P_3 \Rightarrow P_1\). By a cycle of conditionals, the three propositions are all true or all false. Three conditionals were enough, where checking each pair both ways would take six.
Proof. Each side of each law is built from \(P\) and \(Q\), so by Definition 11 it is enough to compare the two sides in each of the four rows of a truth table:
\(P\)
\(Q\)
\(\neg (P \land Q)\)
\(\neg P \lor \neg Q\)
\(\neg (P \lor Q)\)
\(\neg P \land \neg Q\)
T
T
F
F
F
F
T
F
T
T
F
F
F
T
T
T
F
F
F
F
T
T
T
T
The third and fourth columns agree in every row, which proves the first law, and the fifth and sixth columns agree in every row, which proves the second.
Definition 13 (Contradiction) A contradiction is a proposition that is false in every row of its truth table.
ExmExample 15 (\(P \land \neg P\) is a contradiction)
Example 15 (\(P \land \neg P\) is a contradiction)
By the definitions of and and not, the truth table of \(P \land \neg P\) is:
\(P\)
\(\neg P\)
\(P \land \neg P\)
T
F
F
F
T
F
The last column is false in every row, so \(P \land \neg P\) is a contradiction.
LemTheorem 4 (Equivalence is a tautological biconditional)
Theorem 4 (Equivalence is a tautological biconditional) For propositions\(A\) and \(B\), \(A\) and \(B\) are logically equivalent exactly when \(A \Leftrightarrow B\) is a tautology.
ProofProof
Proof. By the definition of if and only if, \(A \Leftrightarrow B\) is true in a row of the truth table exactly when \(A\) and \(B\) have the same truth value in that row. So \(A \Leftrightarrow B\) is true in every row exactly when \(A\) and \(B\) have the same truth value in every row, which is the definition of \(A \equiv B\).
Let \(P\) be the proposition “\(7\) is odd”. Then \(\neg \neg P\) is “it is not the case that \(7\) is not odd”. By double negation, \(\neg \neg P\) says the same thing as \(P\): \(7\) is odd.
Let \(n\) be an integer. “\(n\) is even, and \(n > 0\) or \(n < 0\)” has the form \(A \land (B \lor C)\). By the first distributive law, it says the same thing as “\(n\) is even and \(n > 0\), or \(n\) is even and \(n < 0\)”, which has the form \((A \land B) \lor (A \land C)\).
LemTheorem 7 (Replacing a part by an equivalent part)
Theorem 7 (Replacing a part by an equivalent part) Let \(A\) and \(B\) be logically equivalentpropositions. Let \(F\) be a proposition built from \(A\) and other propositions with logical connectives, and let \(F'\) be \(F\) with \(A\) replaced by \(B\). Then \(F \equiv F'\).
ProofProof
Proof. The truth value of \(F\) in a row of its truth table is computed from the truth values of its parts in that row, using the truth table of each connective. \(F'\) is computed the same way, except that \(B\) takes the place of \(A\). \(A\) and \(B\) have the same truth value in every row, so each step of the computation gives the same value for \(F'\) as for \(F\). So \(F\) and \(F'\) have the same truth value in every row.
Proof. By the definition of implies, \(P \Rightarrow Q\) is false exactly when \(P\) is true and \(Q\) is false. So \(\neg (P \Rightarrow Q)\) is true exactly in that row of the truth table. By the definition of and, \(P \land \neg Q\) is true exactly when \(P\) is true and \(\neg Q\) is true. That is the same row.
Let \(n\) be an integer, let \(P\) be “\(n\) is prime”, and let \(Q\) be “\(n\) is odd”. By negating a conditional, the negation of \(P \Rightarrow Q\) is \(P \land \neg Q\): “\(n\) is prime, and \(n\) is not odd”. For \(n = 2\), the negation is true, so the conditional is false.
Definition 14 (Quantifier) A quantifier[12] turns a predicate \(P(x)\) (Definition 2) about the elements \(x\) of a set \(S\) into a proposition (Definition 1). There are two, each defined next: the universal quantifier and the existential quantifier.
Definition 15 (Universal quantifier) The universal quantifier[13] “for all” is a quantifier (Definition 14): \(\forall x \in S, P(x)\) (“for every \(x\) in \(S\), \(P(x)\)”) is true when \(P(x)\) is true for every element \(x\) of \(S\), and false otherwise.
ExmExample 22 (A universally quantified proposition)
Example 22 (A universally quantified proposition) Let \(P(x)\) be the predicate “\(x\) is even”.
“\(\forall x \in \mathopen{}\left\{2, 4, 6\right\}\mathclose{}, P(x)\)” is true, because \(2\), \(4\), and \(6\) are all even.
“\(\forall x \in \mathopen{}\left\{2, 3, 4\right\}\mathclose{}, P(x)\)” is false, because \(P(3)\) is false.
Definition 16 (Existential quantifier) The existential quantifier[14] “there exists” is a quantifier (Definition 14): \(\exists x \in S, P(x)\) (“there is an \(x\) in \(S\) such that \(P(x)\)”) is true when \(P(x)\) is true for at least one element \(x\) of \(S\), and false otherwise.
\[
\begin{aligned}
\neg (\forall x \in S, P(x)) &\equiv \exists x \in S, \neg P(x) \\
\neg (\exists x \in S, P(x)) &\equiv \forall x \in S, \neg P(x)
\end{aligned}
\]
ProofProof
Proof.
By the definition of the universal quantifier, \(\forall x \in S, P(x)\) is false exactly when \(P(x)\) is false for at least one \(x\) in \(S\). By the definition of the existential quantifier, that is exactly when \(\exists x \in S, \neg P(x)\) is true.
By the definition of the existential quantifier, \(\exists x \in S, P(x)\) is false exactly when \(P(x)\) is false for every \(x\) in \(S\). By the definition of the universal quantifier, that is exactly when \(\forall x \in S, \neg P(x)\) is true.
Let \(S\) be the integers, and let \(P(x)\) be “\(x\) is even”. By the first of De Morgan’s laws for quantifiers, \(\neg (\forall x \in S, P(x)) \equiv \exists x \in S, \neg P(x)\): the negation of “every integer is even” is “some integer is not even”. By the second law, \(\neg (\exists x \in S, P(x)) \equiv \forall x \in S, \neg P(x)\): the negation of “some integer is even” is “no integer is even”.
Definition 17 (Inequality) An inequality is a proposition (Definition 1) or a predicate (Definition 2) that compares two expressions \(a\) and \(b\) whose values are real numbers, in one of the forms:
\(a < b\) (“\(a\) is less than \(b\)”);
\(a \le b\) (“\(a\) is less than or equal to \(b\)”);
\(a > b\) (“\(a\) is greater than \(b\)”);
\(a \ge b\) (“\(a\) is greater than or equal to \(b\)”).
Definition 18 (Logical entailment, logical consequence, deductive consequence) Propositions or predicates \(P_1, \ldots, P_n\) (Definition 1, Definition 2) logically entail[15] a proposition or predicate \(Q\) when every choice of values for their variables that makes all of \(P_1, \ldots, P_n\) true also makes \(Q\) true. Then \(Q\) is a logical consequence, or deductive consequence, of \(P_1, \ldots, P_n\).
Example 27 (Entailment, and its failure) Let \(x\) be an integer.
“\(x = 2\)” entails “\(x^2 = 4\)”: the only value that makes “\(x = 2\)” true is \(x = 2\), and \(2^2 = 4\).
“\(x > 3\)” and “\(x < 5\)” together entail “\(x = 4\)”: \(4\) is the only integer greater than \(3\) and less than \(5\).
“\(x^2 = 4\)” does not entail “\(x = 2\)”: the value \(x = -2\) makes “\(x^2 = 4\)” true, since \((-2)^2 = 4\), but makes “\(x = 2\)” false.
We can use any of:
\(\therefore\) (\therefore in LaTeX),
\(\Rightarrow\) (\Rightarrow),
\(\models\) (\models)
to denote logical entailment (Definition 18). \(\Rightarrow\) also writes the connective “implies” (Definition 8); \(P\) entails \(Q\) exactly when \(P \Rightarrow Q\) is true for every choice of values for the variables in \(P\) and \(Q\).
Let’s save \(\rightarrow\) (\rightarrow) for convergence results.
Definition 19 (Logical argument) A logical argument is a list of propositions\(P_1, \ldots, P_n\) together with one more proposition\(Q\). It is written with “so” or \(\therefore\) before \(Q\).
“If \(n\) is even, then \(n^2\) is even. \(n\) is even. So \(n^2\) is even.” is a logical argument. Its premises are “if \(n\) is even, then \(n^2\) is even” and “\(n\) is even”. Its conclusion is “\(n^2\) is even”.
Definition 22 (Rule of inference) A rule of inference is a pattern of logical argument, written with propositions\(P, Q, \ldots\) as placeholders, whose premiseslogically entail its conclusion whatever propositions are put in place of \(P, Q, \ldots\). It is written with its premises above a line and its conclusion below:
\[
\frac{P_1, \ldots, P_n}{Q}.
\]
ExmExample 29 (A pattern that is not a rule of inference)
Example 29 (A pattern that is not a rule of inference)
The pattern
\[
\frac{P \Rightarrow Q, \quad Q}{P}
\]
is not a rule of inference. In the row of the truth table where \(P\) is false and \(Q\) is true, both premises are true, by the definition of implies, but the conclusion\(P\) is false. For example, “if \(n = 2\), then \(n\) is even” and “\(n\) is even” are both true for \(n = 4\), but “\(n = 2\)” is false.
Proof. By the definition of implies, \(P \Rightarrow Q\) is false only when \(P\) is true and \(Q\) is false. Both premises are true, so \(P\) is true and \(P \Rightarrow Q\) is true. So \(Q\) is not false, and the conclusion\(Q\) is true.
\[
\frac{P \Rightarrow Q, \quad \neg Q}{\neg P}
\]
ProofProof
Proof. Suppose both premises are true. By the definition of not, \(Q\) is false. By the definition of implies, a true \(P \Rightarrow Q\) with a false \(Q\) needs a false \(P\). So \(P\) is false, and the conclusion\(\neg P\) is true.
Proof. Suppose both premises are true. By the definition of not, \(P\) is false. By the definition of or, \(P \lor Q\) is true only if \(P\) is true or \(Q\) is true. So the conclusion\(Q\) is true.
Proof. Suppose the premise is true. By the definition of and, \(P \land Q\) is true only if \(P\) and \(Q\) are both true. So the conclusion\(P\) is true.
Proof. Suppose both premises are true. By the definition of and, \(P \land Q\) is true when \(P\) and \(Q\) are both true. So the conclusion\(P \land Q\) is true.
“if the game is cancelled, then we go to the museum”;
“we do not go to the museum”.
By modus tollens on the second and third premises, “the game is not cancelled” is true. By modus tollens again, on the first premise and the fact derived from them, “it does not rain” is true. So the conclusion “it does not rain” follows from the premises.
Definition 23 (Proof) A proof[16] of a proposition (Definition 1) is a finite list of statements that ends with that proposition, in which each statement is
an assumption,
a definition,
a previously proved result, or
a consequence of earlier statements in the list, by one rule of logic or algebra.
ExmExample 31 (The sum of two even integers is even)
Example 31 (The sum of two even integers is even) Let \(a\) and \(b\) be even integers (definition). Then \(a = 2j\) and \(b = 2k\) for some integers \(j\) and \(k\), and
\[
\begin{aligned}
a + b
&= 2j + 2k
&& \text{(substitute } a = 2j \text{ and } b = 2k \text{)}
\\
&= 2(j + k)
&& \text{(distributive law)}
\end{aligned}
\]
The second line uses the distributive law. Since \(j + k\) is an integer, \(a + b\) is even (definition). For example,
Definition 24 (Derivation) A derivation is a proof (Definition 23), or a part of one, written as a chain of expressions, one per line, in which each line is joined to the line before it by \(=\) or by an inequality sign (Definition 17), and carries an annotation that names the reason that step holds: an assumption, a definition, a previously proved result, or a rule of algebra.
ExmExample 32 (A derivation with equalities and inequalities)
Example 32 (A derivation with equalities and inequalities) For every real number \(x\):
The first step uses the square of a sum. The steps are \(=\), \(\ge\), and \(>\), so the derivation shows \((x + 1)^2 > 2x\). For example, with \(x = 3\): \((3 + 1)^2 = 16\), and \(16 > 6 = 2 \cdot 3\).
Theorem 16 (What a derivation shows) Consider a derivation (Definition 24) with expressions \(E_0, E_1, \ldots, E_n\), where each line \(E_j\) is joined to the line \(E_{j-1}\) before it by \(=\), \(\le\) or \(<\).
If every step is \(=\), then \(E_0 = E_n\).
If every step is \(=\) or \(\le\), then \(E_0 \le E_n\).
If every step is \(=\), \(\le\), or \(<\), and at least one step is \(<\), then \(E_0 < E_n\).
The same holds with \(\ge\) and \(>\) in place of \(\le\) and \(<\).
ProofProof
Proof. First, a fact about two steps in a row. For numbers \(a\), \(b\) and \(c\), if \(a \mathrel{R} b\) and \(b \mathrel{S} c\), where \(R\) and \(S\) are each one of \(=\), \(\le\) and \(<\), then \(a \mathrel{T} c\), where \(T\) is
If exactly one of \(R\) and \(S\) is \(=\), replace \(b\) by the equal expression in the other relation (substitution). This gives the other relation between \(a\) and \(c\).
If neither is \(=\), then each of \(a \mathrel{R} b\) and \(b \mathrel{S} c\) is \(\le\) or \(<\), and \(\le\) means \(<\) or \(=\) (strict and non-strict inequalities). A case with an \(=\) is covered by the previous bullet, and the remaining case is \(a < b\) and \(b < c\), which gives \(a < c\) because \(<\) is transitive on the real numbers. So two steps that are each \(\le\) or \(<\) give \(<\) if either is \(<\), and otherwise \(\le\).
Now let \(T_j\) be the relation named by the same rule applied to the first \(j\) steps of the chain, with \(T_0\) being \(=\). We show \(E_0 \mathrel{T_j} E_j\) by induction on \(j\). For \(j = 0\), \(E_0 = E_0\). If \(E_0 \mathrel{T_j} E_j\), then the step from \(E_j\) to \(E_{j+1}\) and the fact above give \(E_0 \mathrel{T_{j+1}} E_{j+1}\). At \(j = n\), \(T_n\) is \(=\) when every step is \(=\), which is part 1. It is \(\le\) or \(=\) when every step is \(=\) or \(\le\), and \(=\) implies \(\le\), which is part 2. It is \(<\) when some step is \(<\), which is part 3.
The argument for \(\ge\) and \(>\) is the same with the inequalities reversed.
ExmExample 33 (Checking a derivation line by line)
Example 33 (Checking a derivation line by line) The derivation in Example 32 has the steps \(=\), \(\ge\) and \(>\), so by Theorem 16 it shows \((x + 1)^2 > 2x\). The code evaluates the four lines of that derivation at several values of \(x\), and checks each step and the comparison of the first line with the last.
At all 5 values of \(x\), the three steps hold in 5, 5 and 5 cases, and the first line exceeds the last in 5 cases, as Theorem 16 says. At \(x = 0\), for example, the first line is 1 and the last is 0.
Definition 25 (Result) A result is a proposition (Definition 1) that has a proof (Definition 23). These notes label each result by its role: as a theorem, a lemma, or a corollary, each defined next.
ExmExample 34 (A proposition that is a result, and one that is not)
Example 34 (A proposition that is a result, and one that is not) “\(2 + 3 = 5\)” is a proposition (Definition 1) that has a proof, the computation of \(2 + 3\), so it is a result. “\(7\) is even” is a proposition that is false, so it has no proof and is not a result.
RemarkRemark 2 (“Proposition” as a kind of result)
Remark 2 (“Proposition” as a kind of result). Some sources also call a result of moderate importance a “proposition”. In these notes, “proposition” always means a sentence that is true or false (Definition 1), whether or not it has been proved.
Example 35 (A theorem) “The sum of two even integers is even” is a result: Example 31 proves it. It is of interest in its own right, since it applies whenever two even integers are added, as in \(2 + 4 = 6\), so it is a theorem.
Definition 27 (Lemma) A lemma[18] is a result (Definition 25) proved mainly as a step in the proof of another result.
ExmExample 36 (A lemma in the proof of a larger result)
Example 36 (A lemma in the proof of a larger result) To show that the sum of four even integers \(a\), \(b\), \(c\), and \(d\) is even, write \(a + b + c + d = (a + b) + (c + d)\). By the result of Example 31, \(a + b\) and \(c + d\) are even, and applying that result again to these two sums shows that their sum is even. Here that result is proved mainly as a step in the proof of another result, so it serves as a lemma. For example, \(2 + 4 + 6 + 8 = (2 + 4) + (6 + 8) = 6 + 14 = 20\), which is even.
Example 37 (A corollary of a result)Example 31 proves the result “the sum of two even integers is even”. A corollary follows with little extra work: the sum of three even integers \(a\), \(b\), and \(c\) is even, because \(a + b + c = (a + b) + c\), \(a + b\) is even by that result, and applying the result again to the even integers \(a + b\) and \(c\) shows that \((a + b) + c\) is even. For example,
Definition 29 (Counterexample) A counterexample[20] to a proposition of the form “for every \(x\) in \(A\), \(P(x)\)”, where \(P(x)\) is a predicate (Definition 2), is an element \(x\) of \(A\) for which \(P(x)\) is false. A single counterexample shows that the proposition is false.
Example 38 (A counterexample) The proposition “for every integer \(n\), \(n + n > n\)” is false. The integer \(n = 0\) is a counterexample: \(0 + 0 = 0\), and \(0 > 0\) is false. The proposition is true for some integers, such as \(n = 3\), since \(3 + 3 = 6 > 3\), but one counterexample is enough to make it false.
Example 39 (A disproof) Claim: every prime is odd.
Disproof: the integer\(2\) is prime, and \(2\) is not odd, since \(2 = 2k + 1\) would need \(k = 1/2\), which is not an integer. So there is a prime that is not odd, which is the negation of the claim.
Definition 31 (Constructive proof) A constructive proof[21] of a proposition\(\exists x \in S,\ P(x)\) with an existential quantifier names a particular element of \(S\) and shows that \(P\) is true of it.
Definition 32 (Non-constructive proof) A non-constructive proof[21] of a proposition\(\exists x \in S,\ P(x)\) shows that it is true without naming any element \(x\) of \(S\) for which \(P(x)\) is true. It is a proof that is not a constructive proof.
Example 41 (A non-constructive proof) Claim: among any three integers, there are two that are both even or both odd.
Proof: each integer is even or odd. If at most one of the three integers were even, and at most one were odd, there would be at most two integers in all. So at least two of the three are even, or at least two are odd.
Its converse, “if \(n\) is even, then \(n\) is a multiple of \(4\)”, is false. The integer \(n = 2\) is a counterexample (Definition 29): \(2\) is even, but \(2 = 4k\) only for \(k = \frac{1}{2}\), which is not an integer.
So a proposition can be true while its converse is false.
Proof. By the definition of implies, \(P \Rightarrow Q\) is false exactly when \(P\) is true and \(Q\) is false. By the same definition, \(\neg Q \Rightarrow \neg P\) is false exactly when \(\neg Q\) is true and \(\neg P\) is false, that is, exactly when \(Q\) is false and \(P\) is true. So the two propositions are false in the same row of a truth table and true in the other three, which is Definition 11.
ExmExample 43 (The contrapositive versus the converse)
Example 43 (The contrapositive versus the converse) The proposition “if \(n\) is a multiple of \(4\), then \(n\) is even” from Example 42 has:
converse (Definition 33): “if \(n\) is even, then \(n\) is a multiple of \(4\)”, which is false;
contrapositive (Definition 34): “if \(n\) is not even, then \(n\) is not a multiple of \(4\)”, which is true, by Theorem 17, because the original proposition is true.
Example 44 (A sufficient condition) For a real number \(x\), “if \(x > 5\), then \(x > 2\)” is true, because a number greater than \(5\) is greater than \(2\). So \(x > 5\) is a sufficient condition for \(x > 2\): knowing that \(x = 6\) satisfies \(x > 5\) is enough to conclude that \(6 > 2\).
Example 45 (A necessary condition) For an integer \(n\), “if \(n\) is a multiple of \(6\), then \(n\) is a multiple of \(3\)” is true, because \(6k = 3 \cdot(2k)\) for every integer \(k\). So being a multiple of \(3\) is a necessary condition for being a multiple of \(6\): \(12 = 6 \cdot 2\) is a multiple of \(6\), and it is also a multiple of \(3\), since \(12 = 3 \cdot 4\).
DefDefinition 37 (Necessary and sufficient condition)
Definition 37 (Necessary and sufficient condition) When both “if \(P\), then \(Q\)” and its converse (Definition 33) are true, \(P\) is a necessary and sufficient condition[24] for \(Q\) (Definition 35, Definition 36), written “\(P\) if and only if \(Q\)”.
Definition 38 (Proof by contradiction) A proof by contradiction[25] of a proposition \(P\) assumes that \(P\) is false, and derives from that assumption a proposition that is known to be false.
Example 47 (No integer is both even and odd) Suppose, for contradiction, that some integer \(n\) is both even and odd (definition). Then \(n = 2j\) and \(n = 2k + 1\) for some integers \(j\) and \(k\), and
\[
\begin{aligned}
2j &= 2k + 1
&& \text{(both equal } n \text{)}
\\
2j - 2k &= 1
&& \text{(subtract } 2k \text{ from both sides)}
\\
2(j - k) &= 1
&& \text{(distributive law)}
\\
j - k &= \tfrac{1}{2}
&& \text{(divide both sides by } 2 \text{)}
\end{aligned}
\]
The third line uses the distributive law. But \(j - k\) is an integer, and \(\frac{1}{2}\) is not, so the last line is false. So no integer is both even and odd. For example, \(6 = 2 \cdot 3\) is even, and \(6 = 2k + 1\) would need \(k = 2.5\), which is not an integer.
LemTheorem 18 (A proof by contradiction proves its proposition)
Theorem 18 (A proof by contradiction proves its proposition) Let \(P\) and \(Q\) be propositions (Definition 1). If \(\neg P \Rightarrow Q\) is true and \(Q\) is false, then \(P\) is true.
ProofProof
Proof. By Definition 8, \(\neg P \Rightarrow Q\) is false only when \(\neg P\) is true and \(Q\) is false. Here \(Q\) is false, and \(\neg P \Rightarrow Q\) is true, so \(\neg P\) is not true. Then \(\neg P\) is false. Since \(\neg P\) is true whenever \(P\) is false, \(P\) must be true.
LemTheorem 19 (Why a proof by contradiction works)
Theorem 19 (Why a proof by contradiction works) For propositions\(P\) and \(C\),
\[
P \equiv \mathopen{}\left(\neg P \Rightarrow (C \land \neg C)\right)\mathclose{}.
\]
ProofProof
Proof. By the definitions of and and not, \(C \land \neg C\) is false in every row, so it is a contradiction. So, by the definition of implies, \(\neg P \Rightarrow (C \land \neg C)\) is true exactly in the rows where \(\neg P\) is false, which are the rows where \(P\) is true:
\(P\)
\(C\)
\(\neg P\)
\(C \land \neg C\)
\(\neg P \Rightarrow (C \land \neg C)\)
T
T
F
F
T
T
F
F
F
T
F
T
T
F
F
F
F
T
F
F
The first and last columns match in every row, so the two are logically equivalent.
ExmExample 48 (A truth table for a proof by contradiction)
Example 48 (A truth table for a proof by contradiction) There are only four ways to assign truth values to \(P\) and \(Q\). The code lists them, with the truth value of \(\neg P \Rightarrow Q\), and marks the rows where \(\neg P \Rightarrow Q\) is true and \(Q\) is false.
tt<-expand.grid(Q =c(TRUE, FALSE), P =c(TRUE, FALSE))tt$not_P_implies_Q<-!(!tt$P)|tt$Qtt$hypotheses_hold<-tt$not_P_implies_Q&!tt$Qtt
The hypotheses of Theorem 18 hold in 1 of the 4 rows, and in 1 of them \(P\) is true. So whenever the hypotheses hold, \(P\) is true.
2 Don’t skip steps
Show every step of the derivation. Each line should follow from the previous line by a single, identifiable move:
When you skip steps, you force the reader to reconstruct your reasoning, which is exactly the work the proof was supposed to do for them. A step that feels “obvious” while you are writing it is often the step a reader gets stuck on. Phrases like “it can be shown that” or “clearly” usually mark a skipped step; show the step instead.
3 Annotate each step
For each step, note the definition, theorem, or algebraic rule that justifies it. A brief annotation to the right of the line is usually enough. Annotations make the proof checkable, and they teach the reader which tool to reach for next time.
For example, here is a derivation that the hat matrix\(\mathbf{H} = \mathbf{X}({\mathbf{X}}^{\top}\mathbf{X})^{-1}{\mathbf{X}}^{\top}\) is idempotent, \(\mathbf{H}^2 = \mathbf{H}\), with each step annotated:
\[
\begin{aligned}
\mathbf{H}^2
&= \mathbf{H}\mathbf{H}
&& \text{(definition of a matrix power)}
\\
&= \mathbf{X}({\mathbf{X}}^{\top}\mathbf{X})^{-1}{\mathbf{X}}^{\top}\,\mathbf{X}({\mathbf{X}}^{\top}\mathbf{X})^{-1}{\mathbf{X}}^{\top}
&& \text{(definition of } \mathbf{H} \text{)}
\\
&= \mathbf{X}({\mathbf{X}}^{\top}\mathbf{X})^{-1}({\mathbf{X}}^{\top}\mathbf{X})({\mathbf{X}}^{\top}\mathbf{X})^{-1}{\mathbf{X}}^{\top}
&& \text{(regroup; matrix multiplication is associative)}
\\
&= \mathbf{X}\,\mathbf{I}_p\,({\mathbf{X}}^{\top}\mathbf{X})^{-1}{\mathbf{X}}^{\top}
&& \text{(a matrix inverse times the matrix is } \mathbf{I}_p \text{)}
\\
&= \mathbf{X}({\mathbf{X}}^{\top}\mathbf{X})^{-1}{\mathbf{X}}^{\top}
&& \text{(the identity matrix changes nothing)}
\\
&= \mathbf{H}
&& \text{(definition of } \mathbf{H} \text{)}
\end{aligned}
\]
The Linear Algebra page uses this derivation to show that \(\mathbf{H}\) is a projection matrix. The probability notes derive the variance identity \({\operatorname{Var}\mathopen{}\left(X\right)\mathclose{}} = {\mathbb{E}\mathopen{}\left[X^2\right]\mathclose{}} - {\mathopen{}\left({\mathbb{E}\mathopen{}\left[X\right]\mathclose{}}\right)\mathclose{}}^{2}\)in the same annotated style.
Definition 39 (Direct proof) A direct proof[26] of a proposition\(Q\) starts from the assumptions that \(Q\) is stated under, if any, and reaches \(Q\) through a chain of steps, each of which applies a definition, a previously proved result, or one rule of logic or algebra to the assumptions or to earlier steps. A direct proof never assumes that \(Q\) is false; compare proof by contradiction, which does.
ExmExample 49 (The square of an odd integer is odd)
Example 49 (The square of an odd integer is odd) Claim: if \(n\) is an oddinteger, then \(n^2\) is odd.
Since \(n\) is odd, there is an integer \(k\) with \(n = 2k + 1\). Then
\[
\begin{aligned}
n^2
&= (2k + 1)^2
&& \text{(substitute } n = 2k + 1 \text{)}
\\&= (2k)^2 + 2 \cdot 2k \cdot 1 + 1^2
&& \text{(square of a sum)}
\\&= 4k^2 + 4k + 1
&& \text{(arithmetic)}
\\&= 2(2k^2 + 2k) + 1
&& \text{(distributive law, read from right to left)}
\end{aligned}
\]
and \(2k^2 + 2k\) is an integer, because adding or multiplying integers gives an integer. So \(n^2 = 2 \cdot(\text{an integer}) + 1\), which is the definition of odd. For example,
Definition 40 (Proof by contrapositive) A proof by contrapositive[23] of a proposition “if \(P\), then \(Q\)” is a direct proof of its contrapositive, “if \(\neg Q\), then \(\neg P\)”: it assumes that \(Q\) is false and reaches the conclusion that \(P\) is false. By Theorem 17, proving the contrapositive proves the original proposition.
Example 50 (If \(x^2 + 3x < 0\), then \(x < 0\)) Claim: for every real number\(x\), if \(x^2 + 3x < 0\), then \(x < 0\).
A direct proof would have to start from the inequality\(x^2 + 3x < 0\), which says little about \(x\) on its own. The contrapositive (Definition 34) is “if \(x \ge 0\), then \(x^2 + 3x \ge 0\)”, and its assumption is easier to use.
Suppose \(x \ge 0\). Then \(x^2 = x \cdot x \ge 0\), because a product of two nonnegative numbers is nonnegative, and \(3x \ge 0\), because \(3 > 0\) and \(x \ge 0\). So
That proves the contrapositive, so by Theorem 17 the claim holds. For example, \(x = -1\) gives \(x^2 + 3x = 1 - 3 = -2 < 0\), and indeed \(x < 0\).
6 Proof by cases
DefDefinition 41 (Proof by cases, proof by exhaustion)
Definition 41 (Proof by cases, proof by exhaustion) A proof by cases[27], also called a proof by exhaustion, of a proposition\(Q\) lists propositions\(C_1, \ldots, C_k\), the cases, shows that at least one of them is true, and proves \(C_i \Rightarrow Q\) for each \(i\).
ExmExample 51 (The square of a real number is nonnegative)
Example 51 (The square of a real number is nonnegative) Claim: for every real number\(x\), \(x^2 \ge 0\).
Every real number \(x\) satisfies \(x \ge 0\) or \(x < 0\), so these two cases cover every \(x\).
Case 1: \(x \ge 0\). Then \(x^2 = x \cdot x\) is a product of two nonnegative numbers, so \(x^2 \ge 0\).
Case 2: \(x < 0\). Then \(-x > 0\), and
\[
\begin{aligned}
x^2
&= x \cdot x
&& \text{(definition of } x^2 \text{)}
\\&= (-x) \cdot(-x)
&& \text{(the two minus signs cancel)}
\end{aligned}
\]
is a product of two positive numbers, so \(x^2 > 0\), and in particular \(x^2 \ge 0\).
The claim holds in both cases, so it holds for every real number \(x\).
7 Follow the golden rule
In general, follow the golden rule: treat your readers the way you want to be treated as a reader.
When you read someone else’s proof, you want to be able to follow every step without guessing, to know which result is being used at each line, and to never be left wondering where a quantity came from. Write your own proofs to meet that same standard.
8 Proof by induction
Many proofs in these notes show that a statement holds for every natural number\(n\), or for every integer \(n\) from some starting value on. Checking the statement one \(n\) at a time would never finish; induction proves it for all of them with two arguments.
Definition 42 (Proof by induction) Let \(n_0\) be an integer, and let \(P(n)\) be a predicate about the integers \(n \ge n_0\). A proof by induction[28] on \(n\) shows that \(P(n)\) holds for every integer \(n \ge n_0\) by showing two things:
Base case:\(P(n_0)\) holds.
Inductive step: for every integer \(n > n_0\), if \(P(n - 1)\) holds, then \(P(n)\) holds.
In the inductive step, the assumption that \(P(n - 1)\) holds is called the induction hypothesis.
Remark 4 (Why the two steps suffice). The base case gives \(P(n_0)\). The inductive step with \(n = n_0 + 1\) then gives \(P(n_0 + 1)\), with \(n = n_0 + 2\) it gives \(P(n_0 + 2)\), and so on: each integer \(n \ge n_0\) is reached after \(n - n_0\) uses of the inductive step.
When \(P(n)\) is needed only for \(n_0 \le n \le r\), it is enough to show the inductive step for \(n_0 < n \le r\); the same chain then stops at \(P(r)\).
ExmExample 52 (Sum of the first \(n\) natural numbers)
Example 52 (Sum of the first \(n\) natural numbers) For every \(n \in \mathbb{N}\),
\[
\sum_{i=1}^ni = \frac{n(n+1)}{2}.
\]
For example, with \(n = 3\), \(1 + 2 + 3 = 6\) and \(\frac{3 \cdot 4}{2} = 6\). To prove the equation for every \(n\), let \(P(n)\) be the equation and use Definition 42 with \(n_0 = 1\).
Base case, \(n = 1\). The sum has one term:
\[
\begin{aligned}
\sum_{i=1}^{1} i
&= 1
&& \text{(definition of a sum)}
\end{aligned}
\]
Definition 43 (Propositional logic)Propositional logic[29] is the study of logical entailment among propositions built from basic propositions \(P, Q, R, \ldots\) using only the logical connectives. Whether such propositions entail one another depends only on the truth values of the basic propositions, not on what the basic propositions say.
ExmExample 53 (\(P\) and \(P \Rightarrow Q\) entail \(Q\))
Example 53 (\(P\) and \(P \Rightarrow Q\) entail \(Q\)) Suppose \(P\) is true and \(P \Rightarrow Q\) is true. If \(Q\) were false, then \(P \Rightarrow Q\) would have a true \(P\) and a false \(Q\), so \(P \Rightarrow Q\) would be false, which contradicts the assumption. So \(Q\) is true. This holds whatever \(P\) and \(Q\) say, so \(P\) and \(P \Rightarrow Q\)logically entail\(Q\).
Example 54 (From “for all” to one element) Let \(P(x)\) be a predicate about the elements of a set\(S\), and let \(a \in S\). The propositions\(\forall x \in S, P(x)\) and \(a \in S\)logically entail\(P(a)\): if \(P(x)\) is true for every element \(x\) of \(S\), then it is true for the element \(a\). For example, \(\forall x \in \mathbb{Z}, x^2 \ge 0\) entails \(3^2 \ge 0\). Propositional logic alone cannot express this entailment, because it has no way to refer to the elements of \(S\).
Definition 45 (Formal proof) A formal proof[31] is a proof written in propositional logic (Definition 43) or first-order logic (Definition 44) in which each step is an assumption or follows from earlier steps by one rule taken from a fixed list of allowed rules, so that checking the proof needs no understanding of what its propositions say.
Example 55 (A three-step formal proof) Suppose the allowed rules include “from \(P\) and \(P \Rightarrow Q\), conclude \(Q\)”. Then this is a formal proof of \(Q\) from the assumptions \(P\) and \(P \Rightarrow Q\):
John Wilcox’s logic handouts supplement the same Stanford course, with a handout per week on the syntax and semantics of propositional and first-order logic, natural deduction and metalogic.
Eric Pacuit’s Phil 151: First Order Logic (Stanford, Winter 2009) posts a syllabus, a modal logic study guide and problem sets.
D. J. Velleman, How to prove it: A structured approach, 3rd ed. Cambridge University Press, 2019. doi: 10.1017/9781108539890.
[33]
D. Barker-Plummer, J. Barwise, and J. Etchemendy, Language, proof and logic, 2nd ed. Stanford, CA: CSLI Publications, 2011. Available: https://www.amazon.com/dp/1575866323
---title: "Proof Writing"format: html: default revealjs: output-file: proof-writing-slides.html---{{< include latex-macros/macros.qmd >}}{{< include mds/_proof-writing.qmd >}}# Further reading {#sec-further-reading}- @velleman2019prove is a structured introduction to proof techniques such as [direct proof](#def-direct-proof), [proof by contradiction](proof-writing.qmd#def-proof-by-contradiction), and induction.- @barkerplummer2011language treats proofs as [formal proofs](#def-formal-proof) in [propositional logic](#def-propositional-logic) and [first-order logic](#def-first-order-logic).Free course materials on formal logic:- Thomas Icard's [Phil 150/250, Mathematical Logic course notes](https://web.stanford.edu/~icard/phil150) (Stanford) review sets, relations and functions, then cover propositional, modal and first-order logic.- John Wilcox's [logic handouts](https://www.johnwilcox.org/logic.html) supplement the same Stanford course, with a handout per week on the syntax and semantics of propositional and first-order logic, natural deduction and metalogic.- Eric Pacuit's [Phil 151: First Order Logic](https://cs.stanford.edu/~epacuit/classes/phil151winter09.html) (Stanford, Winter 2009) posts a syllabus, a modal logic study guide and problem sets.# References {.unnumbered}::: {#refs}:::