Discrete-math 10

1

A person wants to choose 6 cookies from a tray containing at least 6 cookiesof each of the following types: chocolate chip, wheat, and peanut butter.How many ways are there to choose these cookies?Solution:How many ways to choose one cookie is there? 3There are at least 6 cookies of each type, so the number of waysdoesn’t change after choosing 1,2,3,4 or 5 cookies, so it is always 3Order is not important and repetitions are allowed(6+3131)=(82)

2

How many ways are there to arrange number {1,2,,9} such thatno multiple of 3 is adjacent to another multiple of 3?Solution:Let us first arrange numbers that are not multiples of 3 - 1, 2, 4, 5, 7, 8There are six of them, which means there are 6!(66)!=6! ways to arrange themNow we have 6 numbers arranged and we need to choose 3 positionsamong them for multiples of 3There are 7 positions: 5 between chosen numbers and 2 on the sidesEach two multiples of 3 will then be separated by at least 1 other numberNumber of ways to choose 3 out of these 7 positions is 7!(73)!=7!4!The final answer is: 7!6!4!=151200

3

There are 6 identical balls and 3 distinct boxes

3a

In how many ways can 6 balls be arranged in the 3 boxes?Solution:Each box can be represented as a variable in the equation:x1+x2+x3=6,i[1,3]:xi0Number of different solutions is: (6+3131)=(82)

3b

In how many ways can 6 balls be arranged in the 3 boxessuch that each box contains at least one ball?Solution:x1+x2+x3=6,i[1,3]:xi1(x11)+(x21)+(x31)=3,i[1,3]:xi10Number of different solutions is: (3+3131)=(52)

3c

Now there are 7 balls. In how many ways can they be arranged in the 3 boxessuch that no box contains more than 4 ballsSolution:x1+x2+x3=7,i[1,3]:0xi4Let’s solve an "inverse" problem: x1+x2+x3=7,x15x25x35Note that only one of the variables can be greater than 4 at the same timeThere are 3 different problems with the same number of solutions:(xi5)+xj+xk=2,xi5,xj,xk03(2+3131)=3(42)Number of solutions to the initial problem is:(3+7131)3(42)=(92)3(42)

3d

Now there are 8 balls, 4 boxes labeled A, B, C, DHow many ways to arrange the balls there are such that:1.Each box contains at least 1 ball2.Each box contains no more than 4 balls3.Boxes A and B together contain exactly 5 ballsSolution:Let x1,x2,x3,x4 correspond to boxes A,B,C,D accordingly{x1+x2+x3+x4=8i[1,4]:1xi4x1+x2=5{x1+x2=5x3+x4=3i[1,4]:1xi4x1+x2=5,x1,x21There are no solutions where x1 or x2 are greater than 4(x11)+(x21)=3,(x11),(x21)0(3+2121)=(41)x3+x4=3,x3,x41There are no solutions where x3 or x4 are greater than 4(x31)+(x41)=1,(x31),(x41)0(1+2121)=(21)The final answer is (41)(21)

4

Let x,y,nN{0}nx,nyProve combinatorially: (x+yn)=k=0n(xk)(ynk)Proof:Let us choose n people from x boys and y girls:(x+yn)Let us now choose k boys first and then choose the girls leftAk={ways to choose k from x boys and nk from y girls}|Ak|=(xk)(ynk)ijAiAj=|k=0nAk|=k=0n|Ak|=k=0n(xk)(ynk)(x+yn)=k=0n(xk)(ynk)

5

Let nNProve algebraically and combinatorially: k=1nkk!=(n+1)!1Proof (algebraic):(n+1)!1=(n+1)n!1=nn!+n!1k=1nkk!=k=1n(kk!+k!1)k=1n(k!1)=k=1n((k+1)!1k!+1)==k=1n(k+1)!k!=2!1!+3!2!++(n+1)!n!=(n+1)!1!=(n+1)!1k=1nkk!=(n+1)!1Proof (combinatorial):Let A=(1,2,,n+1)There are (n+1)! permutations of this ordered listLet us count all possible permutations except for the trivial (sorted) oneThere are (n+1)!1 of themLet us now choose number k between 1 and n1.Let us choose one item from k first items and swap it with (k+1)’th itemThere are k ways to do so2.Let us now count all possible permutations of first k itemsThere are k! such permutationsLet Ak={permutations generated with steps 1 and 2}Let i<j (symmetrical cases)AiAj= because in any permutation of Ai,(j+1)’th element is equal to (j+1)And in any permutations ofAj,(j+1)’th element is not equal to (j+1)|Uk=1nAk|=k=1n|Ak|=k=1nkk!Let P be a set of all non-trivial permutationsUk=1nAkP is obviousThis is because i[1,n]:pAi:pi+1i+1Let pPThere is a non-trivial part of p and there is a trivial part of pLet the length of a non-trivial part of p be k+1Then pAkPUk=1nAkUk=1nAk is a set of all possible permutations of A except the trivial one|Uk=1nAk|=(n+1)!1k=1nkk!=(n+1)!1

6

Let A,BR|A|=nk=|B|

6a

How many functions f:AB exist such that:a1,a2A:a1<a2f(a1)<f(a2)Solution:Elements of A are strictly ordered by < on RElements of B are also strictly ordered by < on RThus to satisfy the condition we must simply choose n different images in BThe answer is: (kn)

6b

How many functions f:AB exist such that:a1,a2A:a1<a2f(a1)f(a2)Solution:Rhetoric is the same as in 6a, but this time repetitions are allowedThe answer is: (n+k1k1)

7

Let nN{0}Prove algebraically and combinatorially: k=0n3k(nk)=4nProof (algebraic):By the binomial theorem: 4n=(1+3)n=k=0n1nk3k(nk)=k=0n3k(nk)k=0n3k(nk)=4nProof (combinatorial):Let us construct a n-long string consisting of numbers 1, 2, 3, 4Number of ways to construct such a string is 4nLet us now first choose number 0kn1.Let us choose nk places for 1’s, there are (nk)ways to do so2.For the left k places we need to choose either 2, 3 or 4There are 3k ways to do thisLet Ak={strings constructed using steps 1 and 2}ijAiAj= because the amount of 1’s is different|Uk=0nAk|=k=0n|Ak|=k=0n3k(nk)k=0nAk is a set of all possible n-long strings of numbers 1, 2, 3, 4There are k=0n3k(nk) ways to construct a n-long string of numbers 1, 2, 3, 4k=0n3k(nk)=4n

8

Let nN{0}Prove combinatorially: k=02nk(2nk)=2n22n1Proof (combinatorial):If n=0, then both sides are equal to 0If nN:X ways how to choose a team:1.Choose a captain from 2n players2.Choose a subset of left players to join the captainX=2n22n1Y ways to choose a team:1.Choose a subset of k players from 2n players2.Choose one of the players in the team to be captaink ranges from 0 to 2nY=k=02n((2nk)k)X=Yk=02nk(2nk)=2n22n1P. S. This is also known as Captain’s identity

9

Let n,mN{0}nmProve combinatorially: k=0n(nk)(m+kn)=k=0n(nk)(mk)2k

10a

Let nNProve combinatorially: k=0nk(nk)=n2n1Proof:See task 8, it is identical

10b

Let nNProve combinatorially: k=0nk(k1)(nk)=n(n1)2n2Proof:Another variation of Captain’s identitybut now we choose a captain and his second-in-command, who must be a different person

10c

Let nNProve algebraically or combinatorially: k=0nk2(nk)=n(n+1)2n2Proof:k(nk)=n(n1k1)k=0nk2(nk)=nk=0nk(n1k1)k=0 does not affect the sumk=0nk(n1k1)=k=1nk(n1k1)=t=0n1(t+1)(n1t)=t=0n1t(n1t)+t=0n1(n1t)t=0n1t(n1t)=(n1)2n2t=0n1(n1t)=2n1k=0nk(n1k1)=(n1)2n2+2n1=(n1+2)2n2=(n+1)2n2k=0nk2(nk)=nk=0nk(n1k1)k=0nk2(nk)=n(n+1)2n2

11a

Let nNHow many ways there are to divide 2n tennis players into pairs for the tournament?Solution:We need to split 2n players into n pairsOrder of pairs does not matterOrder inside the pairs also does not matterSo we simply need to calculate the number of ways to choose 2 different players from 2nand do so n timesOrder of pairs doesn’t matter too, so we should divide by n!Which is (2n2,2,,2)n!=2n!n!(2!)n=(2n)!n!2n

11b

Let nNProve combinatorially: (2n)!n!2n=135(2n1)Proof:Let us think about left side in terms of task 11a:Let us reorder 2n players, there are (2n)! ways to do soLet us now treat each two players as a pairNote that the order of pairs doesn’t matter, so we divide by n!Note that in each pair order also doesn’t matter, so we divide n times by 2The final formula for the amount of pairs is:(2n)!n!2nLet us now think about the right side:How many ways to choose a partner does the first person have? 2n1There are now 2n2 players without partnersHow many way to choose a partner does the second person have? 2n3This process will continue until the last two persons form a pairThe final formula for the amount of pairs is:(2n1)(2n3)31(2n)!n!2n=135(2n1)

12

Let nNProve combinatorially: k=1n1(nk)2(n1nk)=n(n1)2n3Proof:Let t=k1k=1n1(nk)2(n1nk)=t=0n2(n1t)2(n1n1t)=t=0n2(n1t)2(n1t)Suppose there are n1 peopleWe would like to choose a team of at most n2 sailors, led by a captain and a navigatorThe same person can be both captain and navigatorLet us first choose t people for the team, there are (n1t) ways to do soLet us then choose a captain and a navigator from n1t people leftThey can be the same person, so the number of ways to do so is: (n1t)2The final formula would then be: t=0n2(n1t)2(n1t)n(n1)2n3=(n2+2)(n1)2n3=(n2)(n1)2n3+(n1)2n2Let us now first choose a captain and a navigator:1.Choose two different persons - (n1)(n2)2.Choose one person for both - (n1)And then choose a team of sailors to join them:1.If captain and navigator are two personsthere are n3 people left to choose from: 2n32.If captain and navigator are the same personthere are n2 people left to choose from: 2n2The final formula would then be: (n2)(n1)2n3+(n1)2n2k=1n1(nk)2(n1nk)=t=0n2(n1t)2(n1t)==(n2)(n1)2n3+(n1)2n2=n(n1)2n3k=1n1(nk)2(n1nk)=n(n1)2n3