CIS 66 – Midterm 2 Last Name (print) ______(Fall 2000) ssn (last 4 digits) First Name (print) ______

______Signature ______

True or False (10 points) 1. A proof technique that proves p by showing that p ® F is called a proof by contradiction. T or F 2. The proof technique of the second principle of mathematical induction can be stated as: [P(1) Ù ((P(1) Ù P(2) Ù ... Ù P(n + 1)) ® P(n))] ® " n P(n) T or F 3. The set * of binary numbers (e.g. 100110) over the alphabet  = {0, 1} can be defined by   * ( the empty string) and wx  * whenever x   and w  . T or F 4. The set S of nonnegative odd integers can be defined recursively as 1 Î S, x + y Î S if x Î S and y Î S. T or F 5. According to Pascal's identity, if n and k are positive integers with n ³ k, then C(n+1,k) = C(n,k-1) + C(n,k) T or F 6. If E and F are events in the sample space S, then p(E  F) = p(E) + p(F) - p(E  F) T or F 7. The conditional probability of event E given event F, p(E|F), equals P(E  F) / p(E). T or F 8. The events E and F are independent if and only if P(E  F) = p(E)p(F). T or F 9. In lexicographic order, the permutation following (2, 4, 5, 3, 1) is (2, 5, 1, 3, 4). T or F 10.The variance of a random variable X(s) on the sample space S is 2 V(X) = SsÎS (X(s) - E(X)) p(s). T or F Numerical Answer (fractions are OK, 20 points) 1. P(5,3)_____ 2. C(6,2) _____ 3. C(6,5) _____ 4. f(2) and f(3) where f(0)=1, f(1)=10, and f(n) = f(n-1) + f(n-2) for n  2 f(2) _____ f(3) _____ 5. procedure silly (n: nonnegative integer) silly(2) _____ if n < 3 then silly(n) := n silly(4) _____ else silly(n) := n*silly(n-2) silly(6) _____ 6. What is the probability of flipping a "fair" coin 4 times and getting four heads? _____ 7. If a pair of cards is drawn from a deck of 52 cards, what is the probability that they have the same value (e.g. two tens). _____ 8. If a single card is drawn from a deck of 52 cards, what is the probability that it is either a 2 or a heart (or both)? _____ 9. What is the probability that, when two dice are rolled, the sum of the number on the two dice is 3? _____ 10.In lexicographic order, what are the four (__,__,__,__,__) permutations that follow (4, 3, 2, 1, 5) (__,__,__,__,__)

(__,__,__,__,__)

(__,__,__,__,__) 11.A fair (six sided) die is rolled and the random variable X(s) is the value that appears on the top of the die. What is E(X). _____

What is E(X - E(X))2 _____ Short Answer (formulas like C(10,2) are OK, 20 points) 1. What is the probability of getting "4 of a kind" if you are dealt 5 cards from a deck of 52 cards? ______2. How many different strings can be made from rearranging the letters in the word "rearrange". ______3. Provide a recursive definition for the set of even integers S = {2, 4, 6, 8, ... } ______4. How many solutions are there to the equation x + y + z = 20, when x, y, and z are constrained to be nonnegative integers. ______5. What is the probability of winning the "pick 6" lottery, where 6 balls are drawn from a single urn containing balls numbered 1 through 40, and the order of drawing the balls does not count. ______6. Students in a class of 21 students are each assigned a grade from the set {A, B, C, D, or F}. What does the generalized pigeonhole principle tell us? ______7. How many ways that you we select a 3-student committee from a class of 10 students? ______8. How many ways can you elect a president, a vice-president, and a treasurer (3 positions) from a class of 10 students. ______9. Generate five different well-formed formulae if the binary digits 0 and 1 are well-formed and (x  x) is well-formed if x is well-formed. ______10.Ten identical coins, when tossed, come up heads 3/4 of the time. What is the probability of getting 7 heads and 3 tail (in any order).

______Recursive Proof (10 points) Using mathematical induction, show (prove) that:

1 + 4 + 7 + ... + (3n – 2) = n*(3n – 1) for n  1 2

Recursive Algorithm (10 points) Write a recursive algorithm for computing the greatest common divisor, gcd(a, b), where a and b are nonnegative integers with a < b.

procedure gcd(a, b: nonnegative integers with a < b)

______

______

______

______

______10-Bit Strings (10 points)

Consider a string of 10 binary digits. Provide formulas (e.g. 26 + 25) for each of the following:

1. How many different 10-bit strings are there?

2. How many different 10-bit strings begin with two "one" bits and end with a zero bit?

3. How many different 10-bit strings either begin with two "one" bits, end with a zero bit, (or both).

4. How many different 10-bit strings contain exactly three 0's?

5. How many different 10-bit strings contain at least two 0's? How Many (10 points)

1. An urn contains 10 red balls and 6 blue balls. How many balls must be drawn to be sure of getting three balls of the same color. _____

2. How many balls must be drawn to be sure of getting three blue balls. _____

3. How many positive integers less than or equal to 100 are divisible by 3. _____

4. How many positive integers less than or equal to 100 are divisible by 3 or 11 (or both). _____

5. How many different ways can an instructor select 3 exercises from the 14 exercises in section 4.7 of your text. _____

Probability (10 points) 1. Four identical coins, when tossed, come up heads 3/4 of the time. What is the probability of getting 3 heads and 1 tail (in any order). _____ 2. If a single card is drawn from a deck of 52 cards, what is the probability that it is either a heart, a diamond, or an ace? _____ 3. A pair of dice is rolled and we are told that the sum of the dice is greater than 3. What is the probability that the sum is equal to 5 given this added information? _____ Let E and F be events with p(E) = .5 and p(F) = .8 4. If p(E  F) = .9, what is p(E  F) _____ 5. p(E  F) = .2, what is p(E | F) _____