CompProblemSet1.pdf

First series of Complementary Homeworks (Due date: 1385/02/06)
Problem 1. You are given an increasing sequence of numbers u1, u2, ... , um and a
decreasing sequence of numbers d1, d2, ... , dn. You are given one more number, C, and
asked to determine if C can be written as the sum of one ui and one dj.
The brute force approach of comparing all mn sums ui + dj to C works, but there is a
much more clever way. See Algorithm Sum-Search.
a) Figure out what’s going on in Sum-Search and explain it.
b) Use induction to prove that Sum-Search is correct. (This is an opportunity to invent
double induction.)
Algorithm Sum-Search(u1, u2, ... , um, d1, d2, ... , dn, C)
i ← m; j ← n;
pair ← (0, 0); [C not found yet]
repeat until i=0 or j=0
if ui + dj = C then pair ← (i, j); exit;
if ui + dj < C then j ← j-1;
if ui + dj > C then i ← i-1;
end repeat;
output pair [(0, 0) if C not obtainable]
c) Problem 2. YWhat does the following algorithm do for Mystery(m, n)? Prove it.
Algorithm Mystery(n, m: natural numbers)
if n = 0 then F ← 0
else F ← (m+n-1) + Mystery(n-1, m-1);
output F
Problem 3. Let ө be an angle for which sin ө and cos ө are rational. Prove that sin nө and
cos nө are rational for all integers n.
Problem 4. Let Q(n) be the statement “Every positive integers ≤ n has a prime
factorization.” Prove that every positive integer has a prime factorization by weak
induction on Q.
Problem 5. Prove that in Tower of Hanoi problem the minimum sequence of steps to
move n rings is unique.
Problem 6. PShow that for each integer n>1, 1 + 1 + 1 + 1 + ... is irrational.
144424443
n 1' s
Problem 7. Prove that gcd(a, b) = gcd(b, a − b) for all a, b in Z.
Problem 8. Suppose you take a piece of paper and draw a bunch of straight lines, no one
exactly on top of another, that completely cross the paper. This divides the paper up into
polygonal regions. Prove by induction that you can always color the various regions
using only two colors, so that any two regions that share a boundary line are different
colors. Regions that share only a boundary point may have the same color.
Problem 9. An n-player tournament consists of some set of n ≥ 2 players, and, for every
two distinct players, a specification that one of the players beats the other. That is, player
p beats player q iff q does not beat p, for all players p ≠ q.
A sequence of distinct players p1, p2, ... , pk , such that player pi beats player pi+1 for 1 ≤ i<k
is called a ranking of these players. If also player pk beats player p1, the ranking is called a
k-cycle.
(a) Prove by induction that in every tournament, either there is a “champion” player that
beats every other player, or there is a 3-cycle.
(b) A consistent ranking is a sequence p1,p2,... ,pn of all n players in the tournament such
that pi beats pj iff i<j, for 1 ≤ i, j ≤ n. Conclude that a tournament has no consistent ranking
iff some subset of three of its players has no consistent ranking.