Discrete-math 11

1

Let r1,,rn+1[0,1)RProve: 1i<jn+1:|rirj|<1nProof:Let’s divide [0,1) into n half-closed intervals:[0,1n),[1n,2n),,[n1n,1)"Length" of each of these intervals is less than 1nLet A={r1,,rn+1}Let B={[0,1n),[1n,2n),,[n1n,1)}Let f:AB,f determines in which half-closed interval x is|A|=n+1>n=|B|By the pigeonhole principle, there are at least two numbers ri,rj(i<j) in the same half-closed intervalknri,rj<k+1n|rirj|<|knk+1n|=1n

2a

Let kNLet n=k2+1Let A be a set, |A|=nLet {Ai}i=1k be a partition of A into k setsProve: j[1,k]:|Aj|k+1Proof:Suppose j[1,k]:|Aj|<k+1|Aj|k{Ai}i=1k is a partitionij[1,k]:AiAj=|i=1kAi|=i=1k|Ai|k2By definition of partition:i=1kAi=A|i=1kAi|=|A|=n=k2+1k2+1k2 Contradiction!j[1,k]:|Aj|k+1

2b

Let Ln be a set of 2n+1 lattice points in RnProve: p,qLn:pqmidpoint of p,q is also a lattice pointProof:Notation P(x) is used as a parity predicate of xe.g. P(27)=F,P(2)=TLet B={(P(p1),P(p2),,P(pn))|(p1,p2,,pn)Ln}In other words, B is a set of binary strings representing parity of a lattice point Let f:LnBf(p)=(P(p1),P(p2),,P(pn))e.g. for R4:f((0,16,2,37))=(T,T,T,F)|Ln|=2n+1>2n=|B|By the pigeonhole principle there exists at least two lattice points p,q such that:f(p)=f(q)Meaning:pqLn:i[1,n]:P(pi)=P(qi)P(pi+qi)Tpi+qi2ZMidpoint of p,q is a lattice point

3

Alice wants to register for a university where each course has only one lecture per week atthe same time. She needs to choose 7 courses from among 30 courses without overlap.Given that each day, from Sunday to Thursday, has 6 courses (for a total of 30)How many ways can Alice register for courses such thatshe has at least one course each day?Solution:Let Alice ignore some days when choosing coursesIf she ignores at least one day, then the number of ways to choose courses is: (3067)If she ignores at least k days, then the number of ways to choose courses is: (306k7)Alice can ignore at most 3 daysby the Inclusion-Exclusion principleThe answer is: k=03(1)k(5k)(306k7)

4

Let S={1,2,...,500}How many integers in S are divisible by 2 or 3 or 5?Solution:Let A={sS|2s3s5s}Number of integers in S divisible by 2 is: 5002=250Number of integers in S divisible by 3 is: 5003=166Number of integers in S divisible by 5 is: 5005=100Number of integers in S divisible by 2 and 3 is: 50023=83Number of integers in S divisible by 2 and 5 is: 50025=50Number of integers in S divisible by 3 and 5 is: 50035=33Number of integers in S divisible by 2, 3 and 5 is: 500235=16 By the inclusion-exclusion principle:|A|=|A2|+|A3|+|A5||A23||A25||A35|+|A235|==250+166+100835033+16|A|=366

5a

How many ways can 50 identical balls be distributed into 10 different boxes such thatEach box has at most 4 ballsSolution:If each box has at most 4 balls, then total is at most 40, which is less than 50The answer is 0

5b

How many ways can 50 identical balls be distributed into 10 different boxes such thatEach box has at most 5 ballsSolution:If each box has at most 5 balls, then the total is at most 50i=110xi=50Let x1<5 WLOGi=210xi>505=45Some box has more than 5 ballseach box has exactly 5 ballsThe answer is 1

5c

How many ways can 50 identical balls be distributed into 10 different boxes such thatEach box has at most 10 ballsSolution:{i=110xi=50i[1,10]:xi10Let at least k boxes have more then 10 balls:(5011k+101101)=(5911k9)There are (10k) ways to choose these k boxesThere are 50 balls There are at least 0 and at most 4 boxes with 11 balls or more# of ways such that at least one box has more than 10 balls is:By the inclusion-exclusion principle: k=14(1)k+1(10k)(5911k9)(1)k+1 is due to an inverted sign, because we’re counting the oppositesThe total # of ways to distribute 50 balls into 10 boxes is:(50+101101)=(599)The final answer is: (599)k=14(1)k+1(10k)(5911k9)This can be rewritten as: k=04(1)k(10k)(5911k9)

5d

How many ways can 50 identical balls be distributed into 10 different boxes such thatEach box has at most 12 balls and at least 2 ballsSolution:Let’s factor out "at least 2": i=110(xi2)=5020=30Now there are 2 balls in each box, for some to have 13, they need 11 moreLet’s use the same rhetoric as in 5cThis time the total is 30 balls, not 50, so we can only get 2 boxes to have 11 balls or morek=02(1)k(3011k+101101)(10k)=k=02(1)k(3911k9)(10k)The final answer is: k=02(1)k(3911k9)(10k)

6

Let nNSuppose n people are standing in a line.In how many ways can the people be arranged in linesuch that no person stands in the same position they were in before?Solution:How many ways there are such that at least one person stays in his position?One fixed position and n1 positions left to arrange: (n1)!How many ways there are such that at least k people stay in their position?(nk)!There are (nk) ways to choose these k peopleBy the inclusion-exclusion principle the answer is:k=0n(1)k(nk)!(nk)

7

In the exam there are 15 questions numbered from 1 to 15.Each question can either be answered correctly or incorrectlyWe know that no student answered two consecutive questions correctlyThere are 1600 students who took the examMust there be two students with identical answers or not?Solution:Consider a binary string of length 15How many such strings can we produce without two consecutive ones?Let B be such a stringB=(b1,b2,,b15)Let f:NN be a function, that counts the number of such stringsIf b15 is a zero, then there are f(14) possibilities for binary string(b1,b2,,b14)If b15 is a one, then b14 is a zero and there are f(13) possibilities for binary string (b1,b2,,b13)f(15)=f(14)+f(13)In other words f(n)=f(n1)+f(n2) or Fibonacci sequencef(1)=2 (strings 0 and 1), which is the 3rd Fibonacci numberf(2)=3 (strings 00, 01 and 10), which is the 4th Fibonacci numberf(n) is (n+2)th Fibonacci numberf(15)=F(17)=1597There are 1600 students and 1597 different exam answersLet A be a set of students, |A|Let C be a set of possible exam answers, |C|=1597<|A|=1600Let g:AC be a function mapping students to their exam answers|A|>|C|By the pigeonhole principle: a1,a2A:g(a1)=g(a2)There are at least two students with the same answers

8

Let A,B be sets|A|=n,|B|=k,kn

8a

How many injective functions f:AB exist?Solution:If k<n, then |A|>|B| There are 0 injective functions in BAIf k=n, then there are exactly n! injective functions in BAThe answer is: n!

8b

How many surjective functions f:AB exist?Solution:There are a total of kn functions in BALet’s count functions that do not map to at least i elements:BB,|B|=kif:ABBA,|BA|=(ki)nThere are (ki) ways to choose these i elementsBy the exclusion-inclusion principle # of surjective functions is:i=0k(1)i(ki)(ki)n

9

Let p1,,pn{T,F} be logical propositionsSolution:There are a total of 2n possible assignments for p1,,pnOnly one of them has zero Truths, when all propositions are FalseThe final answer is: 2n1

10a

Convert (p(q¬r))(rp) into CNF and DNFSolution:Let X=(p(q¬r))(rp)pqrq¬rp(q¬r)rpX00001010010101010110101101011000000101001111011011110011CNF of X is: (¬pqr)DNF of X is: (¬p)(q)(r)

10b

Convert ((pq)¬r)(pq) into CNF and DNFSolution:Let X=((pq)¬r)(pq)pqrpq(pq)¬rpqX00011110011111010110001111001000100101000011011111111111CNF of X is: (p¬qr)(p¬q¬r)(¬pqr)(¬pq¬r)Note that this can be simplified into: (p¬q)(¬pq)DNF of X is: (¬p¬q¬r)(¬p¬qr)(pq¬r)(pqr)Note that this can be simplified into: (¬p¬q)(pq)

11a

Prove: {¬,} is completeProof:{,,¬} is complete (there is a DNF for any proposition)pq=¬(¬p¬q){,¬} is also completepq=¬pq{¬,} is also complete

11b

Prove: {} is completeProof:{,,¬} is complete (there is a DNF for any proposition)pq=¬(¬p¬q){,¬} is also complete¬p=pppq=¬(pq)=(pq)(pq){} is also complete

11c

Prove: {} is completeProof:{,,¬} is complete (there is a DNF for any proposition)pq=¬(¬p¬q){,¬} is also complete¬p=pppq=¬(pq)=(pq)(pq){} is also complete