answers_exam_1
answers_exam_1
23 September 2013
2. What is the FISA court? When and why was the FISA court created?
This is the court established by the Foreign Intelligence Surveillance
Act of 1978. It was one of the recommendations of the committee
chaired by Senator Frank Church. His committee investigated abuses
and illegal actions of various intelligence agencies during the Cold War,
especially under the Nixon administration. The court allows the NSA,
CIA, FBI and others to obtain warrants for surveillance of foreign
agents (including US citizens suspected of aiding foreign governments)
without revealing secrets to the public, as might happen in other Fed-
eral courts.
1
3. State the Binomial Theorem. Who discovered it?
The Binomial Theorem states that if n is a nonnegative integer then
n
n
X n
(x + y) = xn−k y k .
k=0
k
It seems to have been first stated (but not in the form above!) by the
Persian poet and mathematician Omar Khayyam, who lived in the late
11th and early 12th centuries.
An and Bn =⇒ An+1
An+1 and Bn =⇒ Bn+1
After establishing base cases for both sequences we conclude the truth
of all An and Bn .
The book uses this method to prove the following two statements by
simultaneous induction:
An : Fn2 + Fn−1
2
= F2n−1
Bn : Fn+1 Fn + Fn Fn−1 = F2n
2
Python
6. What does the following compute?
def spam(b,n):
if n == 0:
return 1
else:
x = spam(b,n/2)**2
if n%2 == 1:
x = b*x
return x
3
7. Write a recursive python function to compute gcd(a, b) based on the
identity
b > 0 =⇒ gcd(a, b) = gcd(b, a mod b).
(Recall that a mod b is the remainder of a ÷ b.) Convert your function
to an iterative python function.
The identity above translates directly into python.
def rgcd(a,b):
"recursive computation of gcd(a,b)"
if b > 0:
return rgcd(b,a%b)
else:
return a
def igcd(a,b):
"iterative computation of gcd(a,b)"
while b > 0:
a,b = b,a%b
return a
Computations
8. Find the number of 20-digit integers in which no 2 consecutive digits
are the same. Justify your answer!
We imagine a decision tree where we choose the digits from most sig-
nificant to least (that is, left to right). Since this is to be a 20-digit
integer the leading digit can be anything except 0. Having just chosen
a particular digit we can choose any of the remaining 9 digits for the
next least significant. Thus there are 920 leaves in this tree.
4
9. In how many ways can you distribute n pennies to k boys and ` girls if
each boy must get at least 1 penny and each girl must get at least 2?
If we were only required to give at least 1 penny to each of the children
then we could solve this as follows. Line up the pennies and imagine
dividing them into k groups. There are k − 1 divisions and these can be
chosen from among any of the n − 1 gaps between the pennies. Hence
the answer would be n−1k−1
in this case.
In our case we can apply the above solution by first distributing 1 penny
to each of the ` girls. This will leave n − ` pennies to distribute to each
of the k + ` children in such a way that each child gets at least 1 of
these. Thus, the number of ways to distribute the pennies according
to these rules is n−`−1
k+`−1
.
Proofs
10. Give an inductive proof of the identity
n
X n k
2 = 3n .
k=0
k
5
11. Give a combinatorial proof of the identity in the previous problem.
The right-hand side of the equation counts the number of strings of
length n on three symbols — say 0, 1, and 2. The left-hand side counts
the n + 1 disjoint cases where we first choose how many nonzero entries
to include in the string; and then, having decided to include k nonzero
entries, choosing the particular k places for them; then amongst those
k places choosing some subset where we place the 1s. A bit artificial,
but there it is!