Nguyên lý quy nạp
Xét vị từ P(n) trên N. Nếu
▶ P(0) đúng, và
▶ với mọi n 2 N; (P(n) ) P(n + 1))
cũng đúng,
thì P(n) đúng với mọi n 2 N.
Chứng minh.
▶ Bước cơ sở: P(0) đúng.
▶ Bước quy nạp: Ta sẽ chứng minh: với mọi n ≥ 0, mệnh đề
P(n) ) P(n + 1)
đúng.
Thật vậy, giả sử P(n) đúng, với n là một số nguyên bất kỳ.
37 trang |
Chia sẻ: thuyduongbt11 | Ngày: 11/06/2022 | Lượt xem: 296 | Lượt tải: 0
Bạn đang xem trước 20 trang tài liệu Bài giảng Toán rời rạc - Bài 3: Quy nạp - Trần Vĩnh Đức, để xem tài liệu hoàn chỉnh bạn click vào nút DOWNLOAD ở trên
Quy nạp
Trần Vĩnh Đức
HUST
Ngày 24 tháng 7 năm 2018
1 / 37
Tài liệu tham khảo
▶ Eric Lehman, F Thomson Leighton & Albert R Meyer,
Mathematics for Computer Science, 2013 (Miễn phí)
▶ Kenneth H. Rosen, Toán học rời rạc ứng dụng trong tin học
(Bản dịch Tiếng Việt)
2 / 37
Nội dung
Nguyên lý quy nạp
Quy nạp mạnh
Nguyên lý quy nạp
Xét vị từ P(n) trên N. Nếu
▶ P(0) đúng, và
▶ với mọi n ∈ N, (P(n)⇒ P(n+ 1))
cũng đúng,
thì P(n) đúng với mọi n ∈ N.
88
878685848382107978777675747372717069686766656463626160595875655545352515049484746454443424140393837363534333231302928272625242322212019181716151413121110987654321
4 / 37
Ví dụ
Định lý
Với mọi n ∈ N,
1 + 2 + · · ·+ n = n(n+ 1)
2
Đặt P(n) là mệnh đề
n∑
i=1
i = n(n+ 1)
2
5 / 37
Chứng minh.
▶ Bước cơ sở: P(0) đúng.
▶ Bước quy nạp: Ta sẽ chứng minh: với mọi n ≥ 0, mệnh đề
P(n)⇒ P(n+ 1)
đúng.
Thật vậy, giả sử P(n) đúng, với n là một số nguyên bất kỳ. Vì
1 + 2 + · · ·+ n+ (n+ 1) = (1 + 2 + · · ·+ n) + (n+ 1)
=
n(n+ 1)
2
+ (n+ 1)
=
(n+ 1)(n+ 2)
2
nên P(n+ 1) đúng.
Theo quy nạp ta có P(n) đúng với mọi số n ∈ N.
6 / 37
Ví dụ
Chứng minh rằng
1
2
+
1
4
+
1
8
+ · · ·+ 1
2n
< 1
với mọi n ≥ 1.
7 / 37
Ví dụ
Định lý
Với mọi n ∈ N, ta có n3 − n chia hết cho 3.
Đặt P(n) là mệnh đề
”n3 − n chia hết cho 3.”
8 / 37
Chứng minh.
▶ Bước cơ sở: P(0) đúng vì 03 − 0 = 0 chia hết cho 3.
▶ Bước quy nạp: Ta sẽ chứng minh rằng, với mọi n ∈ N, mệnh
đề
P(n)⇒ P(n+ 1)
đúng.
Thật vậy, giả sử P(n) đúng, với n là một số nguyên bất kỳ. Vì
(n+ 1)3 − (n+ 1) = n3 + 3n2 + 3n+ 1− n− 1
= n3 + 3n2 + 2n
= n3 − n+ 3n2 + 3n
= (n3 − n) + 3(n2 + n)
chia hết cho 3 nên P(n+ 1) đúng.
Theo quy nạp ta có P(n) đúng với mọi số n ∈ N.
9 / 37
Ví dụ chứng minh sai
Định lý (Sai)
Mọi con ngựa đều cùng màu.
Đặt P(n) là mệnh đề
”Trong mọi tập gồm n con ngựa, các con ngựa đều
cùng màu.”
10 / 37
Đặt P(n) là mệnh đề
”Trong mọi tập gồm n con ngựa, các con ngựa đều
cùng màu.”
Chứng minh Sai.
▶ Bước cơ sở: P(1) đúng vì chỉ có một con ngựa.
▶ Bước quy nạp: Giả sử P(n) đúng để chứng minh P(n+ 1)
đúng.
Xét tập gồm n+ 1 con ngựa {h1, h2, · · · , hn+1}
▶ Các con h1, h2, . . . , hn có cùng màu (giả thiết quy nạp).
▶ Các con h2, h3, . . . , hn+1 có cùng màu (giả thiết quy nạp).
Vậy
màu(h1) = màu(h2, . . . , hn) = màu(hn+1).
Vậy các con ngựa {h1, h2, · · · , hn+1} đều cùng màu. Có nghĩa
rằng P(n+ 1) đúng.
Theo quy nạp ta có P(n) đúng với mọi số n ∈ N.
11 / 37
Bài tập
1. Chứng minh rằng
n∑
i=1
i2 = n(n+ 1)(2n+ 1)
6
2. Chứng minh rằng 2n > n2 với n ≥ 5.
3. Chứng minh rằng với mọi n ≥ 1,
F(n− 1)F(n+ 1)− F(n2) = (−1)n
với F(i) là số Fibonacci thứ i.
12 / 37
Ví dụ lát gạch
Induction I 31
2.6 Courtyard Tiling
Induction served purely as a proof technique in the preceding examples. But induction
sometimes can serve as a more genera reasoning tool.
MIT recently constructed a new computer science building. As the project went further
and further over budget, there were some radical fundraising ideas. One plan was to
install a big courtyard with dimensions 2n × 2n:
2n
2n
One of the central squares would be occupied by a statue of a wealthy potential donor.
Let’s call him “Bill”. (In the special case n = 0, the whole courtyard consists of a single
central square; otherwise, there are four central squares.) A complication was that the
building’s unconventional architect, Frank Gehry, insisted that only special L-shaped tiles
be used:
A courtyard meeting these constraints exsists, at least for n = 2:
B
For larger values of n, is there a way to tile a 2n × 2n courtyard with L-shaped tiles and a
statue in the center? Let’s try to prove that this is so.
Theorem 15. For all n ≥ 0 there exists a tiling of a 2n × 2n courtyard with Bill in a central
square.
Hình: Sân
Induction I 31
2.6 Courtyard Tiling
Induction served purely as a proof technique in the preceding examples. But induction
sometimes can serve as a more general reasoning tool.
MIT recently constructed a new computer science building. As the project went further
and further over budget, there were some radical fundraising ideas. One plan was to
install a big courtyard with dimensions 2n × 2n:
2n
2n
One of the central squares would be occupied by a statue of a wealthy potential donor.
Let’s call him “Bill”. (In the special case n = 0, the whole courtyard consists of a single
central square; otherwise, there are four central squares.) A complication was that the
building’s un nventional archit t, Frank Gehry, insis ed that only special L-shaped tiles
be used:
A courtyard meeting these constraints exsists, at least for n = 2:
B
For larger values of n, is there a way to tile a 2n × 2n courtyard with L-shaped tiles and a
statue in the center? Let’s try to prove that this is so.
Theorem 15. For all n ≥ 0 there exists a tiling of a 2n × 2n courtyard with Bill in a central
square.
Hình: Gạch
Induction I 31
2.6 Courtyard Tiling
Induction served purely as a proof technique in the preceding examples. But induction
sometimes can serve as a more general reasoning tool.
MIT recently constructed a new computer science building. As the project went further
and further over budget, there were some radical fundraising ideas. One plan was to
install a big courtyard with dimensions 2n × 2n:
2n
2n
One of the central squares would be occupied by a statue of a wealthy potential donor.
Let’s call him “Bill”. (In the special case n = 0, the whole courtyard consists of a single
central square; otherwise, there are four central squares.) A complication was that the
building’s unconventional architect, Frank Gehry, insisted that only special L-shaped tiles
be used:
A courtyard meeting these constraints exsists, at least for n = 2:
B
For larger values of n, is there a way to tile a 2n × 2n courtyard with L-shaped tiles and a
statue in the center? Let’s try to prove that this is so.
Theorem 15. For all n ≥ 0 there exist a tiling of a 2n × 2n courtyard with Bill in a central
square.
Hình: Lát gạch và đặt
tượng Bill
13 / 37
Định lý
Với mọi n, luôn có cách lát gạch một sân 2n × 2n chỉ để lại một ô
trống ở giữa (để đặt tượng Bill).
14 / 37
Chứng minh thử.
Xét P(n) là mệnh đề
”Có cách lát gạch sân 2n × 2n để lại một ô ở giữa.”
▶ Bước cơ sở: P(0) đúng vì chỉ có một ô dành cho Bill.
▶ Bước quy nạp: !
15 / 37
Chứng minh.
Xét P(n) là mệnh đề
”Với mỗi vị trí đặt tượng Bill trong sân 2n×2n, ta đều
có cách lát gạch kín sân.”
▶ Bước cơ sở: P(0) đúng vì chỉ có
một ô dành cho Bill.
▶ Bước quy nạp: Giả sử P(n) đúng,
ta chứng minh P(n+ 1) đúng.
32 Induction I
Proof. (doomed attempt) The proof is by induction. Let P (n) be the proposition that there
exists a tiling of a 2n × 2n courtyard with Bill in the center.
Base case: P (0) is true because Bill fills the whole courtyard.
Inductive step: Assume that there is a tiling of a 2n × 2n courtyard with Bill in the center
for some n ≥ 0. We must prove that there is a way to tile a 2n+1× 2n+1 courtyard with Bill
in the center...
Nowwe’re in trouble! The ability to tile a smaller courtyard with Bill in the center does
not help tile a larger courtyard with Bill in the center. We can not bridge the gap between
P (n) and P (n+ 1). The usual recipe for finding an inductive proof will not work!
When this happens, your first fallback should be to look for a stronger induction hy-
pothesis; that is, one which implies your previous hypothesis. For example, we could
make P (n) the proposition that for every location of Bill in a 2n×2n courtyard, there exists
a tiling of the remainder.
This advice may sound bizzare: “If you can’t prove something, try to prove something
more grand!” But for induction arguments, this makes sense. In the inductive step, where
you have to prove P (n)⇒ P (n+ 1), you’re in better shape because you can assume P (n),
which is now a more general, more useful statement. Let’s see how this plays out in the
case of courtyard tiling.
Proof. (successful attempt) The proof is by induction. Let P (n) be the proposition that for
every location of Bill in a 2n × 2n courtyard, there exists a tiling of the remainder.
Base case: P (0) is true because Bill fills the whole courtyard.
Inductive step: Asume that P (n) is true for some n ≥ 0; that is, for every location of Bill in
a 2n×2n courtyard, there exists a tiling of the remainder. Divide the 2n+1×2n+1 courtyard
into four quadrants, each 2n × 2n. One quadrant contains Bill (B in the diagram below).
Place a temporary Bill (X in the diagram) in each of the three central squares lying outside
this quadrant:
X
X X
B
2n 2n
2n
2n
Theo quy nạp ta có P(n) đúng với mọi số n ∈ N.
16 / 37
15-Puzzle“mcs-ftl” — 2010/9/8 — 0:40 — page 59 — #65
3.3. Invariants 59
24 26 25
: 21 22 23
687 9
243 5
(a)
24 26 25
: 21 22
23
687 9
243 5
(b)
Figure 3.5 The 15-puzzle in its starting configuration (a) and after the 12-block
is moved into the hole below (b).
24 25 26
: 21 22 23
687 9
243 5
Figure 3.6 The desired final configuration for the 15-puzzle. Can it be achieved
by only moving one block at a time into an adjacent hole?
get all 15 blocks into their natural order. A picture of the 15-puzzle is shown in
Figure 3.5 along with the configuration after the 12-block is moved into the hole
below. The desired final configuration is shown in Figure 3.6.
The 15-puzzle became very popular in North America and Europe and is still
sold in game and puzzle shops today. Prizes were offered for its solution, but
it is doubtful that they were ever awarded, since it is impossible to get from the
configuration in Figure 3.5(a) to the configuration in Figure 3.6 by only moving
one block at a time into an adjacent hole. The proof of this fact is a little tricky so
we have left it for you to figure out on your own! Instead, we will prove that the
analogous task for the much easier 8-puzzle cannot be performed. Both proofs, of
course, make use of the Invariant Method.
⇒
“mcs-ftl” — 2010/9/8 0:40 page 59 #65
3. . Invariants 59
24 26 25
: 21 22 23
687 9
243 5
(a)
24 26 25 23
(b)
Figure 3.5 The 15-puzzle in its starting configuration (a) and after the 12-block
is moved into the hole below (b).
24 25 26
: 21 22 23
687 9
243 5
Figure 3.6 The desired final configuration for the 15-puzzle. Can it be achieved
by only moving one block at a time into an adjacent hole?
get all 15 blocks into their natural order. A picture of the 15-puzzle is shown in
Figure 3.5 along with the configuration after the 12-block is moved into the hole
below. The desired final configuration is shown in Figure 3.6.
The 15-puzzle became very popular in North America and Europe and is still
sold in game and puzzle shops today. Prizes were offered for its solution, but
it is doubtful that they were ever awarded, since it is impossible to get from the
configuration in Figure 3.5(a) to the configuration in Figure 3.6 by only moving
one block at a time into an adjacent hole. The proof of this fact is a little tricky so
we have left it for you to figure out on your own! Instead, we will prove that the
analogous task for the much easier 8-puzzle cannot be performed. Both proofs, of
course, make use of the Invariant Method.
Chuyển hợp lệ: di chuyể một số sang ô trố g cạ h nó.
17 / 37
15-Puzzle
Có thể chuyển từ
“mcs-ftl” — 2010/9/8 — 0:40 — page 59 — #65
3.3. Invariants 59
24 26 25
: 21 22 23
687 9
243 5
(a)
24 26 25
: 21 22
23
687 9
243 5
(b)
Figure 3.5 The 15-puzzle in its starting configuration (a) and after the 12-block
is moved into the hole below (b).
24 25 26
: 21 22 23
687 9
243 5
Figure 3.6 The desired final configuration for the 15-puzzle. Can it be achieved
by only moving one block at a time into an adjacent hole?
get all 15 blocks into their natural order. A picture of the 15-puzzle is shown in
Figure 3.5 along with the configuration after the 12-block is moved into the hole
below. The desired final configuration is shown in Figure 3.6.
The 15-puzzle became very popular in North America and Europe and is still
sold in game and puzzle shops today. Prizes were offered for its solution, but
it is doubtful that they were ever awarded, since it is impossible to get from the
configuration in Figure 3.5(a) to the configuration in Figure 3.6 by only moving
one block at a time into an adjacent hole. The proof of this fact is a little tricky so
we have left it for you to figure out on your own! Instead, we will prove that the
analogous task for the much easier 8-puzzle cannot be performed. Both proofs, of
course, make use of the Invariant Method.
sang
“mcs-ftl” — 2010/9/8 — 0:40 — page 59 — #65
3.3. Invariants 59
24 26 25
: 21 22 23
687 9
243 5
(a)
24 26 25
: 21 22
23
687 9
243 5
(b)
Figure 3.5 The 15-puzzle in its starting configuration (a) and after the 12-block
is moved into the hole below (b).
24 25 26
: 1 22 23
687 9
243 5
Figure 3.6 The desired final configuration for the 15-puzzle. Can it be achieved
by only moving one block at a time into an adjacent hole?
get all 15 blocks into their natural order. A picture of the 15-puzzle is shown in
Figure 3.5 along with the configuration after the 12-block is moved into the hole
below. The desired final configuration is shown in Figure 3.6.
The 15-puzzle became very popular in North America and Europe and is still
sold in game and puzzle shops today. Prizes were offered for its solution, but
it is doubtful that they were ever awarded, since it is impossible to get from the
configuration in Figure 3.5(a) to the configuration in Figure 3.6 by only moving
one block at a time into an adjacent hole. The proof of this fact is a little tricky so
we have left it for you to figure out on your own! Instead, we will prove that the
analogous task for the much easier 8-puzzle cannot be performed. Both proofs, of
course, make use o the Invariant Method.
không?
18 / 37
8-Puzzle“mcs-ftl” — 2010/9/8 — 0:40 — page 60 — #66
60 Chapter 3 Induction
GH
DFE
ACB
(a)
GH
DFE
ACB
(b)
GEH
FD
ACB
(c)
Figure 3.7 The 8-Puzzle in its initial configuration (a) and after one (b) and
two (c) possible moves.
3.3.4 The 8-Puzzle
In the 8-Puzzle, there are 8 lettered tiles (A–H) and a blank square arranged in a
3 ! 3 grid. Any lettered tile adjacent to the blank square can be slid into the blank.
For example, a sequence of two moves is illustrated in Figure3.7.
In the initial configuration shown in Figure 3.7(a), the G and H tiles are out of
order. We can find a way of swapping G and H so that they are in the right order,
but then other letters may be out of order. Can you find a sequence of moves that
puts these two letters in correct order, but returns every other tile to its original
position? Some experimentation suggests that the answer is probably “no,” and we
will prove that is so by finding an invariant, namely, a property of the puzzle that is
always maintained, no matter how you move the tiles around. If we can then show
that putting all the tiles in the correct order would violate the invariant, then we can
conclude that the puzzle cannot be solved.
Theorem 3.3.3. No sequence of legal moves transforms the configuration in Fig-
ure 3.7(a) into the configuration in Figure 3.8.
We’ll build up a sequence of observations, stated as lemmas. Once we achieve
a critical mass, we’ll assemble these observations into a complete proof of Theo-
rem 3.3.3.
Define a row move as a move in which a tile slides horizontally and a column
move as one in which the tile slides vertically. Assume that tiles are read top-
to-bottom and left-to-right like English text, that is, the natural order, defined as
follows: So when we say that two tiles are “out of order”, we mean that the larger
letter precedes the smaller letter in this natural order.
Our difficulty is that one pair of tiles (the G and H) is out of order initially. An
immediate observation is that row moves alone are of little value in addressing this
19 / 37
8-Puzzle
Bài tập
Liệu có thể tìm được một dãy chuyển hợp lệ để chuyển từ
“mcs-ftl” — 2010/9/8 — 0:40 — page 60 — #66
60 Chapter 3 Induction
GH
DFE
ACB
(a)
GH
DFE
ACB
(b)
GEH
FD
ACB
(c)
Figure 3.7 The 8-Puzzle in its initial configuration (a) and after one (b) and
two (c) possible moves.
3.3.4 The 8-Puzzle
In the 8-Puzzle, there are 8 lettered tiles (A–H) and a blank square arranged in a
3 !3 grid. Any lettered tile adjacent to the blank square can be slid into the blank.
For example, a sequence of two moves is illustrated in Figure 3.7.
In the initial configuration shown in Figure 3.7(a), the G and H tiles are out of
order. We can find a way of swapping G and H so that they are in the right order,
but then other letters may be out of order. Can you find a sequence of moves that
puts these two letters in correct order, but returns every other tile to its original
position? Some experimentation suggests that the answer is probably “no,” and we
will prove that is so by finding an invariant, namely, a property of the puzzle that is
always maintained, no matter how you move the tiles around. If we can then show
that putting all the tiles in the correct order would violate the invariant, then we can
conclude that the puzzle cannot be solved.
Theorem 3.3.3. No sequence of legal moves transforms the configuration in Fig-
ure 3.7(a) into the configuration in Figure 3.8.
We’ll build up a sequence of observations, stated as lemmas. Once we achieve
a critical mass, we’ll assemble these observations into a complete proof of Theo-
rem 3.3.3.
Define a row move as a move in which a tile slides horizontally and a column
move as one in which the tile slides vertically. Assume that tiles are read top-
to-bottom and left-to-right like English text, that is, the natural order, defined as
follows: So when we say that two tiles are “out of order”, we mean that the larger
letter precedes the smaller letter in this natural order.
Our difficulty is that one pair of tiles (the G and H) is out of order initially. An
immediate observation is that row moves alone are of little value in addressing this
sang
“mcs-ftl” — 2010/9/8 — 0:40 — page 61 — #67
3.3. Invariants 61
HG
DFE
ACB
Figure 3.8 The desired final configuration of the 8-puzzle.
98 :
576
243
problem:
Lemma 3.3.4. A row move does not change the order of the tiles.
Proof. A row move moves a tile from cell i to cell i C 1 or vice versa. This tile
does not change its order with respect to any ther tile. Since no ot er tile moves,
there is no change in the order of any of the other pairs of tiles. !
Let’s turn to column moves. This is the more interesting case, since here the
order can change. For example, the column ove in Figure 3.9 changes the relative
order of the pairs .G;H/ and .G;E/.
Lemma 3.3.5. A column move changes the relative order of exactly two pairs of
tiles.
Proof. Sliding a tile down moves it after the next two tiles in the order. Sliding a
tile up moves it before the previous two tiles in the order. Either way, the relative
order changes between the moved tile and each of the two tiles it crosses. The
relative order between any other pair of tiles does not change. !
These observations suggest that there are limitations on how tiles can be swapped.
Some such limitation may lead to the invariant we need. In order to reason about
swaps more precisely, let’s define a term referring to a pair of items that are out of
order:
20 / 37
Định lý
Không tồn tại dãy chuyển cho bài toán trên.
21 / 37
Chuyển hàng
Thứ tự tự nhiên của các chữ trên ô:
“mcs-ftl” — 2010/9/8 — 0:40 — page 61 — #67
3.3. Invariants 61
HG
DFE
ACB
Figure 3.8 The desired final configuration of the 8-puzzle.
98 :
576
243
problem:
Lemma 3.3.4. A row move does not change the order of the tiles.
Proof. A row move moves a tile from cell i to cell