{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

exam2solutions

# exam2solutions - Math 374 Exam 2 Name a Read problems...

This preview shows pages 1–7. Sign up to view the full content.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Math 374. Exam 2. 3/20/09. Name: a Read problems carefully. Show all work. 0 No notes, calculator, or text. 0 The exam is approximately 15 percent of the total grade. 0 There are 100 points total. Partial credit may be given. l. (25 points) (a) (8 points) Let :1: and y be integers. Give the contrapositive of the following statement: ”If x - y is odd, then a: and y must both be odd”. IfmeLsLW)Wx-yém. (b) (10 points) A rational number is a number expressible as a ratio of integers. Let a be a rational number (so Elm, n E Z (n # 0) with a = 172/12), and let b be an irrational number. Give a proof by contradiction that a + I) must be irrational. r52, 1‘ EMY M (by contradiction): (a a t. MM, mat/WWW (c) (7 points) Consider the statement "For every positive integer n, n2 + n + 1 is prime. Show that the statement is false by supplying a counterexample. V1 14%“ ( grime/Z J. 3 WS 2 :7' Y“ § 1.3 )""g i 4 “.44- 199(9— omit/lermwfé- W“ Hg} (Wm!!!) . (20 points) Use induction to show. for all integers n 2 1, that i 1 _ ;+ ; + + 1 _ n i=12(2i+1)_12 23 It(n+1)_n+1 §gg 1 Proof (by induction): CSWNUQ ) : - 1 J- : 8 Base case n .. I, . E1) : T 1745?. Induction step: “-1- k su,fm,£91%kzt)+w 2,1. :L, #441 T; shew ‘. 2.};- - 1‘“ i=1. «Um ' k+2 k )ut Cow’d’xr: Z L 3:4” 4‘ 1 1-,L «(w-u.) 1:1 1(211.) (10an 5 ___1g__ + __J.______ z ._1_. 14+ 1 KM (Krl\(k+&] Ion k4»; .-.- kUG'MH _ kart/lbw! _ M : &. QC“) ( lat/M - UGVH (M3 (M! Kim) kn. HJ/"oz‘ ﬂegw I? How VYLZL 3. (20 points) Consider the following pseudocode program segment for a function to return the value of a: - y" for n 2 0. Computationtv E Z. y E Z. n 2 0) #IO, get. 3 (mud v") integers i, j (local variables) 2' = 0 j = .1‘ while i 75 n do 3' =j - y i = i + 1 end while // j now has the value :3 - y" return j end function Computation The loop invariant is Q : j = a: - yi. Use induction to prove that Q(n) : j" = :L' - y‘" is true Vn 2 0. Proof (by induction): Basecase: Vlzo , 1‘0 = O } Induction step: QWM W GHQ: 0-K: >0)!1k is i-ru7Q1 99m; #20. TB [email protected](MG’6M3XI 71k“ 0; +m _ W29”: 45km 0W: XY d: *7 =X'Yk" :7 inoi 9/‘(f W. Hymn.) vnw) (9m 3 atm- 4. (20 points) A sequence {T(n)} is recursively deﬁned by T(0) = 1 T(1) = 1 (*) T(n) = T(n — 1) + 3T(n — 2) — n Vn 2 a. gmihm it: i—W) §fo (3) (5 points) What is T(4)? 1:"- T’(2)= Th) +3110) —2 = 1+ 3i -1 :— 53 ﬂeﬁjiw {9);}, 79 T63) =T(2)+3T(L]-3 : QfK-L~3 : Q TC‘HsTBi’r Zﬁzi—‘f: ’0Z+3.Q_4. :4. (b) (15 points) Show, V71 2 3, that g; A! l I“. T(n) = 4T(n — 2) + 3T(n — 3) — 2n + 1. 6" <1“) ﬂ» “~13 ) directly from the deﬁnition of T (n). S 2 1' Proof: . I (H? P“ W Thu: Thu-t) +3T(M—2)—h 036M lglgl ) S“£’7hw ; = (Fl—("JV’ 311“?” “(ndﬂ t 31114—1) -VI 9% 4/»- W =T(n—1.) m m-ﬁ gmfliﬁ/ ——7 :: 4T(Yl’l)+5T-(Yl~3)e-Rnt’f, , E @(\$)/ﬁ) ”5517749 5. (15 points) Solve the recurrence relation S(n) = 7S(n — 1) — 10\$(n. — 2) Vn z 3 gimlm #0 subject to the initial conditions if 2, ”7/3 5(1) = 2 t S(2)=1. i 5”)” SM. OM2%- a; 00m = r1—7retO:(/»5’)(nx\:o ’—— (he T573517 W gab/43m £4, : 3W WMHt—(QM mi “(2a ﬂ'ee’K‘L’é‘W- TMwJeey 9(1‘=Q= F*% 362w :L= 2f+f% 12%,; 402%“ z 1. = Mr?) ...
View Full Document

{[ snackBarMessage ]}

### Page1 / 7

exam2solutions - Math 374 Exam 2 Name a Read problems...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online