DISCRETE MATHEMATICS 21228 HOMEWORK 3 SOLUTIONS JC Due in clss Wednesdy September 17. You my collborte but must write up your solutions by yourself. Lte homework will not be ccepted. Homework must either be typed or written legibly in blue or blck ink on lternte lines, illegible homework will be returned ungrded (so you cn rewrite it legibly. Plese write the nme of your recittion instructor nd the time nd plce of your recittion t the top of your homework. (1 Consider the experiment in which bised coin with probbility p of coming up heds is tossed N times. Write down formul for the expecttion vlue of the number of times the coin comes up heds. Prove tht this expecttion vlue is Np (why might we hve expected this nswer? As we sy in clss, the probbility of n outcome with heds is p (1 p N. There re ( N mny such outcomes, nd so esily the expecttion vlue of the number of heds is p (1 p N. =0 There re vrious tricks we might use to evlute this expecttion. Here is nice one. Let q = 1 p nd consider the expnsion of (x + q N by the Binomil theorem, tht is (x + q N = =0 x q N. Differentite both sides with respect to x nd get N(x + q N 1 = ( N =0 1 x 1 q N.
2 JC Multiply by x, set x = p, note tht p + q = 1 nd conclude Np = p q N =0 s required. We might hve expected this nswer becuse ech time we toss the coin there is probbility p tht it comes up heds, so tht ech of the N tosses mkes contribution p to the totl expecttion. Here is nother proof which mkes this ide precise. For ech let f be the function on the probbility spce of outcomes (strings of N mny H s nd T s which is 1 if toss yields hed nd 0 otherwise. Clerly if f is the function which gives the number of heds then f = f 1 +... f N, nd so by n esy clcultion E(f = E(f 1 +... E(f N. Now esily E(f is excty the probbility of the event coin comes up hed on toss, nd this probbility is p. So E(f = Np. I gve yet nother proof in clss, which involved using the identity = N! ( 1!(N! = N 1 to rerrnge the sum. (2 Consider the experiment in which the bised coin with probbility p of coming up heds is tossed repetedly until it comes up tils. Find formul for p n, the probbility tht the coin is tossed exctly n times. For given vlue of p, wht is the lest N such tht the probbility we toss the coin t most N times is t lest 0.99? To be tossed exctly n times, we must hve n 1 heds then til, so p n = p n 1 (1 p. The probbility tht we toss the coin t most N times is p 1 +... p N = (1 p(1 +... p N 1 = 1 p N. Alterntive rgument: we do not toss the coin t most N times if nd only if we come up heds on the first N tries, nd this hs probbility p N. Now 1 p N 0.99 if nd only if p N 0.01, so esily the lest N tht works is the lest integer such tht N ln(0.01/ ln(p. (3 Consider the 3D generlistion of the notion of pth: pth is sequence (x 0, y 0, z 0, (x 1, y 1, z 1,... (x n, y n, z n where t ech
DISCRETE MATHEMATICS 21228 HOMEWORK 3 SOLUTIONS 3 step one of the three coordintes increses by one while the other two remin constnt. If, b, c re nturl numbers show tht the number of pths from (0, 0, 0 to (, b, c is ( + b + c!!b!c! Clerly the set of pths cn be put in bijective correspondence with the set of strings of length +b+c from the lphbet {x, y, z} contining mny x s, b mny y s nd c mny z s. To count these strings, note tht if N = + b + c then there re ( ( N wys of plcing the x s nd then N b wys of plcing the y s, fter which the plcing of the z s is determined. This gives N!!(N! (N! b!(n b! = N!!b!c! possibilities. (4 If, b, c re nturl numbers with c > + b, find n expression for the number of pths from (0, 0, 0 to (, b, c such tht z > x + y for every point (x, y, z on the pth except for (0, 0, 0. (Geometricl picture: we re looking t pths which sty bove the plne z = x + y. (Sketchy, you should give bit more detil Given pth W from (0, 0, 0 to (, b, c such tht z > x + y t ll but the first point, we define pth W from (0, 0 to ( + b, c s follows: ech point (x i, y i, z i on W corresponds to point (x i + y i, z i on W. It is esy to see tht the pth W stys bove the digonl. The key question is now how mny vlues for W correspond to given vlue for W, tht is given pth from (0, 0 to ( + b, c which stys bove the digonl? Suppose W is the pth (s 0, z 0,... (s N, z N where N = + b + c. At one of the c steps where z i+1 = z i + 1 we must hve x i+1 = x i nd y i+1 = y i + 1, while t one of the + b steps where z i+1 = z i we must hve either x i+1 = x i + 1 or y i+1 = y i + 1. If we focus on the ltter clss of steps, we see tht we re trcing out pth from (0, 0 to (, b, nd tht in fct ny such pth corresponds to suitble W. So we get totl of c b c + + b ( ( + b + c + b c b.
4 JC (5 We re given n letters L 1,... L n nd n envelopes E 1,... E n. How mny wys re there of putting the letters in the envelopes so tht exctly one letter goes in ech envelope? How mny wys re there such tht for every i, letter L i does not go into envelope E i? There re n! wys of putting the letters in the envelopes. Let d n be the number of such wys in which every letter goes in the wrong envelope. Permuttions of set X which move every x X re clled derngements of X so we re counting the number of derngements of n n-element set. Solution one: let π be some derngement of {1,... n} nd suppose tht π(1 = i. If π(i = 1 then π gives derngement of {1,... n} \ {1, i}, nd there re d n 2 such derngements. We clim tht the set of derngements with π(1 = i nd π(i 1 is in bijection with the set of derngements of {2,... n}. Given derngement ρ of {2,... n} define ρ s follows: ρ (1 = i, ρ (ρ 1 (i = i, ρ (x = ρ(x for ll other x. We conclude tht d n = (n 1(d n 1 + d n 2 for ll n > 2. Clerly d 1 = 0 nd d 2 = 1, so this determines d n. Note : to get closed form expression rther thn recurrence we notice tht if e n = d n nd n 1 then from the recurrence e n = e n 1. Also e 2 = 1 so by n esy induction e n = ( 1 n. So we get d n = nd n 1 + ( 1 n, nd then esily d n = n! n!/2! + n!/3! +... n!/n!. Culturl remrk: it is musing to note tht d n /n! tends to 1/e for n lrge. Solution 2: use the inclusion exclusion formul s in the online notes. (6 (Chllenging Recll tht in clss we defined the n th Ctln number to be C n = 1 n + 1 ( 2n, n or equivlently the number of pths from (0, 0 to (n, n which do not go below the line y = x. ( Show tht C n is the number of sequences (1, 1,... n with i N nd i i nd 1 1... i. Argument one (sketch, you should give bit more detil: consider pth from (0, 0 to (n, n which does not go below the line y = x. This pth must contin n verticl segments, nd the x-coordinte of the n th segment is t most n 1 becuse we re stying bove the digonl. If
DISCRETE MATHEMATICS 21228 HOMEWORK 3 SOLUTIONS 5 we let i equl the x-coordinte for segment i plus 1 then we cn set up bijection between sequences nd pths, so the number of sequences equls the number of pths equls C n. (b Given 2n distinct points on the circumference of circle, C n is the number of wys of joining them in pirs by drwing n chords of the circle, no two of which intersect. Here is picture for the cse n = 2. Let D n be the number of wys of drwing the chords nd note D 0 = D 1 = 1. Lbel the points with lbels from 0 to 2n 1. It is cler tht 0 must be joined to point with n odd lbel 2i + 1, becuse there must be n even number of points on ech side s the chords re non-intersecting. It is lso cler tht there re D i wys of drwing the chords which connect the 2i points {1,... 2i} on one side of the chord joining 0 nd 2i + 1, nd D n i 1 wys of drwing the chords connecting the 2(n i 1 points {2i + 2, 2n 1} on the other side. So D n = i<n D i D n i 1, nd since this is the recurrence stisfied by the Ctln numbers we hve D n = C n.