.
CSCI 190 Exam II Practice
n
d
1) (6 points) Recall that a recursive function f (n) af ( ) cn , a Z , d N can be expressed nonrecursively as
f (n) a k f (1) cn d ((
then f ( n) is O(n
logb a
a k 1
a
) ( d )k 2
d
b
b
(
d
a
) 1) for n b k . Prove that if a b d ,
d
b
) . You may use the fact that a k nlog
2) (6 points) Prove that
b
a
.
22 n 1 is divisible by 3 for every positive integer n.
Pf: Use
by 3.
(4 points each) induction:
22 n 1 22(1) 1 4 1 3 . Thus 22(1) 1 is divisible by 3 .
2k
2( k 1)
b) Assume p(k): 2 1 is divisible by 3 for n=k. Show 2
1 is divisible by 3. Use the
a) Show P(1) ,
plus/minus trick.
3) 2
2( k 1)
1 22k 2 1 22 k 22 1 22 k 22 22 22 1 22 (22 k 1) 3 . Since 22 k 1 is assumed to be
true, using
a b a c a (b c) , we can conclude 22( k 1) 1 is divisible
a) Three teams, each with 5 runners, race. If the placements were random, what is the
probability that one team would have exactly two of the top 3 finishers?
Solution: First pick one team to have two of the top 3 finishers: 3 C1 . Next pick two spots in the
top three spots: 3 C2 . Finally pick one runner in the remaining two teams to place in the top 3:
10
C1 . The answer is 3 C1 3 C2 10 C1
b) How many bit strings of length 8 have at least 7 zeros?
Solution: At least 7 zeros means exactly 7 zeros (pick 7 spots to place the zeros)or exactly 8
zeros.
The answer is 8 C7 8 C1
c) There are n possible pairs for the sum to be 2n+1: (1,2n),(2,2n-1)…(n,n+1) (n pigeon
holes). When n+1 numbers are selected, you must pick at least one pair from
(1,2n),(2,2n-1)…(n,n+1).
4) (6 points) Prove that if a b(mod m) , then a b (mod m) for any positive integer m.
2
Solution: Suppose a b(mod m) .
2
Then m (a b) . Using the theorem that if a b then a b c ,
m (a b) m (a b)(a b) a 2 b 2 . Therefore a 2 b2 (mod m) .
5) (6 points) Use strong induction to prove that any postage above 11cents can be formed by
using 3 cent stamps and 7 cent stamps only.
Base case: P(12): use four 3 cent stamps
.
P(13) use two 3 cent stamps and one 7 cent stamp
P(14) Use two 7 cent stamps.
14 i k . Show P(k+1) is true. Since
k 14,, k 2 12 . By induction hypothesis, P(k 2) is true. Then simply add a three cent
Inductive steps: Assume P(i) is true for all
stamp to make the k+1 cent postage.
6) (6 points) Solve the simultaneous congruence x 2(mod 7), x 3(mod11), x 1(mod13),
11(13) 143 . First solve 143x 1(mod 7) . Since 143 3(mod 7) , 143x 1(mod 7) becomes
Solution: a)
3x 1(mod 7) . Using trial and error, we get x 5(mod 7) . Next 7(13) 91 , so solve 91x 1(mod11) .
Since 91 3(mod11) , 91x 1(mod11) becomes 3 x 1(mod11) . Using trial and error, we get
x 4(mod11) . Finally, since 7(11) 77 , solve 77 x 1(mod13) . Since 77 1(mod13) , 77 x 1(mod13)
becomes x 1(mod13) . Multiply both side by 1 to get x 1(mod13) .
x 143(5)(2) 91(4)(3) 77(1)(1) 2445 . Then
d) Let
2445 2(mod 7), 2445 3(mod11), 2445 1(mod13),
7) (6 points) Solve x 3(mod 221) by first finding the inverse of the exponent.
7
Solution: Recall that if
GCD(a, m) 1 , then a ( m) 1(mod m) . Thus we need to find the inverse of
(221) 220 . Use the Euclidean Algorithm.
7 in mod
220 7(31) 3
7 3(2) 1
Therefore
Since
1 7 3(2) 7 (220 7(31))(2) 220(2) 63(7)
220(2) 0(mod 220) , v.
Thus the inverse of 7 is 63 mod 220. Next raise both sides of the congruence by 63.
x7 3(mod 221) ( x7 )63 363 (mod 221) x 363 (mod 221)
It remains to compute 3 (mod 221) . We will use successive squaring.
63
63 25 24 23 22 21 1 , so
363 32 2 2 2 21 32 32 32 32 32 31 (mod 221) (3)(9)(81)(181)(201)(141) 27(mod 220)
5
Power
1
2
4
8
16
4
3
2
5
4
Mod
3 ^ power 220
3
3
9
9
81
81
6561
181
32761
201
3
2
.
32
40401
141
8) (6 points) Compute 3
603
(mod10) . You must express your answer in 0 a 10
( m)
Solution: Use Euler’s Theorem to reduce the exponent. a
1(mod m) 3 ( m) 1(mod10) . But
( pq) ( p 1)(q 1) for p, q primes (10) (2 1)(5 1) 4 (or simplify count the natural numbers
less than 10 that are relatively prime to 10: they are 1, 3, 7, 9) 3 1(mod10) . Therefore,
4
3603 3600 33 (34 )150 33 1150 27 7(mod10)
9) (6 points) Define each of the following sets recursively.
a) Positive integers that are congruent to 1 mod 5.
a1 1
an an 1 5
b) a {( x, y ) : x, y positive integers, x+y is odd}
Initial Set:
{(1, 2), (2,1)}
Recursive set:
( x, y ) S ( x 2, y ) S ( x, y 2) S ( x 1, y 1) S
You must define all the necessary intimal values.
10) (6 points) Find a recursive relation for the number of ternary strings (strings of 0,1 2) of length
n that contain three consecutive zeros. You must define all the necessary intimal values.
If the first term is 1 : there are n-1 places to make 3 consecutive zeros ( an 1 ).
If the first term is 2 : there are n-1 places to make 3 consecutive zeros0 ( an 1 _.
If the first term is 0 :
If the second terms is 1, then there are n-2 places to make
3 consecutive zeros ( an 2 ).
If the second terms is 2, then there are n-2 places to make
3 consecutive zeros ( an 2 )..
If the second terms is 0
If the 3rd term is 1 then there are n-2
places to make 3 consec 0s. ( an 3 ).
.
If the 3rd term is 2 then there are n-2
places to make 3 cons 0s ( an 3 ).
if the 3rd term is 0, we succeeded.
The last n-3 spots can be anything.
n 3
The answer is ( a1 0, a2 0, a3 1, an 2an 1 2an 2 2an 3 3
).
11) (2 points each) true/false, short answers. Do not show work
a) Find the smallest positive number that is congruent to 127 mod 7._______________
Solution:
b)
If
Solution:
127 7 18 with the remainder 1.
Thus it is 1.
1231is not a prime number, then there is a prime divisor less than ___________.
1231
k t (mod m) , then a k at (mod m) for positive integers a and m.
False: For the exponents, k t (mod (m) ) is needed.
c) True/false: If
d) Write (216)10 in octal.____:
(216)10 (3)82 3(8) (330)8 ________
e) (2 points) Convert ( AE )16 to decimal. ( AE )16 10(16) 14 (174)10
f)
(2 points) Find the largest negative integer that is congruent to 3 mod 5
Answer: 3-5=-2
g) an 3an1 4an 2 , a0 1, a1 4 :
Its characteristics equation is r 3r 4 0 (r 1)(r 4) 0 r 1, 4 . Thus
2
an c1 (1) n c2 (4n ), a0 1, a1 4 . To find the constants, a1 4 4 c1 4c2 a0 1 1 c1 c2 . Using
Math 50, c1 0, c2 1 . Thus
an c1 (1) n c2 (4n ) an 4n
12)
a) Three people are selected from a group of 10 men and 20 women. Find the probability of
selecting exactly one man and two women.
Solution:
10
C1 20 C2
30 C3
b) Do cases:
Case1: there are two zeros and two ones.
.
There are three cases 1100, 1001, 0011
Case 2: three are three 0s and one 1.
There is only one case: 1001
Together, there are 4 cases.
13) First express ( 58, 11) as a linear combination of 58 and 11.
58=11(5)+3
11=3(2)+2
3=2(1)+1
Thus
1 3 2(1) 3 (11 3(2))(1) 3(4) 11(1) (58 11(5))(4) 11(1) 58(4) 11(21)
Thus the inverse of 11 is (-21)
11x 4(mod 58) 11(21)(mod 58) x 84(mod 58) x 32(mod 58)
14) Use induction to show 2 n n Z
n
Base case: for n=4,
2
24 42 . Suppose P(k) holds. Then for p(k+1),
2k 1 2 2k 2n2 n2 n2 n2 3n n2 2n n n2 2n 1 (n 1)2 n Z . Thus by PMI,
2n n 2 n 4
15) Use strong induction to show that if x1 1, x2 , 4, xn 2 xn 1 xn 2 n, n 3 , then
xn n 2 n N
Need to prove base cases n=1 and n=2 since the proof assumes the statement is true for the two
previous steps.
For n=1,
x1 12
For n=2,
x2 22
Assume P(k) holds for
Then for P(k+1),
16) Prove
2i k
xk 1 2 xk xk 1 (2) 2k 2 (k 1) 2 2 k 2 2k 1 (k 1) 2
n N , the nth Fibonacci number is less than or equal to 2 n : i.e. f n 2 n
Pf: Use strong induction.
Need to prove base cases n=1 and n=2 since the proof assumes the statement is true for the two
previous steps.
For n=1,
f1 1 f1 2
For n=2,
f 2 1 f 2 22
Suppose the statement holds for
2 i k .
Show the statement is true for n k 1
.
i.e. NTS
Thus
f k 1 2k 1 . We have f k 1 f k f k 1 .
f k 2k and f k 1 2k 1 by the induction hypothesis.
f k 1 f k f k 1 2k 2k 1 . And 2k 2k 1 2k 1 (2 1) 2k 1 (2 2) 2k 122 2k 1 . Therefore
f n 2 n by strong induction .
17) Find a recursive relation for the number of ternary strings of length n that do not contain three
consecutive zeros (you must also find the initial values).
If the first term is 1 : there are n-1 places to avoid 3 consecutive zeros ( an 1 ).
If the first term is 2 : there are n-1 places to avoid 3 consecutive zeros0 ( an 1 _.
If the first term is 0 :
If the second terms is 1, then there are n-2 places to avoid
3 consecutive zeros ( an 2 ).
If the second terms is 2, then there are n-2 places to avoid
3 consecutive zeros ( an 2 )..
If the second terms is 0
If the 3rd term is 1 then there are n-2
places to avoid 3 consec 0s. ( an 3 ).
If the 3rd term is 2 then there are n-2
places to avoid 3 cons 0s ( an 3 ).
if the 3rd term is 0, this has no
chance.
The answer is ( a1 0, a2 0, a3 1, an 2an1 2an2 2an3 ).
18) ( 5 points each)
a) How many bit strings of length eight contain at least six zeros?
Solution:
8
C6 (exactly 6) + 8 C7 (exactly 7)+ 8 C8 (exactly 8)
b) In how many ways can a photographer at a wedding arrange 6 people in a row,
including the bride and groom if the bride is not next to the broom?
.
Solution:
6!2(5!) ( 6!is the number of all possible arrangements. 2(5!) is the number of
arrangements when the bride is next to the groom: Think of the bride and groom one person to
get
5! .
Then multiply it by 2 since they can be switched)
c) In 5-card poker game, find the probability that your hand contains exactly one pair.
Solution: There are
52
C5 ways to select 5 cards without replacement. Observe that there are 13
possible numbers for a pair. Then pick 2 cards of the number. Now there are 48 cards of other
numbers, so pick one from this group. Next pick one from the remaining 44 numbers. Finally last
card must be drawn from the remaining 40 cards
13 4 C2 48 C1 44 C1 40 C1
52 C5
d) There are 6 possible outcome. For the all outcomes to be different, there are 6
possible outcomes for the first roll, 5 possible outcomes for the second, and so on.
4
Thus the probability is
6(5)(4)(3)
66
e) When a coin is tossed five times, find the probability of exactly two heads or the first
toss and the third toss are tails
Solution:
P(exactly two heads) =
1
5 C2
2
5
P(first and third flips are tailed)=
1
( )2
2
P(Exactly two heads and the first/third are tails) =The first and third slots are set. There must be
two heads from the remaining three spots.
3
1
C2 ( )5
2
5
Finally, P(A or B)=P(A) +P(B)-P(A and B)=
f)
2
1 5
1 1
5 C2 3 C 2 ( )
2
2 2
There are 40 different time periods during which classes at a university can be
scheduled. If there are 620 different classes, use the generalized pigeonhole
principle to determine how many different rooms will be needed. You must first
identify the ‘pigeons” and “pigeonholes”
Pigeons_________________________
Pigeonholes_______________________
Solution:
.
Pigeons: classes
Pigeonholes:
Classrooms
The number of rooms needed:
620
15.5 16 room
40
19) Use induction to prove 3 n n, n N
3
Pf:
For P(1), n n 1 1 0 3 n n
3
3
3
Assume P(K). i.e. 3 k k
. Show P(k+1): i.e. 3 ((k 1) ( k 1)) .
3
3
But (k 1) (k 1) k 3k 3k 1 k 1 (k k ) 3(k k ) and 3 k k since we are assuming p(k)
3
3
2
3
3
2
and 3 3(k k ) . Therefore 3 ((k 1) ( k 1)) .
2
3
20)
0 x4
a) Find
satisfying 3
302
x(mod 5) ________________
Solution: In mod5, 3 1(mod 5) by Fermat’s little theorem.
4
So 3
300
(34 )75 175 1(mod 5) Therefore, 3302 3300 32 32 4(mod 5)
b) Give a recursive definition of the sequence
Solution:
an 5n, n 1 _______________________
a1 5
an an 1 5
c) Find the number of students who have taken both Math 280 and Math 110 if 300
students have taken Math 280, 1100 students have taken Math 110, and 1200
students taken Math 280 or Math 110.______________________________
Solution: #(A and B)=#(A)+#(B)-#(A and B)=300+1100-1200=200
d) The pigeon hole principle states that if there are more pigeons than pigeonholes,
then there must be at least one pigeonhole with ______________________ pigeons.
Solution: two or more
21) Solve 3x 10 x 3 0(mod 11), 0 x 10
2
Solution: If p is a prime number, then ab 0(mod p) a 0(mod p) or b 0(mod p) . Thus the
congruence can be solved in the usual way.
3x2 10 x 3 (3x 1)( x 3) 0(mod11) 3x 1 0(mod11) or x 3 0(mod11)
3x 1 0(mod11) 3x 1(mod11) . By trial and error (or find the inverse of 3 mod 11), x 7(mod11)
x 3 0(mod11) x 3(mod11) x 8(mod11) .
.
22) Let
a, b, c be integers, a 0 . Prove that if a b and a c then a (3b 2c)
Pf:
Since
a b , b ak for some k Z . Also a c implies c as for some s Z
Thus 3b 2c 3(ak ) 2as (3k 2 s )a ,
for some k , s Z . Therefo.re
a (3b 2c)
23)
a) Find an integer
6 a 13
such that
a 4(mod 7) ______________
Solution: a=11
b)
(100) (52 ) (22 ) (25 5)(4 2) 40
c) True. Since (b+c)-(a+c)=b-a, m divides (b+c)-(a+c)
24)
a) Convert
Last digits are
(11110001)2
to hexadecimal._____
0001 1. The next four digits are 1111 F . Thus (11110001)2 ( F1)16
b) Convert (120)10 to octal.______________________
120 1 82 7 8 0 80 (170)8
c)
a must be coprime to 6. Thus a 1,5(mod 6)
25) Use the Euclidean Algorithm to find the GCF of 53 and 127 and express the GCF as a linear
combination of 53 and 127
Pf:
127 2(53) 21
53 2(21) 11
21 1(11) 10
11 1(10) 1
1 11 1(10) 11 (21 1(11)) 2(11) 21 2(53 2(21)) 21 2(53) 5(21)
2(53) 5(127 2(53)) 127(5) 53(12)
26) Let m be a positive integer. Show that if a Mod m = b Mod m, then
a b(mod m)
Solution: Since a Mod m = b, a and b have the same remainder when they are divided by m.
Using the division algorithm,
Therefore
a mq1 r , b mq2 r . Then a b (mq1 r ) (mq2 r ) m(q1 q2 ) .
a b(mod m) since m divides a-b
.
27) Since
a b(mod m) , m (a b) . Also, c d (mod m) implies m (c d ) . Then a b(mod m) ,
ac bd ac ad ad bd a( c d ) d ( a b) . Since m (c d ) m a(c d ) . Similarly since m (a b)
m d (a b) .
Thus
m (ac bd )
Therefore
ac bd (mod m)
© Copyright 2026 Paperzz