Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
29
Добавлен:
20.03.2016
Размер:
377.62 Кб
Скачать

 

r

9. Prove that

k=0 C(m; k)C(n; r k) = C(m + n; r). This is called Van

P

Dermonde's Identity.

9. Consider the coe cient of X r in (1 + x)n+m: By the binomial theorem that coe cient is C(n + m; r): But (1 + x)n+m can also be written as (1+x)n(1+x)m; and each of these factors can be expanded by the binomial theorem:

(1 + x)n = C(n; 0) + C(n; 1)x + + C(n; n)xn

and

(1 + x)m = C(m; 0) + C(m; 1)x + + C(m; m)xm

Now, in the product the coe cient of xr is obtained by summing over k = 0; 1; 2; : : : ; r; the products of a term of degree k; C(n; k)xk ; from therst factor and a term of degree r k; C(m; r k)xr k ; from the second factor, so the coe cient of xr in the product is

r

X

C(n; k)C(m; r k) = C(n; 0)C(m; r) + C(n; 1)C(m; r 1)

k=0

+ + C(n; r)C(m; 0)

Since this is also C(n + m; r), the identity holds.

11.Count the number of ways to choose 10 elements from among three pears, four apples, and ve bananas. (Hint. A1 = the set of 10-combinations with more than three pears. A2 = the set of 10-combinations with more than four apples. A3 = the set of 10-combinations with more than ve apples.)

11. jA1j = 28: jA2j = 21: jA3j

= 15: jA1 \ A2j = 3: jA1 \ A3j = 1:

jA2 \ A3j = 0: jA1 \ A2 \ A3j = 0

 

 

 

 

 

 

 

 

 

 

 

The key is to solve x2 + x3 = 7 in de ning A1

 

 

 

 

 

 

n

n

+ 1

 

 

 

 

 

 

 

 

13. Prove that r 1

+ r = n r

both algebraically and combina-

torially.

 

 

 

 

 

 

 

 

 

 

 

 

13.

 

 

 

 

 

 

 

 

 

 

 

 

C(n; r 1) + C(n; r) =

 

 

 

n!

 

+

n!

 

 

 

 

 

 

 

 

 

 

 

 

 

(r

 

1)!(n

 

r + 1)!

r!(n

 

r)!

 

 

 

 

 

 

 

 

 

 

= n! r + n r + 1) (n r + 1)!r!

For a combinatorial proof pick an element of the n-element set, say x. If X is one of the R-elements then the remaining elements are chosen from n 1 elements and the choice is for r 1 elements. If X is not in the R-element set, then choose r elements from the n elements.

15.A \word" is a string of one or more lower case letters. How many words can be formed from the letters of the word hyperbola? In how many words will h and y occur together? In how many will h and y not occur together? The word zigzag in which no pair of consecutive letters are the same?

15. 9! = 362,880; 8! 2! = 80,640; 9! - 8! 2! = 282,240

Using Discrete Mathematics in Computer Science

1.In Section 7.3.3 Application: Unix Logon Passwords we counted the number of UNIX passwords of length six, except that we left a factor of 60 underived.

(a)Derive the factor of 60.

(b)Count how many UNIX passwords there are of length six, seven, or eight.

(c)At a speed of 200,000 words a second, how long would it take to try all the passwords you counted in part (b)?

1.(a) In C(6; 1) choose a place for the rst letter. Then in C(5; 1) possible ways, choose one of the remaining places for the second letter. Finally, in C(4; 1) possible ways, choose one of the remaining places for the special character. The two letter places represent two places that can be chosen in either order and give the same result, so divide by 2. This gives 60.

1. (b) Use the answer from Example 12 in 7.3.3 Application: Unix Logon Passwords but multiply by 60 for the case of seven. For the case of eight C(8; 1)C(7; 1)C(6; 1)=2 522 32 845. For the case of nine

C(9; 1)C(8; 1)C(7; 1)=2 522 32 846

1. (c) Divide the answers in (b) by 200,000*60 to get the number of hours needed to check. Divide the number of hours by 24 to get the number of days.

3.Suppose that in a computer program we want an easy way to list and to access{all the edges of the complete graph Kn, with each edge listed only once and no unused space. We can use a part of the adjacency matrix:

n 1

n

 

 

 

 

 

n 2

n 1

n

 

 

 

 

: : :

: : :

 

 

 

 

 

3

4

5

6

7

: : :

n

2

3

4

5

6

7

: : : n

1

2

3

4

5

6

7 : : : n

 

 

 

 

 

 

 

where after vertex i, we list only the edges going to higher-numbered vertices. Now we could list all the edges in a single array:

fn 1; ng fn 2; n 1g fn 2; ng fn 3; n 2g : : : f1; n 1g f1; ng

Use combinations to express the position of edge (i; j) in the array above.

3.(n i 1)(n i)=2 + (j i)

5.Six distinct symbols are transmitted through a communication channel. A total of 12 blanks are to be inserted between the symbols with at least two blanks between every pair of symbols. How many ways can the symbols and blanks be arranged? How many ways can the symbols and blanks be arranged if there are 25 blanks?

5.The answers are the number of solutions for the following two equations x1 + x2 + x3 + x4 + x5 = 2 and x1 + x2 + x3 + x4 + x5 = 15:

7.In Section 2.5.3 we discussed formulas in CNF. A CNF formula is a formula, such as

(x13 _ x17 _ :x23) ^ (:x2 _ x5) ^ (x2 _ :x13 _ :x17)

s a formula that is composed of a conjunction (^) of disjunctions (_) of literals (proposition letters xi and their negations :xi ). Note that if we assume that a _ applies to as few literals as possible reversing normal operator precedence rules, we can unambiguously drop parentheses |for example,

x13 _ x17 _ :x23 ^ :x2 _ x5 ^ x2 _ :x13 _ :x17

The CNF formulas are very convenient in computer representations of logic, but also tend to get exponentially long. Show that for any xed k, for large enough n, there are boolean functions of n variables that are not expressed by any CNF formula with nk literals. (Actually, allowing any mixing of ^'s and _'s would still not solve the exponential length problem.) (Hint: Count the number of CNF formulas of with nk literals. In fact, this over counts the number of n-ary boolean functions expressible by such CNF formulas, since several CNF formulas may express the same boolean function{that is, be logically equivalent.)

7. The plan of the proof is to show that there are more boolean functions on n variables than there are CNF formulas with nk literals on those same variables. By the Pigeon-Hole Principle, if each of the boolean functions were de ned by such a CNF formula, then two distinct boolean functions would be de ned by the same CNF formula, and impossibility.

We shall prove that, for each xed value of k, there are in nitely many values of n for which there are more boolean functions than CNF formulas with nk literals. (In fact it is true that, for each xed value of k, this is true for all su ciently large n.)

Count the number of CNF formulas: First count, for each m nk , the number of CNF formulas with m literals:

(a)The formula is to contain m literals. For each literal we have 2n choices | one of the n proposition letters or its negation. Thus we have (2n)m choices for the entire sequence of literals.

(b)Since there are m literals, there are m 1 positions for _'s and ^'s. Any subset of those position may be _'s, with the rest being ^'s. There are 2m 1 such subsets.

(c)By the multiplication principle, we nd that, from a xed set of n proposition letters, there are ((4n)m)=2 possible CNF formulas.

(d)Accordingly, there are

1

(4n + (4n)2

+

 

+ (4n)nk ) =

1

 

(4n)nk +1 1

 

 

 

2

2

 

 

 

 

4n

 

1

 

 

 

 

 

 

 

 

 

 

CNF formulas of length nk from a set of n proposition letters.

Count the number of boolean functions: On n variables (n > 0). Think of building a the truth table. Start with creating one row for each of the 2n possible assignments of truth values to those n proposition letters. Now a boolean function can assign any subset of those rows to T (and the rest of the rows to F ). So the number of boolean functions on n variables is

the same as the number of subsets of the set of rows of such a truth table: 22n .

Compare those 2 numbers: We want to show that, for any xed k, for in nitely many n,

 

 

(4n)nk+1 1

< 22n

 

 

 

 

2(4n 1)

 

 

Since < is transitive, it will su ce to show that

 

 

 

(4n)nk+1 1

< (4n)nk+1 = 2(log2(n)+2) nk+1

< 23n nk+1

< 22n

 

2(4n 1)

 

 

 

 

 

The rst inequality above follows from simple algebra. The equality is true because x = 2log2(x). The second inequality is true, for all n 2, because for all x log2(x) < x (plus simple algebra). So we need prove only the nal inequality.

Recall that, for any x; y, x < y if and only if log2(x) < log2(y). So to show that 23n nk+1 < 22n we need only show that 3n nk+1 = 3nk+2 < 2n. And recall that we need to show only it only for in nitely many n's (and thus the n 2 restriction is harmless).

But if there were not in nitely many such n's, then 2n would be in O(nk+2), contradicting Theorem 5.1.7.

Соседние файлы в папке Student Solutions Manual