← 学习库 Discrete Mathematics (Levin) · 中英对照 目录

3.2 Proofs 证明

本页译自 LibreTexts · Discrete Mathematics (Levin) 第 3.2 章。公式经 MathJax 渲染,自定义宏已注入。

Investigate! 探究!

Decide which of the following are valid proofs of the following statement:

判断下列各项是否为下列命题的有效证明:

If $ab$ is an even number, then $a$ or $b$ is even.

如果 $ab$ 为偶数,那么 $a$ 或 $b$ 为偶数。
  1. Suppose $a$ and $b$ are odd. That is, $a=2k+1$ and $b=2m+1$ for some integers $k$ and $m\text{.}$ Then \begin{align*} ab & =(2k+1)(2m+1)\\ & =4km+2k+2m+1\\ & =2(2km+k+m)+1. \end{align*} Therefore $ab$ is odd.
  2. Assume that $a$ or $b$ is even - say it is $a$ (the case where $b$ is even will be identical). That is, $a=2k$ for some integer $k\text{.}$ Then \begin{align*} ab & =(2k)b\\ & =2(kb). \end{align*} Thus $ab$ is even.
  3. Suppose that $ab$ is even but $a$ and $b$ are both odd. Namely, $ab = 2n\text{,}$ $a=2k+1$ and $b=2j+1$ for some integers $n\text{,}$ $k\text{,}$ and $j\text{.}$ Then \begin{align*} 2n & =(2k+1)(2j+1)\\ 2n & =4kj+2k+2j+1\\ n & = 2kj+k+j+\frac{1}{2}. \end{align*} But since $2kj+k+j$ is an integer, this says that the integer $n$ is equal to a non-integer, which is impossible.
  4. Let $ab$ be an even number, say $ab=2n\text{,}$ and $a$ be an odd number, say $a=2k+1\text{.}$ \begin{align*} ab & =(2k+1)b\\ 2n & =2kb+b\\ 2n-2kb& =b\\ 2(n-kb)& =b. \end{align*} Therefore $b$ must be even.
  1. 设 $a$ 与 $b$ 均为奇数。即存在整数 $k$ 与 $m$ 使得 $a=2k+1$ 且 $b=2m+1\text{。}$ 于是 \begin{align*} ab & =(2k+1)(2m+1)\\ & =4km+2k+2m+1\\ & =2(2km+k+m)+1. \end{align*} 因此 $ab$ 为奇数。
  2. 假设 $a$ 或 $b$ 为偶数——不妨设是 $a$($b$ 为偶数的情形完全类似)。即存在整数 $k$ 使得 $a=2k\text{。}$ 于是 \begin{align*} ab & =(2k)b\\ & =2(kb). \end{align*} 故 $ab$ 为偶数。
  3. 假设 $ab$ 为偶数,但 $a$ 与 $b$ 均为奇数。即存在整数 $n\text{、}$ $k\text{、}$ $j$ 使得 $ab = 2n\text{,}$ $a=2k+1$ 且 $b=2j+1\text{。}$ 于是 \begin{align*} 2n & =(2k+1)(2j+1)\\ 2n & =4kj+2k+2j+1\\ n & = 2kj+k+j+\frac{1}{2}. \end{align*} 但 $2kj+k+j$ 是整数,这意味着整数 $n$ 等于一个非整数,矛盾。
  4. 设 $ab$ 为偶数,例如 $ab=2n\text{,}$且 $a$ 为奇数,例如 $a=2k+1\text{。}$ \begin{align*} ab & =(2k+1)b\\ 2n & =2kb+b\\ 2n-2kb& =b\\ 2(n-kb)& =b. \end{align*} 因此 $b$ 必为偶数。

Anyone who doesn't believe there is creativity in mathematics clearly has not tried to write proofs. Finding a way to convince the world that a particular statement is necessarily true is a mighty undertaking and can often be quite challenging. There is not a guaranteed path to success in the search for proofs. For example, in the summer of 1742, a German mathematician by the name of Christian Goldbach wondered whether every even integer greater than 2 could be written as the sum of two primes. Centuries later, we still don't have a proof of this apparent fact (computers have checked that "Goldbach's Conjecture" holds for all numbers less than $4\times 10^{18}\text{,}$ which leaves only infinitely many more numbers to check).

凡是不相信数学中也有创造性的人,显然从未尝试过写证明。要找到一种方法让世人信服某个命题必然为真,是一项艰巨的任务,且往往颇具挑战。寻求证明并没有一条保证成功的固定路径。例如,1742 年夏天,一位名叫克里斯蒂安·哥德巴赫(Christian Goldbach)的德国数学家曾猜想:是否每个大于 2 的偶数都能写成两个素数之和。几个世纪过去了,我们依然没有证明这一看似显然的事实(计算机已验证「哥德巴赫猜想」对所有小于 $4\times 10^{18}\text{,}$的数都成立,而剩下待检验的数仍有无限多个)。

Writing proofs is a bit of an art. Like any art, to be truly great at it, you need some sort of inspiration, as well as some foundational technique. Just as musicians can learn proper fingering, and painters can learn the proper way to hold a brush, we can look at the proper way to construct arguments. A good place to start might be to study a classic.

写证明颇有些像一门艺术。与任何艺术一样,要真正精通它,既需要某种灵感,也需要扎实的基本功。正如音乐家可以学习正确的指法、画家可以学习握笔的正确方式,我们也可以研究构造论证的正确方法。一个不错的起点,或许是研究一篇经典之作。

Theorem 3.2.1 There are infinitely many primes.

定理 3.2.1 素数有无穷多个。

Proof

证明

Suppose this were not the case. That is, suppose there are only finitely many primes. Then there must be a last, largest prime, call it $p\text{.}$ Consider the number \begin{equation*} N = p! + 1 = (p \cdot (p-1) \cdot \cdots 3\cdot 2 \cdot 1) + 1. \end{equation*} Now $N$ is certainly larger than $p\text{.}$ Also, $N$ is not divisible by any number less than or equal to $p\text{,}$ since every number less than or equal to $p$ divides $p!\text{.}$ Thus the prime factorization of $N$ contains prime numbers (possibly just $N$ itself) all greater than $p\text{.}$ So $p$ is not the largest prime, a contradiction. Therefore there are infinitely many primes. ∎

设情形并非如此。即假设素数只有有限多个。那么必存在一个最后、也是最大的素数,记为 $p\text{。}$ 考虑数 \begin{equation*} N = p! + 1 = (p \cdot (p-1) \cdot \cdots 3\cdot 2 \cdot 1) + 1. \end{equation*} 显然 $N$ 大于 $p\text{。}$ 此外,$N$ 不能被任何小于或等于 $p$ 的数整除,因为每一个小于或等于 $p$ 的数都整除 $p!\text{。}$ 因此 $N$ 的素因数分解中所含的素数(可能只有 $N$ 本身)全都大于 $p\text{。}$ 所以 $p$ 并非最大的素数,矛盾。故素数有无穷多个。∎

This proof is an example of a proof by contradiction, one of the standard styles of mathematical proof. First and foremost, the proof is an argument. It contains sequence of statements, the last being the conclusion which follows from the previous statements. The argument is valid so the conclusion must be true if the premises are true. Let's go through the proof line by line.

这个证明是反证法(proof by contradiction)的一个例子,而反证法是数学证明的标准风格之一。首先且最重要的是,证明就是一种论证。它由一系列语句构成,最后一句是由前面各句推出的结论。该论证是有效的,因此只要前提为真,结论就必然为真。下面我们逐行审视这个证明。
  1. Suppose there are only finitely many primes. [this is a premise. Note the use of "suppose."]
  2. There must be a largest prime, call it $p\text{.}$ [follows from line 1, by the definition of "finitely many."]
  3. Let $N = p! + 1\text{.}$ [basically just notation, although this is the inspired part of the proof; looking at $p! + 1$ is the key insight.]
  4. $N$ is larger than $p\text{.}$ [by the definition of $p!$]
  5. $N$ is not divisible by any number less than or equal to $p\text{.}$ [by definition, $p!$ is divisible by each number less than or equal to $p\text{,}$ so $p! + 1$ is not.]
  6. The prime factorization of $N$ contains prime numbers greater than $p\text{.}$ [since $N$ is divisible by each prime number in the prime factorization of $N\text{,}$ and by line 5.]
  7. Therefore $p$ is not the largest prime. [by line 6, $N$ is divisible by a prime larger than $p\text{.}$]
  8. This is a contradiction. [from line 2 and line 7: the largest prime is $p$ and there is a prime larger than $p\text{.}$]
  9. Therefore there are infinitely many primes. [from line 1 and line 8: our only premise lead to a contradiction, so the premise is false.]
  1. 假设素数只有有限多个。[这是一条前提。注意这里用了「假设」。]
  2. 必存在一个最大的素数,记为 $p\text{。}$ [由第 1 行及「有限多个」的定义推出。]
  3. 令 $N = p! + 1\text{。}$ [基本只是记号,但这正是证明中富有灵感的部分;盯住 $p! + 1$ 是关键洞见。]
  4. $N$ 大于 $p\text{。}$ [由 $p!$ 的定义。]
  5. $N$ 不能被任何小于或等于 $p$ 的数整除。[根据定义,$p!$ 能被每个小于或等于 $p$ 的数整除,故 $p! + 1$ 不能。]
  6. $N$ 的素因数分解中含有大于 $p$ 的素数。[因为 $N$ 能被其素因数分解中的每一个素数整除,且由第 5 行。]
  7. 因此 $p$ 并非最大的素数。[由第 6 行,$N$ 能被一个大于 $p$ 的素数整除。]
  8. 这是一个矛盾。[综合第 2 行与第 7 行:最大的素数是 $p$,同时又存在一个大于 $p$ 的素数。]
  9. 因此素数有无穷多个。[由第 1 行与第 8 行:我们唯一的前提导致了矛盾,故该前提为假。]

We should say a bit more about the last line. Up through line 8, we have a valid argument with the premise "there are only finitely many primes" and the conclusion "there is a prime larger than the largest prime." This is a valid argument as each line follows from previous lines. So if the premises are true, then the conclusion must be true. However, the conclusion is NOT true. The only way out: the premise must be false.

关于最后一行,我们还需要多说几句。直到第 8 行,我们得到了一个有效论证,其前提为「素数只有有限多个」,结论为「存在一个大于最大素数的素数」。由于每一行都由前面的行推出,这是一个有效论证。因此,只要前提为真,结论就必然为真。然而,这个结论并不为真。唯一的出路是:前提必为假。

The sort of line-by-line analysis we did above is a great way to really understand what is going on. Whenever you come across a proof in a textbook, you really should make sure you understand what each line is saying and why it is true. Additionally, it is equally important to understand the overall structure of the proof. This is where using tools from logic is helpful. Luckily there are a relatively small number of standard proof styles that keep showing up again and again. Being familiar with these can help understand proof, as well as give ideas of how to write your own.

我们上面所做的这种逐行分析,是真正弄懂证明思路的好方法。每当你在教材中遇到一个证明,都应确保自己理解每一行在说什么、以及它为何为真。此外,理解证明的整体结构同样重要。这正是逻辑工具能派上用场的地方。所幸,反复出现的证明风格数量相当有限。熟悉这些风格,既有助于理解证明,也能为如何自己动手写证明提供思路。

Direct Proof 直接证明

The simplest (from a logic perspective) style of proof is a direct proof. Often all that is required to prove something is a systematic explanation of what everything means. Direct proofs are especially useful when proving implications. The general format to prove $P \imp Q$ is this:

从逻辑的角度看,最简单的证明风格是直接证明(direct proof)。证明某件事,往往只需要对其中每个概念的含义做系统的解释。在证明蕴涵时,直接证明尤为有用。证明 $P \imp Q$ 的一般格式如下:

Assume $P\text{.}$ Explain, explain, …, explain. Therefore $Q\text{.}$

假设 $P\text{。}$ 解释,解释,……,解释。因此 $Q\text{。}$

Often we want to prove universal statements, perhaps of the form $\forall x (P(x) \imp Q(x))\text{.}$ Again, we will want to assume $P(x)$ is true and deduce $Q(x)\text{.}$ But what about the $x\text{?}$ We want this to work for all $x\text{.}$ We accomplish this by fixing $x$ to be an arbitrary element (of the sort we are interested in).

我们常常想要证明全称命题,其形式可能是 $\forall x (P(x) \imp Q(x))\text{。}$ 同样地,我们会假设 $P(x)$ 为真,并推演出 $Q(x)\text{。}$ 但 $x$ 又当如何?我们希望这对所有的 $x$ 都成立。做法是将 $x$ 固定为一个(我们感兴趣的)任意元素。

Here are a few examples. First, we will set up the proof structure for a direct proof, then fill in the details.

下面举几个例子。我们会先搭好直接证明的框架,再填入细节。

Example 3.2.1

示例 3.2.1

Prove: For all integers $n\text{,}$ if $n$ is even, then $n^2$ is even.

证明:对所有整数 $n\text{,}$若 $n$ 为偶数,则 $n^2$ 为偶数。

Solution

解答

The format of the proof with be this: Let $n$ be an arbitrary integer. Assume that $n$ is even. Explain explain explain. Therefore $n^2$ is even.

证明的格式将如下:令 $n$ 为任意整数。假设 $n$ 为偶数。解释解释解释。因此 $n^2$ 为偶数。

To fill in the details, we will basically just explain what it means for $n$ to be even, and then see what that means for $n^2\text{.}$ Here is a complete proof.

要填入细节,我们基本上只需解释 $n$ 为偶数意味着什么,再看这对 $n^2$ 又意味着什么。下面是一个完整的证明。

Proof

证明

Let $n$ be an arbitrary integer. Suppose $n$ is even. Then $n = 2k$ for some integer $k\text{.}$ Now $n^2 = (2k)^2 = 4k^2 = 2(2k^2)\text{.}$ Since $2k^2$ is an integer, $n^2$ is even. ∎

令 $n$ 为任意整数。设 $n$ 为偶数。则存在整数 $k$ 使得 $n = 2k\text{。}$ 于是 $n^2 = (2k)^2 = 4k^2 = 2(2k^2)\text{。}$ 由于 $2k^2$ 是整数,可知 $n^2$ 为偶数。∎

Example 3.2.2

示例 3.2.2

Prove: For all integers $a\text{,}$ $b\text{,}$ and $c\text{,}$ if $a|b$ and $b|c$ then $a|c\text{.}$ Here $x|y\text{,}$ read "$x$ divides $y$" means that $y$ is a multiple of $x$ (so $x$ will divide into $y$ without remainder).

证明:对所有整数 $a\text{、}$ $b\text{、}$ $c\text{,}$若 $a\mid b$ 且 $b\mid c$,则 $a\mid c\text{。}$ 这里 $x\mid y$ 读作「$x$ 整除 $y$」,表示 $y$ 是 $x$ 的倍数(即 $x$ 能整除 $y$ 而无余数)。

Solution

解答

Even before we know what the divides symbol means, we can set up a direct proof for this statement. It will go something like this: Let $a\text{,}$ $b\text{,}$ and $c$ be arbitrary integers. Assume that $a|b$ and $b|c\text{.}$ Dot dot dot. Therefore $a|c\text{.}$

在我们弄清整除符号的含义之前,就可以为这个命题搭好直接证明的框架。大致如下:令 $a\text{、}$ $b\text{、}$ $c$ 为任意整数。假设 $a\mid b$ 且 $b\mid c\text{。}$ 省略号。因此 $a\mid c\text{。}$

How do we connect the dots? We say what our hypothesis ($a|b$ and $b|c$) really means and why this gives us what the conclusion ($a|c$) really means. Another way to say that $a|b$ is to say that $b = ka$ for some integer $k$ (that is, that $b$ is a multiple of $a$). What are we going for? That $c = la\text{,}$ for some integer $l$ (because we want $c$ to be a multiple of $a$). Here is the complete proof.

我们如何把省略号连起来?我们要说明前提($a\mid b$ 且 $b\mid c$)究竟意味着什么,以及它为何能推出结论($a\mid c$)的含义。另一种表述 $a\mid b$ 的方式是:$b = ka$,其中 $k$ 为某个整数(即 $b$ 是 $a$ 的倍数)。我们的目标是什么?是 $c = la\text{,}$其中 $l$ 为某个整数(因为我们希望 $c$ 是 $a$ 的倍数)。下面是完整的证明。

Proof

证明

Let $a\text{,}$ $b\text{,}$ and $c$ be integers. Assume that $a|b$ and $b|c\text{.}$ In other words, $b$ is a multiple of $a$ and $c$ is a multiple of $b\text{.}$ So there are integers $k$ and $j$ such that $b = ka$ and $c = jb\text{.}$ Combining these (through substitution) we get that $c = jka\text{.}$ But $jk$ is an integer, so this says that $c$ is a multiple of $a\text{.}$ Therefore $a|c\text{.}$ ∎

令 $a\text{、}$ $b\text{、}$ $c$ 为整数。假设 $a\mid b$ 且 $b\mid c\text{。}$ 换言之,$b$ 是 $a$ 的倍数,$c$ 是 $b$ 的倍数。因此存在整数 $k$ 与 $j$ 使得 $b = ka$ 且 $c = jb\text{。}$ 将它们代入合并,得到 $c = jka\text{。}$ 而 $jk$ 是整数,故这表明 $c$ 是 $a$ 的倍数。因此 $a\mid c\text{。}$ ∎

Proof by Contrapositive 逆否证明

Recall that an implication $P \imp Q$ is logically equivalent to its contrapositive $\neg Q \imp \neg P\text{.}$ There are plenty of examples of statements which are hard to prove directly, but whose contrapositive can easily be proved directly. This is all that proof by contrapositive does. It gives a direct proof of the contrapositive of the implication. This is enough because the contrapositive is logically equivalent to the original implication.

回顾一下:蕴涵 $P \imp Q$ 在逻辑上等价于其逆否命题 $\neg Q \imp \neg P\text{。}$ 有许多命题难以直接证明,但其逆否命题却可以轻易地直接证出。这正逆否证明(proof by contrapositive)所做的全部工作:它对蕴涵的逆否命题给出一个直接证明。这就足够了,因为逆否命题与原蕴涵在逻辑上等价。

The skeleton of the proof of $P \imp Q$ by contrapositive will always look roughly like this:

用逆否证明来证 $P \imp Q$ 的骨架,大致总是如下这般:

Assume $\neg Q\text{.}$ Explain, explain, … explain. Therefore $\neg P\text{.}$

假设 $\neg Q\text{。}$ 解释,解释,……,解释。因此 $\neg P\text{。}$

As before, if there are variables and quantifiers, we set them to be arbitrary elements of our domain. Here are a couple examples:

和之前一样,若有变量和量词,我们将其设为论域中的任意元素。下面举几个例子:

Example 3.2.3

示例 3.2.3

Is the statement "for all integers $n\text{,}$ if $n^2$ is even, then $n$ is even" true?

命题「对所有整数 $n\text{,}$若 $n^2$ 为偶数,则 $n$ 为偶数」为真吗?

Solution

解答

This is the converse of the statement we proved above using a direct proof. From trying a few examples, this statement definitely appears this is true. So let's prove it.

这是我们用直接证明证过的那个命题的逆命题。试几个例子便不难发现,这个命题看起来确实为真。那么我们不妨来证明它。

A direct proof of this statement would require fixing an arbitrary $n$ and assuming that $n^2$ is even. But it is not at all clear how this would allow us to conclude anything about $n\text{.}$ Just because $n^2 = 2k$ does not in itself suggest how we could write $n$ as a multiple of 2.

这个命题的直接证明需要固定一个任意的 $n$,并假设 $n^2$ 为偶数。但由此如何能推出关于 $n$ 的任何结论,却一点也不清楚。仅仅知道 $n^2 = 2k$,本身并不提示我们该如何把 $n$ 写成 2 的倍数。

Try something else: write the contrapositive of the statement. We get, for all integers $n\text{,}$ if $n$ is odd then $n^2$ is odd. This looks much more promising. Our proof will look something like this: Let $n$ be an arbitrary integer. Suppose that $n$ is not even. This means that …. In other words …. But this is the same as saying …. Therefore $n^2$ is not even.

换个思路:写出这个命题的逆否命题。我们得到:对所有整数 $n\text{,}$若 $n$ 为奇数,则 $n^2$ 为奇数。这看起来有希望得多。我们的证明大致如下: 令 $n$ 为任意整数。假设 $n$ 不为偶数。这意味着……。换言之……。而这等同于说……。因此 $n^2$ 不为偶数。

Now we fill in the details:

现在填入细节:

Proof

证明

We will prove the contrapositive. Let $n$ be an arbitrary integer. Suppose that $n$ is not even, and thus odd. Then $n= 2k+1$ for some integer $k\text{.}$ Now $n^2 = (2k+1)^2 = 4k^2 + 4k + 1 = 2(2k^2 + 2k) + 1\text{.}$ Since $2k^2 + 2k$ is an integer, we see that $n^2$ is odd and therefore not even. ∎

我们将证明逆否命题。令 $n$ 为任意整数。假设 $n$ 不为偶数,从而为奇数。则存在整数 $k$ 使得 $n= 2k+1\text{。}$ 于是 $n^2 = (2k+1)^2 = 4k^2 + 4k + 1 = 2(2k^2 + 2k) + 1\text{。}$ 由于 $2k^2 + 2k$ 为整数,可知 $n^2$ 为奇数,从而不为偶数。∎

Example 3.2.4

示例 3.2.4

Prove: for all integers $a$ and $b\text{,}$ if $a + b$ is odd, then $a$ is odd or $b$ is odd.

证明:对所有整数 $a$ 与 $b\text{,}$若 $a + b$ 为奇数,则 $a$ 为奇数或 $b$ 为奇数。

Solution

解答

The problem with trying a direct proof is that it will be hard to separate $a$ and $b$ from knowing something about $a+b\text{.}$ On the other hand, if we know something about $a$ and $b$ separately, then combining them might give us information about $a+b\text{.}$ The contrapositive of the statement we are trying to prove is: for all integers $a$ and $b\text{,}$ if $a$ and $b$ are even, then $a+b$ is even. Thus our proof will have the following format: Let $a$ and $b$ be integers. Assume that $a$ and $b$ are both even. la la la. Therefore $a+b$ is even.

尝试直接证明的困难在于:由关于 $a+b$ 的已知条件,很难将 $a$ 与 $b$ 分离开来。另一方面,若我们分别知道关于 $a$ 与 $b$ 的某些信息,再把它们合起来,或许能得到关于 $a+b$ 的信息。我们要证的命题的逆否命题为:对所有整数 $a$ 与 $b\text{,}$若 $a$ 与 $b$ 均为偶数,则 $a+b$ 为偶数。因此我们的证明将采用如下格式: 令 $a$ 与 $b$ 为整数。假设 $a$ 与 $b$ 均为偶数。省略号。因此 $a+b$ 为偶数。

Proof

证明

Let $a$ and $b$ be integers. Assume that $a$ and $b$ are even. Then $a = 2k$ and $b = 2l$ for some integers $k$ and $l\text{.}$ Now $a + b = 2k + 2l = 2(k+1)\text{.}$ Since $k + l$ is an integer, we see that $a + b$ is even, completing the proof. ∎

令 $a$ 与 $b$ 为整数。假设 $a$ 与 $b$ 均为偶数。则存在整数 $k$ 与 $l$ 使得 $a = 2k$ 且 $b = 2l\text{。}$ 于是 $a + b = 2k + 2l = 2(k+1)\text{。}$ 由于 $k + l$ 为整数,可知 $a + b$ 为偶数,证毕。∎

Note that our assumption that $a$ and $b$ are even is really the negation of $a$ or $b$ is odd. We used De Morgan's law here.

注意,我们假设 $a$ 与 $b$ 均为偶数,实际上正是「$a$ 或 $b$ 为奇数」的否定。这里我们用到了德·摩根定律(De Morgan's law)。

We have seen how to prove some statements in the form of implications: either directly or by contrapositive. Some statements are not written as implications to begin with.

我们已经看到,对于形如蕴涵的命题,可以借由直接证明或逆否证明来证。有些命题一开始并非以蕴涵的形式写出。

Example 3.2.5

示例 3.2.5

Consider the statement, for every prime number $p\text{,}$ either $p = 2$ or $p$ is odd. We can rephrase this: for every prime number $p\text{,}$ if $p \ne 2\text{,}$ then $p$ is odd. Now try to prove it.

考虑如下命题:对每个素数 $p\text{,}$要么 $p = 2$,要么 $p$ 为奇数。我们可以把它改写为:对每个素数 $p\text{,}$若 $p \ne 2\text{,}$则 $p$ 为奇数。现在试着证明它。

Solution

解答

Proof

证明

Let $p$ be an arbitrary prime number. Assume $p$ is not odd. So $p$ is divisible by 2. Since $p$ is prime, it must have exactly two divisors, and it has 2 as a divisor, so $p$ must be divisible by only 1 and 2. Therefore $p = 2\text{.}$ This completes the proof (by contrapositive). ∎

令 $p$ 为任意素数。假设 $p$ 不为奇数。则 $p$ 能被 2 整除。由于 $p$ 是素数,它恰有两个正因数;而 2 是它的一个因数,故 $p$ 只能被 1 和 2 整除。因此 $p = 2\text{。}$ 证毕(逆否证明)。∎

Proof by Contradiction 反证法

There might be statements which really cannot be rephrased as implications. For example, "$\sqrt{2}$ is irrational." In this case, it is hard to know where to start. What can we assume? Well, say we want to prove the statement $P\text{.}$ What if we could prove that $\neg P \imp Q$ where $Q$ was false? If this implication is true, and $Q$ is false, what can we say about $\neg P\text{?}$ It must be false as well, which makes $P$ true!

有些命题确实无法改写成蕴涵的形式。例如,「$\sqrt{2}$ 是无理数」。这种情况下,往往难以找到入手之处。我们能假设什么呢?假设我们想证明命题 $P\text{。}$ 倘若我们能证明 $\neg P \imp Q$,而 $Q$ 为假,会怎样?如果这个蕴涵为真,且 $Q$ 为假,那么关于 $\neg P$ 我们能说什么?它必然也为假,从而 $P$ 为真!

This is why proof by contradiction works. If we can prove that $\neg P$ leads to a contradiction, then the only conclusion is that $\neg P$ is false, so $P$ is true. That's what we wanted to prove. In other words, if it is impossible for $P$ to be false, $P$ must be true.

这正说明了反证法(proof by contradiction)何以成立。如果我们能证明 $\neg P$ 会导致矛盾,那么唯一的结论就是 $\neg P$ 为假,从而 $P$ 为真。而这正是我们要证的。换言之,若 $P$ 不可能为假,则 $P$ 必为真。

Here are a couple examples of proofs by contradiction:

下面举几个反证法的例子:

Example 3.2.6

示例 3.2.6

Prove that $\sqrt{2}$ is irrational.

证明 $\sqrt{2}$ 是无理数。

Solution

解答

Proof

证明

Suppose not. Then $\sqrt{2}$ is equal to a fraction $\frac{a}{b}\text{.}$ Without loss of generality, assume $\frac{a}{b}$ is in lowest terms (otherwise reduce the fraction). So, \begin{equation*} 2 = \frac{a^2}{b^2} \end{equation*} \begin{equation*} 2b^2 = a^2 \end{equation*} Thus $a^2$ is even, and as such $a$ is even. So $a = 2k$ for some integer $k\text{,}$ and $a^2 = 4k^2\text{.}$ We then have, \begin{equation*} 2b^2 = 4k^2 \end{equation*} \begin{equation*} b^2 = 2k^2 \end{equation*} Thus $b^2$ is even, and as such $b$ is even. Since $a$ is also even, we see that $\frac{a}{b}$ is not in lowest terms, a contradiction. Thus $\sqrt{2}$ is irrational. ∎

假设不然。则 $\sqrt{2}$ 等于某个分数 $\frac{a}{b}\text{。}$ 不失一般性,设 $\frac{a}{b}$ 已是最简分数(否则将其约分)。于是, \begin{equation*} 2 = \frac{a^2}{b^2} \end{equation*} \begin{equation*} 2b^2 = a^2 \end{equation*} 因此 $a^2$ 为偶数,从而 $a$ 为偶数。故存在整数 $k$ 使得 $a = 2k\text{,}$且 $a^2 = 4k^2\text{。}$ 进而有, \begin{equation*} 2b^2 = 4k^2 \end{equation*} \begin{equation*} b^2 = 2k^2 \end{equation*} 因此 $b^2$ 为偶数,从而 $b$ 为偶数。由于 $a$ 也为偶数,可见 $\frac{a}{b}$ 并非最简分数,矛盾。故 $\sqrt{2}$ 是无理数。∎

Example 3.2.7

示例 3.2.7

Prove: There are no integers $x$ and $y$ such that $x^2 = 4y + 2\text{.}$

证明:不存在整数 $x$ 与 $y$ 使得 $x^2 = 4y + 2\text{。}$

Solution

解答

Proof

证明

We proceed by contradiction. So suppose there are integers $x$ and $y$ such that $x^2 = 4y + 2 = 2(2y + 1)\text{.}$ So $x^2$ is even. We have seen that this implies that $x$ is even. So $x = 2k$ for some integer $k\text{.}$ Then $x^2 = 4k^2\text{.}$ This in turn gives $2k^2 = (2y + 1)\text{.}$ But $2k^2$ is even, and $2y + 1$ is odd, so these cannot be equal. Thus we have a contradiction, so there must not be any integers $x$ and $y$ such that $x^2 = 4y + 2\text{.}$ ∎

我们用反证法。假设存在整数 $x$ 与 $y$ 使得 $x^2 = 4y + 2 = 2(2y + 1)\text{。}$ 于是 $x^2$ 为偶数。前面已经看到,这蕴含着 $x$ 为偶数。故存在整数 $k$ 使得 $x = 2k\text{。}$ 则 $x^2 = 4k^2\text{。}$ 这又推出 $2k^2 = (2y + 1)\text{。}$ 但 $2k^2$ 是偶数,而 $2y + 1$ 是奇数,二者不可能相等。于是我们得到矛盾,故不可能存在整数 $x$ 与 $y$ 使得 $x^2 = 4y + 2\text{。}$ ∎

Example 3.2.8

示例 3.2.8

The Pigeonhole Principle: If more than $n$ pigeons fly into $n$ pigeon holes, then at least one pigeon hole will contain at least two pigeons. Prove this!

鸽巢原理(Pigeonhole Principle):若多于 $n$ 只鸽子飞入 $n$ 个鸽巢,则至少有一个鸽巢中至少有两只鸽子。证明它!

Solution

解答

Proof

证明

Suppose, contrary to stipulation, that each of the pigeon holes contain at most one pigeon. Then at most, there will be $n$ pigeons. But we assumed that there are more than $n$ pigeons, so this is impossible. Thus there must be a pigeonhole with more than one pigeon. ∎

假设(与题设相反)每个鸽巢至多只有一只鸽子。那么鸽子的总数至多为 $n$ 只。但我们假定有超过 $n$ 只鸽子,这不可能。因此必存在一个含有多于一只鸽子的鸽巢。∎

While we phrased this proof as a proof by contradiction, we could have also used a proof by contrapositive since our contradiction was simply the negation of the hypothesis. Sometimes this will happen, in which case you can use either style of proof. There are examples however where the contradiction occurs "far away" from the original statement.

虽然我们把这个证明表述为反证法,但由于其中的矛盾其实就是前提的否定,我们本也可以用逆否证明。这种情况有时会出现,届时两种证明风格任选其一皆可。不过,也有不少例子中,矛盾出现在「远离」原命题的地方。

Proof by (counter) Example 反例证明

It is almost NEVER okay to prove a statement with just an example. Certainly none of the statements proved above can be proved through an example. This is because in each of those cases we are trying to prove that something holds of all integers. We claim that $n^2$ being even implies that $n$ is even, no matter what integer $n$ we pick. Showing that this works for $n = 4$ is not even close to enough.

几乎绝不可只用单个例子去证明一个命题。上面证过的命题,没有哪一个可以靠举例来证明。这是因为在那些情形中,我们试图证明某性质对所有整数都成立。我们断言:$n^2$ 为偶数蕴含 $n$ 为偶数,无论我们取哪个整数 $n$。仅对 $n = 4$ 验证成立,还差得远。

This cannot be stressed enough. If you are trying to prove a statement of the form $\forall x P(x)\text{,}$ you absolutely CANNOT prove this with an example.1

这一点再怎么强调也不为过。如果你想证明形如 $\forall x P(x)\text{,}$的命题,你绝不能靠一个例子来证明它。¹

However, existential statements can be proven this way. If we want to prove that there is an integer $n$ such that $n^2-n+41$ is not prime, all we need to do is find one. This might seem like a silly thing to want to prove until you try a few values for $n\text{.}$

然而,存在性命题却可以如此证明。若我们想证明:存在整数 $n$ 使得 $n^2-n+41$ 不是素数,只需找出一个这样的 $n$ 即可。在你试过几个 $n$ 的值之前,这看上去或许像个荒唐的命题。
$n$1234567
$n^2 - n + 41$41434753617183
上表列出了 $n = 1, 2, \ldots, 7$ 时 $n^2 - n + 41$ 的取值:41、43、47、53、61、71、83,全部为素数。这容易让人误以为该式对所有正整数都给出素数,但正如正文所示,这远不足以构成证明,且当 $n = 41$ 时它给出合数。

So far we have gotten only primes. You might be tempted to conjecture, "For all positive integers $n\text{,}$ the number $n^2 - n + 41$ is prime." If you wanted to prove this, you would need to use a direct proof, a proof by contrapositive, or another style of proof, but certainly it is not enough to give even 7 examples. In fact, we can prove this conjecture is false by proving its negation: "There is a positive integer $n$ such that $n^2 - n + 41$ is not prime." Since this is an existential statement, it suffices to show that there does indeed exist such a number.

到目前为止,我们得到的全是素数。你或许会忍不住猜想:「对所有正整数 $n\text{,}$数 $n^2 - n + 41$ 都是素数。」若你想证明这一点,需要用到直接证明、逆否证明或其他某种证明风格,而仅仅举出 7 个例子显然是不够的。事实上,我们可以通过证明其否定来表明这个猜想为假:「存在正整数 $n$ 使得 $n^2 - n + 41$ 不是素数。」由于这是一个存在性命题,只需证明这样的数确实存在即可。

In fact, we can quickly see that $n = 41$ will give $41^2$ which is certainly not prime. You might say that this is a counterexample to the conjecture that $n^2 - n + 41$ is always prime. Since so many statements in mathematics are universal, making their negations existential, we can often prove that a statement is false (if it is) by providing a counterexample.

事实上,我们很快就能看出:当 $n = 41$ 时得到 $41^2$,它显然不是素数。你或许会说,这就是「$n^2 - n + 41$ 恒为素数」这一猜想的一个反例。由于数学中许多命题都是全称命题,其否定是存在性命题,我们常常可以通过给出一个反例,来证明某个命题(如果它确实)为假。

Example 3.2.9

示例 3.2.9

Above we proved, "for all integers $a$ and $b\text{,}$ if $a+b$ is odd, then $a$ is odd or $b$ is odd." Is the converse true?

前面我们证明了:「对所有整数 $a$ 与 $b\text{,}$若 $a+b$ 为奇数,则 $a$ 为奇数或 $b$ 为奇数。」它的逆命题为真吗?

Solution

解答

The converse is the statement, "for all integers $a$ and $b\text{,}$ if $a$ is odd or $b$ is odd, then $a + b$ is odd." This is false! How do we prove it is false? We need to prove the negation of the converse. Let's look at the symbols. The converse is \begin{equation*} \forall a \forall b ((O(a) \vee O(b)) \imp O(a+b)). \end{equation*} We want to prove the negation: \begin{equation*} \neg \forall a \forall b ((O(a) \vee O(b)) \imp O(a+b)). \end{equation*} Simplify using the rules from the previous sections: \begin{equation*} \exists a \exists b ((O(a) \vee O(b)) \wedge \neg O(a+b)). \end{equation*} As the negation passed by the quantifiers, they changed from $\forall$ to $\exists\text{.}$ We then needed to take the negation of an implication, which is equivalent to asserting the if part and not the then part.

逆命题为:「对所有整数 $a$ 与 $b\text{,}$若 $a$ 为奇数或 $b$ 为奇数,则 $a + b$ 为奇数。」这是假的!我们如何证明它为假?需要证明逆命题的否定。来看符号表达。逆命题是 \begin{equation*} \forall a \forall b ((O(a) \vee O(b)) \imp O(a+b)). \end{equation*} 我们要证明它的否定: \begin{equation*} \neg \forall a \forall b ((O(a) \vee O(b)) \imp O(a+b)). \end{equation*} 利用前面各节的规则化简: \begin{equation*} \exists a \exists b ((O(a) \vee O(b)) \wedge \neg O(a+b)). \end{equation*} 当否定越过量词时,量词由 $\forall$ 变为 $\exists\text{。}$ 接着我们需要对蕴涵取否定,这等价于肯定 if 部分而否定 then 部分。

Now we know what to do. To prove that the converse is false we need to find two integers $a$ and $b$ so that $a$ is odd or $b$ is odd, but $a+b$ is not odd (so even). That's easy: 1 and 3. (remember, "or" means one or the other or both). Both of these are odd, but $1+3 = 4$ is not odd.

现在我们已经知道该怎么做。要证明逆命题为假,只需找出两个整数 $a$ 与 $b$,使得 $a$ 为奇数或 $b$ 为奇数,但 $a+b$ 不为奇数(即为偶数)。这很容易:1 和 3。(记住,「或」表示一个或另一个或两者兼具。)它们都为奇数,但 $1+3 = 4$ 不是奇数。∎

Proof by Cases 分情况证明

We could go on and on and on about different proof styles (we haven't even mentioned induction or combinatorial proofs here), but instead we will end with one final useful technique: proof by cases. The idea is to prove that $P$ is true by proving that $Q \imp P$ and $\neg Q \imp P$ for some statement $Q\text{.}$ So no matter what, whether or not $Q$ is true, we know that $P$ is true. In fact, we could generalize this. Suppose we want to prove $P\text{.}$ We know that at least one of the statements $Q_1, Q_2, \ldots, Q_n$ are true. If we can show that $Q_1 \imp P$ and $Q_2 \imp P$ and so on all the way to $Q_n \imp P\text{,}$ then we can conclude $P\text{.}$ The key thing is that we want to be sure that one of our cases (the $Q_i$'s) must be true no matter what.

关于不同的证明风格,我们还可以没完没了地讲下去(这里甚至还没提到数学归纳法与组合证明),不过我们还是以最后一种实用技巧作结:分情况证明(proof by cases)。其思路是:对某个命题 $Q\text{,}$通过证明 $Q \imp P$ 与 $\neg Q \imp P$,来证 $P$ 为真。于是无论 $Q$ 真假与否,我们都确知 $P$ 为真。事实上,我们还可以将其推广。假设我们要证明 $P\text{。}$ 我们知道命题 $Q_1, Q_2, \ldots, Q_n$ 中至少有一个为真。如果我们能证明 $Q_1 \imp P$、$Q_2 \imp P$,依此类推直到 $Q_n \imp P\text{,}$那么就能推出 $P\text{。}$ 关键在于,我们必须确保各种情况(即那些 $Q_i$)中至少有一个必然为真。

If that last paragraph was confusing, perhaps an example will make things better.

如果上一段让你困惑,或许一个例子能让事情清晰些。

Example 3.2.10

示例 3.2.10

Prove: For any integer $n\text{,}$ the number $(n^3 -n)$ is even.

证明:对任意整数 $n\text{,}$数 $n^3 - n$ 为偶数。

Solution

解答

It is hard to know where to start this, because we don't know much of anything about $n\text{.}$ We might be able to prove that $n^3 - n$ is even if we knew that $n$ was even. In fact, we could probably prove that $n^3-n$ was even if $n$ was odd. But since $n$ must either be even or odd, this will be enough. Here's the proof.

我们很难找到入手之处,因为我们对 $n$ 几乎一无所知。如果知道 $n$ 为偶数,或许就能证明 $n^3 - n$ 为偶数。事实上,若 $n$ 为奇数,我们也大概能证明 $n^3 - n$ 为偶数。而 $n$ 非偶即奇,所以这样便已足够。下面是证明。

Proof

证明

We consider two cases: if $n$ is even or if $n$ is odd. Case 1: $n$ is even. Then $n = 2k$ for some integer $k\text{.}$ This gives \begin{align*} n^3 - n & = 8k^3 - 2k\\ & = 2(4k^2 - k), \end{align*} and since $4k^2 - k$ is an integer, this says that $n^3-n$ is even. Case 2: $n$ is odd. Then $n = 2k+1$ for some integer $k\text{.}$ This gives \begin{align*} n^3 - n & = (2k+1)^3 - (2k+1)\\ & = 8k^3 + 6k^2 + 6k + 1 - 2k - 1\\ & = 2(4k^3 + 3k^2 + 2k), \end{align*} and since $4k^3 + 3k^2 + 2k$ is an integer, we see that $n^3 - n$ is even again. Since $n^3 - n$ is even in both exhaustive cases, we see that $n^3 - n$ is indeed always even. ∎

我们分两种情况:若 $n$ 为偶数,或若 $n$ 为奇数。 情况 1:$n$ 为偶数。则存在整数 $k$ 使得 $n = 2k\text{。}$ 于是 \begin{align*} n^3 - n & = 8k^3 - 2k\\ & = 2(4k^2 - k), \end{align*} 且由于 $4k^2 - k$ 为整数,可知 $n^3 - n$ 为偶数。 情况 2:$n$ 为奇数。则存在整数 $k$ 使得 $n = 2k+1\text{。}$ 于是 \begin{align*} n^3 - n & = (2k+1)^3 - (2k+1)\\ & = 8k^3 + 6k^2 + 6k + 1 - 2k - 1\\ & = 2(4k^3 + 3k^2 + 2k), \end{align*} 且由于 $4k^3 + 3k^2 + 2k$ 为整数,可见 $n^3 - n$ 也为偶数。 既然在两种穷尽的情形下 $n^3 - n$ 都为偶数,可知 $n^3 - n$ 确实恒为偶数。∎

1 This is not to say that looking at examples is a waste of time. Doing so will often give you an idea of how to write a proof. But the examples do not belong in the proof.

¹ 这并非说研究例子是在浪费时间。研究例子常常能给你如何写证明的启发。但例子本身不应出现在证明之中。