bài tập cấu trúc rời rạc homework6 solutions

5 129 0
bài tập cấu trúc rời rạc homework6 solutions

Đang tải... (xem toàn văn)

Thông tin tài liệu

Phần giải bài tập về nhà homework6 bài tập cấu trúc rời rạc dành cho sinh viên học ngành công nghệ thông tin. Lời giải được thiết kế rõ ràng dễ hiểu giúp sinh viên củng cố được kiến thức và làm bài tập latex một cách dễ dàng.

COM S 330 — Homework 06 — Solutions Type your answers to the following questions and submit a PDF file to Blackboard One page per problem Problem [10pts] Consider the following sequence definitions Write out the first 10 terms (n ∈ {0, , 9}) of each sequence a [3pts] a0 = and an = 2an−1 − for n ≥ n an 17 35 69 137 273 545 b [3pts] b0 = and bn = bn−1 + 2n for n ≥ n 15 16 31 32 63 64 127 128 255 256 511 512 bn c [4pts] c0 = 1, c1 = 2, and cn = 2(cn−1 − cn−2 ) for n ≥ n cn 2 −4 −8 −8 16 32 COM S 330 — Homework 06 — Solutions Problem [5pts] Let {dn }∞ n=0 be a sequence with the recurrence relation dn = 2dn−1 −dn−2 for n ≥ (We not specify the terms d0 , d1 ) Use backward reasoning to motivate the closed form dn = nd1 − (n − 1)d0 We will apply the recurrence relation several times to deduce a pattern dn = 2dn−1 − dn−2 = 2(2dn−2 − dn−3 ) − dn−2 = (4 − 1)dn−2 − 2dn−3 = 3dn−2 − 2dn−3 = 3(2dn−3 − dn−4 ) − 2dn−3 = (6 − 2)dn−3 − 3dn−4 = 4dn−3 − 3dn−4 = 4(2dn−4 − dn−5 ) − 3dn−4 = 5dn−4 − 4dn−5 = kdn−(k−1) − (k − 1)dn−k For k ≥ = ndn−(n−1) − (n − 1)dn−n = nd1 − (n − 1)d0 COM S 330 — Homework 06 — Solutions Problem [10pts] Mathematical induction can be used to prove things that can be proven directly In the two problems below, you will essentially prove the induction step of an induction proof a [5pts] For n ≥ 0, let P (n) denote the sentence “The × n chessboard can be tiled using dominoes.” Prove “P (n) → P (n + 1).” Proof Let C be the × (n + 1) chessboard Place a domino vertically on the far-right edge, leaving a × n chessboard of open squares Since the × n chessboard can be tiled using dominoes, that tiling can complete the tiling of C Therefore, the × (n + 1) chessboard can be tiled using dominoes b [5pts] For n ≥ 0, let Q(n) denote the sentence “The × 2n chessboard can be tiled using dominoes.” Prove “Q(n) → Q(n + 1).” Proof Let C be the × 2(n + 1) chessboard Place two dominoes vertically in the top-right corner, one tile covering the positions (1, 2n + 2), (2, 2n + 2) and the other covering positions (1, 2n + 1), (2, 2n + 1) Then place a domino horizontally in the bottom-right corner, covering the positions (3, 2n + 2), (3, 2n + 1) The remaining squares form a × 2n chessboard Since the × 2n chessboard can be tiled using dominoes, this tiling completes the tiling of C Therefore, the × 2(n + 1) chessboard can be tiled using dominoes COM S 330 — Homework 06 — Solutions Problem [10pts] Define a sequence {fn }∞ n=0 as f0 = and for n ≥ 1, fn = fn = Fn+1 Fn+2 , where {Fn }∞ n=0 1+fn−1 Prove that for n ≥ 0, is the Fibonacci sequence Proof We use induction Case n = 0: f0 = = 1 = F1 F2 (Induction Hypothesis) Assume that fn = Fn+1 Fn+2 for some n ≥ Case n + 1: Consider fn+1 fn+1 = = = = = 1 + fn 1+ Fn+1 Fn+2 By recurrence relation of fn+1 By Induction Hypothesis Fn+1 +Fn+2 Fn+2 Fn+3 Fn+2 By recurrence relation Fn+3 = Fn+2 + Fn+1 , since n + ≥ Fn+2 Fn+3 Therefore, by induction we have that fn = Fn+1 Fn+2 for all n ≥ COM S 330 — Homework 06 — Solutions Problem [10pts] Let {An }1 n=1 be an arbitrary sequence of non-empty sets Recall the n-fold Cartesian n product i=1 Ai is the set of n-tuples (a1 , , an ) where each is an element in Ai The iterated product is the set sequence {Bn }1 n=1 where B1 = A1 , and for n ≥ 2, Bn = Bn × An (Thus, B1 = A1 , B2 = A1 × A2 , B3 = (A1 × A2 ) × A3 , etc.) Use induction to prove that for all n ≥ 2, there is a bijection fn from n-fold n Cartesian product i=1 Ai to the iterated product Bn = Bn × An [Note: the n-fold Cartesian product n i=1 Ai consists of n-tuples (a1 , , an ), while the iterated product Bn consists of ordered pairs (b, an ) where b ∈ Bn and an ∈ An ] Proof We use induction on n ≥ Case n = 1: Note that A1 = B1 , so the identity map f1 : A1 → B1 defined as f1 (x) = x is a bijection between A1 and B1 (Induction Hypothesis) Assume that for some n ≥ we have a bijection fn : n i=1 Ai → B n n Case n + 1: Note that by the Induction Hypothesis there exists a bijection fn : i=1 Ai → Bn We den+1 fine a function fn+1 : i=1 Ai → Bn+1 as follows: For an arbitrary (n + 1)-tuple (x1 , , xn , xn+1 ) in n+1 i=1 Ai , let fn+1 (x1 , , xn , xn+1 ) = (fn (x1 , , xn ), xn+1 ) We claim that fn+1 is a bijection First, since n fn (x1 , , xn ) ∈ Bn for all (x1 , , xn ) ∈ i=1 Ai (by Induction Hypothesis), we have that (fn (x1 , , xn ), xn+1 ) n+1 is an element of Bn × An+1 for every (x1 , , xn+1 ) ∈ i=1 Ai Therefore, fn+1 is a well-defined function with codomain Bn+1 = Bn × An+1 n+1 We claim fn+1 is an injection: Let (x1 , , xn , xn+1 ) and (y1 , , yn , yn+1 ) be elements of i=1 Ai where fn+1 (x1 , , xn+1 ) = fn+1 (y1 , , yn+1 ) Since the first coordinate in these function outputs are equal, we have that fn (x1 , , xn ) = fn (y1 , , yn ) Since fn is an injection, we have that (x1 , , xn ) = (y1 , , yn ) Since the second coordinate in the function outputs are equal, xn+1 = yn+1 Therefore, fn+1 is an injection We claim fn+1 is a surjection: Let (y, z) ∈ Bn × An+1 = Bn+1 be any element of the codomain Since fn n is surjective, there exists an n-tuple (x1 , , xn ) ∈ i=1 Ai where fn (x1 , , xn ) = y Since z ∈ An+1 , note that fn+1 (x1 , , xn , z) = (y, z) and therefore (y, z) is in the range of fn+1 and hence fn+1 is surjective By induction, there exists a bijection fn : n i=1 Ai → Bn for every n ≥ ...COM S 330 — Homework 06 — Solutions Problem [5pts] Let {dn }∞ n=0 be a sequence with the recurrence relation dn = 2dn−1 −dn−2... kdn−(k−1) − (k − 1)dn−k For k ≥ = ndn−(n−1) − (n − 1)dn−n = nd1 − (n − 1)d0 COM S 330 — Homework 06 — Solutions Problem [10pts] Mathematical induction can be used to prove things that can be proven... of C Therefore, the × 2(n + 1) chessboard can be tiled using dominoes COM S 330 — Homework 06 — Solutions Problem [10pts] Define a sequence {fn }∞ n=0 as f0 = and for n ≥ 1, fn = fn = Fn+1 Fn+2

Ngày đăng: 20/09/2019, 16:58

Từ khóa liên quan

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan