solutions merged

108

Click here to load reader

Upload: diptesh-majumdar

Post on 30-Jun-2015

142 views

Category:

Education


2 download

DESCRIPTION

Mathhelp

TRANSCRIPT

Page 1: Solutions merged

Bogus Proofs

Page 2: Solutions merged
Page 3: Solutions merged
Page 4: Solutions merged

What is a Proof?

Page 5: Solutions merged
Page 6: Solutions merged
Page 7: Solutions merged
Page 8: Solutions merged
Page 9: Solutions merged

The Well Ordering Principle

Page 10: Solutions merged
Page 11: Solutions merged
Page 12: Solutions merged
Page 13: Solutions merged
Page 14: Solutions merged

The Logic of Propositions

Page 15: Solutions merged
Page 16: Solutions merged
Page 17: Solutions merged
Page 18: Solutions merged
Page 19: Solutions merged
Page 20: Solutions merged
Page 21: Solutions merged
Page 22: Solutions merged
Page 23: Solutions merged
Page 24: Solutions merged
Page 25: Solutions merged
Page 26: Solutions merged
Page 27: Solutions merged
Page 28: Solutions merged
Page 29: Solutions merged

Mathematical Data Types

Page 30: Solutions merged
Page 31: Solutions merged
Page 32: Solutions merged
Page 33: Solutions merged
Page 34: Solutions merged
Page 35: Solutions merged
Page 36: Solutions merged

Infinite Sets

Page 37: Solutions merged
Page 38: Solutions merged
Page 39: Solutions merged
Page 40: Solutions merged
Page 41: Solutions merged
Page 42: Solutions merged
Page 43: Solutions merged
Page 44: Solutions merged
Page 45: Solutions merged
Page 46: Solutions merged
Page 47: Solutions merged

Induction

Page 48: Solutions merged
Page 49: Solutions merged
Page 50: Solutions merged
Page 51: Solutions merged
Page 52: Solutions merged
Page 53: Solutions merged
Page 54: Solutions merged
Page 55: Solutions merged
Page 56: Solutions merged
Page 57: Solutions merged
Page 58: Solutions merged

Recursive Data Types

Page 59: Solutions merged
Page 60: Solutions merged
Page 61: Solutions merged
Page 62: Solutions merged
Page 63: Solutions merged
Page 64: Solutions merged
Page 65: Solutions merged
Page 66: Solutions merged
Page 67: Solutions merged

Number Theory

Page 68: Solutions merged
Page 69: Solutions merged
Page 70: Solutions merged
Page 71: Solutions merged
Page 72: Solutions merged
Page 73: Solutions merged
Page 74: Solutions merged
Page 75: Solutions merged
Page 76: Solutions merged
Page 77: Solutions merged
Page 78: Solutions merged
Page 79: Solutions merged
Page 80: Solutions merged

Directed Graphs

Page 81: Solutions merged
Page 82: Solutions merged
Page 83: Solutions merged
Page 84: Solutions merged
Page 85: Solutions merged
Page 86: Solutions merged
Page 87: Solutions merged
Page 88: Solutions merged
Page 89: Solutions merged
Page 90: Solutions merged
Page 91: Solutions merged
Page 92: Solutions merged
Page 93: Solutions merged
Page 94: Solutions merged
Page 95: Solutions merged
Page 96: Solutions merged
Page 97: Solutions merged
Page 98: Solutions merged
Page 99: Solutions merged
Page 100: Solutions merged
Page 101: Solutions merged
Page 102: Solutions merged

CS 514

IIT Guwahati

AUTUMN SEMESTER, 2011-2012

MATHEMATICS FOR COMPUTER SCIENCE

Mid-Semester Solutions

(Time allowed: TWO hours)

1. An arbitrary binary relation ≺ on a set A (which may not be a partial order) is called well-founded whenthere is no infinite ≺-decreasing sequence

a0 a1 a2 . . . an . . .

of elements ai ∈ A, where is the inverse of ≺. If B is a subset of A, an element b ∈ B is defined to be≺-minimal in B iff there is no b′ ∈ B such that b′ ≺ b. Prove that ≺ is well-founded iff every nonemptysubset of A has a ≺-minimal element. (Size limit: half a page for each part) (10 marks)

ANSWER

(⇒) Suppose ≺ is well-founded. For contradiction, let B be a non-empty subset of A which has no ≺-minimalelement. Choose any element b0 in B. Since b0 is not minimal, there is an element b1 ∈ B such that b0 b1.Since b1 is not minimal either, there is an element b2 such that b1 b2. Continuing this argument we canconstruct an infinite ≺-descending chain b0 b1 b2 . . . bn . . . in B, which is a contradiction.

(⇐) Suppose every non-empty subset of A has a minimal element. Then there cannot be an infinite ≺-descending chain a0 a1 a2 . . . an . . . in A, since such a chain has no minimal element.

2. A robot wanders around a two-dimensional grid. It starts out at (0, 0) and is allowed to take four differenttypes of steps:

(a) (+2,−1)

(b) (+1,−2)

(c) (+1,+1)

(d) (−3, 0)

Justify whether the robot can reach the position (0, 2) either by finding a path from (0, 0) to (0, 2) or byusing the Invariant Principle to prove that no such path exists. (Size limit: half a page) (10 marks)

ANSWER

CONTINUED

Page 103: Solutions merged

– 2 – CS 514

It is easy to check that the following predicate is a preserved invariant which is true of the initial state: “Instate (x, y) it is the case that x − y is divisible by 3”. So by the invariant principle, all reachable statessatisfy the predicate. But 0− 2 is not divisible by 3. So (0, 2) is not reachable.

3. Fermat’s theorem states that if p is a prime and k is not a multiple of p then kp−1 ≡ 1 (mod p). LetSk = 1k + 2k + . . . + (p− 1)k, where p is an odd prime and k is a multiple of p− 1. Use Fermat’s theoremto prove that Sk ≡ −1 (mod p). (Size limit: half a page) (10 marks)

ANSWER

We are given that p is an odd prime and k is a multiple of p − 1. Now for all i such that 1 ≤ i ≤ p − 1, pdoes not divide i. Hence by Fermat’s theorem, ip−1 ≡ 1 (mod p) for all i such that 1 ≤ i ≤ p − 1. Nowsince, k = n(p − 1) for some integer n, we have ik = in(p−1) = (ip−1)n ≡ 1n ≡ 1 (mod p) by repeated useof the congruence property of multiplication. Then by using the congruence property of addition, the sumSk = Σp−1

i=1 ik ≡ 1 + 1 + 1 . . . + 1 (mod p) ≡ (p− 1) (mod p) ≡ −1 (mod p), since p ≡ 0 (mod p).

4. (a) In a round-robin tournament, every two distinct players play against each other just once. For a round-robin tournament with no tied games, a record of who beat whom can be described with a tournamentdigraph, where the vertices correspond to players and there is an edge < x → y > iff x beat y in theirgame. A ranking in a tournament digraph is a path that includes all the players. Give an example of atournament digraph on 3 vertices with more than one ranking. (Size limit: half a page) (5 marks)

ANSWER

3

1 2

(b) We say that a simple (i.e., undirected) graph has two ends if it has exactly two vertices of degree 1 andall its other vertices have degree 2. A line graph is a graph whose vertices can be listed in a sequencewith edges between consecutive vertices only. Give an example of a two-ended graph which is not aline graph. (5 marks)(Size limit: half a page)

ANSWER

CONTINUED

Page 104: Solutions merged

– 3 – CS 514

5

1

2

3 4

5. For each of the statements below state whether it is true or false, and justify your claim by either giving aproof or a counterexample.

(a) In every instance of the Stable Matching Problem, there is a stable matching containing a pair (m,w)such that m is ranked first by w, and w is ranked first by m. (Size limit: half a page) (5 marks)

ANSWER

False. Suppose we have two men m,m′ and two women w,w′. Let m rank w′ first, w rank m first, m′

rank w first and w′ rank m′ first. We see that such a pair as described by the claim does not exist.

(b) Consider an instance of the Stable Matching Problem in which there exists a man m and a woman wsuch that m is ranked first by w, and w is ranked first by m. Then (m,w) must appear in every stablematching. (Size limit: half a page) (5 marks)

ANSWER

True. Suppose S is a stable matching that contains the pairs (m,w′) and (m′, w), for some m′, w′

different from m,w respectively . But clearly, (m,w) forms an unstable pair, contradicting the stabilityof S.

Page 105: Solutions merged

CS 514

IIT Guwahati

AUTUMN SEMESTER, 2012-2013

MATHEMATICS FOR COMPUTER SCIENCECS 514

Mid-Semester Answers

(Time allowed: TWO hours)

1. Express each of the following predicates and propositions in formal logic notation. The domain of discourseis the set of natural numbers N. You may use predicates using only addition, multiplication and equalitysymbols, and constants 0, 1, . . .. For example, the predicate “n is an even number” could be defined by∃m.(2m = n) or alternatively, by ∃m.(m + m = n).

• m is a divisor of n. (Size limit: one line) (2 marks)

• n is a prime number. (Size limit: one line) (3 marks)

ANSWER

• ∃k.n = km.

• ∀i.∀j.(n = ij → (i = 1) ∨ (i = n)).

2. Find a bijection from the half-open unit interval (0, 1] to the nonnegative numbers [0,∞) = x | x ≥ 0 onthe real line. Justify your answer. (Size limit: half a page) (10 marks)

ANSWER

Let f : (0, 1] → [0,∞) be given by f(x) = 1x − 1. Then f is a bijection since

• f(a) = f(b) implies 1a − 1 = 1

b − 1 which implies a = b, so f is injective;

• every c in [0,∞) is the image of 11+c ∈ (0, 1], so f is surjective.

3. We start with 102 coins on a table, 98 showing heads and 4 showing tails. There are two rules for changingthe coins:

• flip over any ten coins (any coin that is flipped changes from heads to tails, and vice versa), or

CONTINUED

Page 106: Solutions merged

– 2 – CS 514

• let n be the number of heads showing. Place n + 1 additional coins, all showing tails on the table.

(a) Model the situation as a state machine, specifying the state space, the initial state and the transi-tions. (4 marks)

(b) Prove that it is not possible to reach a state in which there is exactly one head showing (nothing is saidabout the number of tails – it could be anything). (Size limit: one page) (10 marks)

ANSWER

(a) A state is a pair (x, y) where x and y are the numbers of heads and tails, respectively. The initial stateis (98, 4). The transitions are of two types:

• (x, y) −→ (x − a + b, y − b + a) where a ≤ x, b ≤ y and a + b = 10. Here a and b are the number ofheads and tails that are flipped.

• (x, y) −→ (x, x + y + 1).

(b) We assert that P (x) = x is even is a preserved invariant which is true in the initial state. This isbecause 98 is even (initial state) and x is even implies x− a + b = x− a + 10− a = x + 10− 2a is even. Theother transition is easy since the value of x is unchanged. This means P (x) is true in all reachable states.So any state with exactly one head showing is not reachable.

4. Given a probability space (Ω,F , P ), show that (B, A ∩ B : A ∈ F, P (.|B) is again a probability-space,where B ∈ F and P (.|B) is conditional probability. (6 marks)

ANSWER

[Remark: Only the outline is given.]Given that (Ω,F , P ) is probability-space.Need to show that (B, A ∩B : A ∈ F , P (.|B)) is again a probability-space.i.e. need to show that A ∩ B : A ∈ F is σ−field defined over the sample space B. (Straight-forward toshow and hence omitted)and P (.|B) is probability measure over A ∩B : A ∈ F.

To show P (.|B) is probability measure, show that P (B|B) = 1 andP (.|B) is countably-additive (This has been already discussed in the class).

5. (a) What is the probability of getting the word ABRACADABRA by shuffling 5 As, 2 Bs, 2 Rs, 1 C and1 D randomly. (2 marks)

(b) Two cards are drawn independently with replacement from a well-shuffled deck of 52 cards. All cardsare equally likely at each selection. What is the probability that the king of spades & the king of heartswill be chosen (in some order). (2 marks)

ANSWER

CONTINUED

Page 107: Solutions merged

– 3 – CS 514

(a) 11 letters can arrange in 11! ways. 5 As can arrange in 5! ways and similarly for other letters.

Hence the required probability is 5!2!2!11! .

(b) Each card can be selected with probability = 152 .

As the two cards are selected with replacement and order is important (as per the question)then the reqd probability = P (king of spade)∗P (king of hearts)+P (king of hearts)∗P (king of spade)= 2

522

6. A communication system consists of n-components each of which will independently function with probabilityp. The total system will be able to operate effectively if at least one-half of its components function.

(a) For what values of p is a 5-component system more likely to operate effectively than a 3-componentsystem? (3 marks)

(b) In general, when is a (2k + 1)-component system better than a (2k − 1)- component sys-tem? (4 marks)

ANSWER

(a) Observe that the number of functioning components is a binomial random variable with the parameters(n, p). The probability that the 5−component system will be effective is(

53

)p3(1− p)2 +

(54

)p4(1− p) + p5 (1)

and the corresponding probability for 3− component system is(32

)p2(1− p) + p3 (2)

Hence, the 5−component system is better if eq 1 ≥ eq 2And solving the inequality will give answer p ≥ 1

2

(b) With similar logic, first write down P (effective 2k + 1 system) and P (effective 2k − 1 system). Andsolve the inequality, which again will give p ≥ 1

2 . Lets take X as number of first 2k − 1 componentwhich works, then

P (effective 2k+1 system) = P (X ≥ k + 1) + P (X = k)(1− (1− p)2) + P (X = k − 1)p2

The above equation basically says the (2k + 1)−system will work if either

(i) X ≥ k + 1, or(ii) X = k and at least one of the remaining 2 components works, or(iii) X = k − 1 and both of the next 2 functions.

SimilarlyP (effective 2k-1 system) = P (X ≥ k) = P (X = k) + P (X ≥ k + 1)

CONTINUED

Page 108: Solutions merged

– 4 – CS 514

7. The joint density function of random variables X and Y is given by

f12(x, y) =

4xy if 0 ≤ x ≤ 1, 0 ≤ y ≤ 1, x ≥ y6x2 if 0 ≤ x ≤ 1, 0 ≤ y ≤ 1, x < y0 otherwise.

(a) Find the individual density function f1 and f2. (4 marks)

(b) If A = X ≤ 12, B = Y ≤ 1

2, find P (A ∪B). (4 marks)

ANSWER

(a) This part is easy and similar examples were solved in the class.

(b) First recall thatP (A ∪B) = P (A) + P (B)− P (A ∩B).

You have already calculated marginal densities in the part (a), hence that can be used to calculateP (A) and P (B). P (A ∩B) can be calculated using the given joint density.