Math 213 Exam 2 Solutions: Expectation, Recurrence, Onto Functions, Conditional Prob., Exams of Discrete Mathematics

The solutions to exam 2 in math 213, covering problems on expectation, recurrence relations, onto functions, and conditional probability. Students can use these solutions to check their understanding of the concepts and to study for exams.

Typology: Exams

Pre 2010

Uploaded on 03/11/2009

koofers-user-stn-1
koofers-user-stn-1 🇺🇸

5

(1)

10 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Math 213 Exam 2 (Solutions)
Prof. I.Kapovich April 10, 2007
Problem 1
A binary string xof length 20 is chosen at random. Let Xbe the random
variable where X(x) is the number of 0s in xplus twice the number of 1s in
x. Find E(X) and V(X).
Solution.
For i= 1,2,. . . , 20 let
Xi=(1,if the i-th bit is 0
2,if the i-bit is 1
Then X=X1+· · · +X20 . Clearly, the random variables X1, . . . , X20 are
independent.
Therefore EX =P20
i=1 EXi= 20E X1and V X =P20
i=1 V Xi= 20V X1.
We have
EX1= 1 ·1
2+ 2 ·1
2=3
2
and
E(X2
1) = 12·1
2+ 22·1
2=5
2
Therefore
EX =
20
X
i=1
EXi= 20E X1= 20 ·3
2= 30,
and
V(X) = 20V X1= 20 E(X2
1)(EX1)2= 20 5
29
4= 20 ·1
4= 5.
Problem 2
Find the general solution of the recurrence relation
()an= 4an14an2+n.
Solution.
The associated homogeneous relation is an= 4an14an2. It has
characteristic equation r2= 4r4, that is
r24r+ 4 = (r2)2.
Hence the homogenehous relation an= 4an14an2has the general solu-
tion a(h)
n= (c1+c2n)2n, where c1, c2R.
We can look for a particular solution of the relation () of the form an=
α+βn. Substitution this expression in () we get
1
pf3

Partial preview of the text

Download Math 213 Exam 2 Solutions: Expectation, Recurrence, Onto Functions, Conditional Prob. and more Exams Discrete Mathematics in PDF only on Docsity!

Math 213 Exam 2 (Solutions)

Prof. I.Kapovich April 10, 2007

Problem 1 A binary string x of length 20 is chosen at random. Let X be the random variable where X(x) is the number of 0s in x plus twice the number of 1s in x. Find E(X) and V (X). Solution. For i = 1, 2 ,... , 20 let

Xi =

1 , if the i-th bit is 0 2 , if the i-bit is 1

Then X = X 1 + · · · + X 20. Clearly, the random variables X 1 ,... , X 20 are independent. Therefore EX =

i=1 EXi^ = 20EX^1 and^ V X^ =^

i=1 V Xi^ = 20V X^1. We have

EX 1 = 1 ·

and

E(X 12 ) = 1^2 ·

+ 2^2 ·

Therefore

EX =

∑^20

i=

EXi = 20EX 1 = 20 ·

and

V (X) = 20V X 1 = 20

E(X^21 ) − (EX 1 )^2

Problem 2 Find the general solution of the recurrence relation

(†) an = 4an− 1 − 4 an− 2 + n.

Solution. The associated homogeneous relation is an = 4an− 1 − 4 an− 2. It has characteristic equation r^2 = 4r − 4, that is

r^2 − 4 r + 4 = (r − 2)^2.

Hence the homogenehous relation an = 4an− 1 − 4 an− 2 has the general solu-

tion a( nh )= (c 1 + c 2 n)2n, where c 1 , c 2 ∈ R. We can look for a particular solution of the relation (†) of the form an = α + βn. Substitution this expression in (†) we get 1

2

α + βn = 4(α + β(n − 1)) − 4(α + β(n − 2)) + n (β − 1)n + α − 4 β = 0, and hence β − 1 = 0, α − 4 β = 0 β = 1, α = 4.

Thus an = 4 + n is a particular solution of (†). Therefore (†) has general solution an = (c 1 + c 2 n)2n^ + 4 + n,

where c 1 , c 2 ∈ R are arbitrary constants.

Problem 3 Find the number of onto functions from a 5-element set to a 3-element set. Solution. The number of onto functions from a 5-element set to a 3-element set is:

35 − C(3, 1)(3 − 1)^5 + C(3, 2)(3 − 2)^5 = 243 − 3 · 32 + 3 · 1 = 150.

Problem 4 Let A be the set of all nonempty strings of uppercase and lowercase Eng- lish letters. Let R be the set of all pairs (x, y) where x, y ∈ A are strings of the same length such that for every position n the n-th characters of x and y are the same English letter, either uppercase or lowercase. (a) Show that R is an equivalence relation on A. (b) Find the equivalence class of the string Y es. Solution. (a) It is clear that for every x ∈ A we have xRx and that R is symmetric. Let x, y, z ∈ A be such that xRy and yRz. Since xRy and yRz, the string y has the same length as x and also y has the same length as z. Hence x and z have the same length. Moreover, for every position i the i-th letter of y is the same (with a possible difference in case) as the i-th letter of x and as the the i-th letter of z. Hence the i-th characters of x and z are the same, with a possible difference in case. Thus xRz and R is transitive. Therefore R is an equivalence relation. (b) The equivalence class of Y es is:

{yes, Y es, yEs, yeS, Y Es, Y eS, yES, Y ES}.

Problem 5 Find the conditional probability that exactly four heads appear when a fair coin is tossed 5 times, given that the first flip came up heads.