Skeleton Answers to Sample Questions for Final
1. a. What is the contrapositive of the statement ‘If Jill is in Kansas then Roger is
in Nebraska’ ?
b. Write the negation of the statement ‘Roses are red and violets are blue’ in
positive form (that is, without simply saying “It is not the case that ...”)?
c. Give an example of statements p and q such that p ⇒ q is true but q ⇒ p is
false.
d. Is the formula p ⇒ (q ⇒ ¬r) equivalent to (p ∧ q) ⇒ (p ∨ ¬r)?
a. If Roger is not in Nebraska then Jill is not in Kansas.
b. There is rose that is not read or a violet that is not blue.
c. See Solutions to Midterm I.
d. No. Suppose p, q, r are all true. Then p ⇒ (q ⇒ ¬r) is false but (p∧q) ⇒ (p∨¬r)
is true.
2. What is an injective function? What is a surjective function? Give an example of
(i) an injective function that is not surjective and (ii) a surjective function that is
not injective.
Look at class notes or the text for the definition of injectivity (resp. surjectivity).
Any function f : {1} → {1, 2} is injective but not surjective.
The unique function g : {1, 2} → {1} is injective but not surjective.
3. A set S has 5 elements and a set T has 4 elements.
a. How many functions are there from S to T ?
b. How many injective functions are there from S to T ?
c. How many injective functions are there from T to S?
d. How many surjective functions are there from S to T ?
e. How many surjective functions are there from T to S?
4. a. 45 = 1024.
b. 0.
c. 5 × 4 × 3 × 2 = 120.
d. 240. This takes more work than the previous parts. First count the number of
functions whose image (= range) has size 1 (ans. 4), then 2 (ans. 180), then 3
(ans. 600). Thus there are 4 + 180 + 600 = 784 non-surjective functions from
S to T and so 1024 − 784 = 240 surjective functions from S to T .
2
a. By using induction or otherwise, show that
1 + 2 + ··· + n =
n(n + 1)
.
2
b. Consider the Lucas sequence l = (ln ) given by
l1 = 2, l2 = 1, ln = ln−1 + ln−2 (n ≥ 3).
Let
√
√
1+ 5
1− 5
τ1 =
, τ2 =
.
2
2
Use induction to show that
ln = τ1n−1 + τ2n−1 (n ≥ 1).
a. See the text (page 316).
b. Mimic the proof we gave in class of Binet’s formula for the n-th term of the
Fibonacci sequence.
5. a. Prove that if n is an odd integer then 24 divides n(n2 − 1).
√
b. Complete the following outline to prove that 17 is irrational. Suppose not so
that
√
17 = a/b, for some integers a, b.
Then 17b2 = a2 . By considering the power of 17 that divides the 17b2 and the
power of 17 that divides a2 , explain why this is impossible.
a. Note n(n2 − 1) = n(n − 1)(n + 1) is a product of three consecutive integers and
hence is divisible by 3. Further n = 2k + 1 for some integer k (as n is odd) and
so
n(n2 − 1) = (n − 1) n (n + 1)
= 2k (2k + 1) (2k + 2)
= 4(2k + 1) k (k + 1).
Since one of k, k + 1 is even, it follows that 8 | n(n2 − 1). So 3 | n(n2 − 1) and
8 | n(n2 − 1). As 3 and 8 are relatively prime, we conclude that 3 × 8 = 24
divides n(n2 − 1).
b. The power of 17 that appears in the prime factorization of 17b2 is odd whereas
the power of 17 in the prime factorization of a2 is even.
6. a. Prove that there are infinitely many primes.
b. State the Fundamental Theorem of Arithmetic.
a. See the text.
b. See the text.
3
7. a. If today is Friday what day of the week will it be a million (= 106 ) days from
now?
b. Show that 2 is the only natural number n such that n and n + 1 are prime.
(Remember 1 is not a prime.)
c. Show that 3 is the only natural number n such that n, n + 2, n + 4 are all prime.
[Hint: Show that one of the numbers must be divisible by 3.] It is not known if
there are infinitely many primes n such that n + 2 is also prime. Such primes
are called twin primes.
d. What is the remainder when 291 is divided by 17?
a. 106 ≡ 36 (mod 7) and by Fermat’s Little Theorem or direct calculation 36 ≡ 1
(mod 7). So it will be Saturday.
b. If n 6= 2 is prime then n must be odd and thus n + 1 is even. In particular,
n + 1 cannot be prime.
c. Suppose n 6= 3 is prime. Then n ≡ 1 or 2 (mod 3). If n ≡ 1 (mod 3), we have
n+2≡1+2
≡0
(mod 3)
(mod 3),
and thus 3 | n + 2. For n ≡ 2 (mod 3), the same argument shows that 3 | n + 4.
d. 291 ≡ 8 (mod 17). Use 24 = 16 ≡ −1 (mod 17).
8. a. Show that
Pn
b. Show that n
k=0
n
k
n−1
k−1
2k = 3n .
= k nk .
a. Use the binomial theorem with x = 1, y = 2.
b. Use the factorial formula for binomial coefficients. The formula can also be
proved by a counting argument (see problem 21 from Section 6.4 in the text).
9. a. There are n people in a room. Each person shakes hands exactly once with
everyone else. How many handshakes take place?
b. Consider strings of length 10 made out of lower-case letters (a through z). How
many strings contain no vowels (a, e, i, o, u)? How many strings contain
exactly one vowel? How many strings start and end with a vowel?
a. # of handshakes =
n(n+1)
.
2
b. 2110 strings contain no vowels. 10 × 5 × 219 strings contain exactly one vowel
(there are 10 places the vowel can go and 5 choices for each of these places).
5 × 268 × 5 strings start and end with a vowel (there are 5 choices for the first
and last slots; the remaining slots can be filled arbitrarily).
10. a. Consider the set S of all sequences s1 , s2 , s3 , . . . in which each si = 0 or 1. Use
Cantor’s diagonal method to show that S is uncountable.
4
b. True or false: if A and B are uncountable then A ∪ B is uncountable.
c. True of false: if A and B are uncountable subsets of R then A∩B is uncountable.
a. Look at your notes from class.
b. True. Remember any subset of a countable set is countable. So A ∪ B cannot
be countable as then A and B would be countable.
c. False. For example, (0, 1) and (1, 2) both uncountable but (0, 1) ∩ (1, 2) is the
empty set and so is countable (finite sets are countable).
© Copyright 2026 Paperzz