Https:web Cs Hacettepe Edu TR: bbm205:arxiv:Fa18Ex1Soln

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

BBM 205 - Discrete Structures: Midterm Exam - Solutions

Date: 26.11.2018, Time: 16:30 - 18:00

Name:
Student ID:

Question: 1 2 3 4 5 6 7 8 9 Total
Points: 12 9 10 10 15 10 12 12 10 100
Score:

1. (12 points) Use the extended Euclid algorithm to find integers x and y that satisfy

x · 2328 + y · 440 = gcd(2328, 440).

Solution: 2238 = 5 · 440 + 128 rem(2238, 440) = 128 = 2238 5 · 440.


440 = 3 · 128 + 56 rem(440, 128) = 56 = 440 3 · 128 = 440 3 · (2238 5 · 440) =
16 · 440 3 · 2238.
128 = 2 · 56 + 16 rem(128, 56) = 16 = 128 2 · 56 = (2238 5 · 440) 2 · (16 ·
440 3 · 2238) = 7 · 2238 37 · 440.
56 = 3 · 16 + 8 rem(56, 16) = 8 = 56 3 · 16 = (16 · 440 3 · 2238) 3 · (7 · 2238
37 · 440) = 24 · 2238 127 · 440.
16 = 2 · 8 + 0. rem(16, 8) = 0.
By this algorithm, x = 24 and y = 127.
2. (9 points) Let G be the graph below. Carefully explain why (G) = 4.

Solution: We use proof by contradiction, assume that we can color G with less
than four colors, say using three colors as {1, 2, 3}. Let f be the color function for
the vertex set as f : V (G) ! {1, 2, 3}.
Since c and d are neighbors, they must have di↵erent colors, say i and j, i, j 2
{1, 2, 3}. Then, f (x) 6= i, j and f (z) 6= i, j, because they are both neighbors of c and
d. Since, there is only one color left in {1, 2, 3} other than i and j, call this k, both
f (x) = k and f (z) = k. So, f (x) = f (z).
By the similar idea (because of symmetry), we also see that f (x) = f (y). However,
this gives f (x) = f (z) = f (y) and this is not proper coloring, because y and z are
neighbors. Hence, there is no proper 3-coloring of G and we need at least 4 colors.
To see 4 colors are enough, just provide any proper coloring function f : V (G) !
{1, 2, 3, 4}. One example is as f (x) = 1, f (a) = f (c) = 2, f (b) = f (d) = 3, f (y) = 1
and f (z) = 4.

Page 2
3. (10 points) Prove that for every positive integer n,

1 · 2 + 2 · 3 + · · · + n(n + 1) = n(n + 1)(n + 2)/3.

Solution: P (n) is the statement above.


Base case: P (1) is true, since 1 · 2 = 1 · 2 · 3/3 = 2.
Inductive step: We can assume that P(n) is true (called inductive hypothesis, I.H.)
to show that P(n+1) is true.
1 · 2 + 2 · 3 + · · · + (n + 1)(n + 2) can be separated into two parts:
1 · 2 + 2 · 3 + · · · + n(n + 1) = n(n + 1)(n + 2)/3 by I.H.
Now, adding the last term (n+1)(n+2) to this gives n(n+1)(n+2)/3+(n+1)(n+2)
and after some arithmetic, we see that this equals (n + 1)(n + 2)(n + 3)/3, we are
done.

4. (10 points) Prove that 3 divides n3 + 2n whenever n is a positive integer.

Solution: P (n) is the statement that 3 divides n3 + 2n.


Base case: P (1) is true, since 3 divides 13 + 2.
Inductive step: We can assume that P(n) is true (called inductive hypothesis, I.H.)
to show that P(n+1) is true.
By expanding the power, we get (n + 1)3 + 2(n + 1) = n3 + 3n + 3n2 + 1 + 2n + 2,
which is divisible by 3 if and only if n3 + 2n divisible by 3.
I.H. tells us that this is true, hence we are done.

Page 3
5. (15 points) Indicate true or false for the following statements about the greatest com-
mon divisor, and provide counterexamples for those that are false.
(a) If gcd(a, b) 6= 1 and gcd(b, c) 6= 1, then gcd(a, c) 6= 1.

Solution: False
Let b = 15, a = 3 and c = 5.
Although, gcd(3, 15) = 3 and gcd(15, 5) = 5, we see that gcd(3, 5) = 1.

(b) If a|bc and gcd(a, b) = 1, then a|c.

Solution: True

(c) gcd(an , bn ) = (gcd(a, b))n .

Solution: True

(d) gcd(1 + a, 1 + b) = 1 + gcd(a, b).

Solution: False
Let a = 3 and b = 9.
We see that gcd(1 + 3, 1 + 9) = gcd(4, 10) = 2, but 1 + gcd(3, 9) = 1 + 3 = 4 6= 2.

(e) If an integer linear combination of a and b equals 1, then so does some integer linear
combination of a and b2 .

Solution: True

Page 4
6. (10 points) Prove that if m + n and n + p are even integers, where m, n and p are
integers, then m + p is even.

Solution: Direct proof:


Let m + n = 2k and n + p = 2m, where k and m are integers. Then, m + p =
(m + n) + (n + p) 2n = 2k + 2m 2n = 2(k + m n), done.

7. (12 points) Determine if the two graphs below are isomorphic. If they are, provide an
isomorphism function. If not, explain why.

a) b)

Solution:
(a) Yes. The isomorphism function is as follows:

f (u1 ) = v2 , f (u2 ) = v1 , f (u3 ) = v3 , f (u4 ) = v4 ,


f (u5 ) = v8 , f (u6 ) = v7 , f (u7 ) = v5 , f (u8 ) = v6 .

(b) Yes. The isomorphism function is as follows (note that there can be more than
one isomorphism function in this example):

f (u1 ) = v1 , f (u2 ) = v2 , f (u3 ) = v7 , f (u4 ) = v8 ,


f (u5 ) = v5 , f (u6 ) = v4 , f (u7 ) = v3 , f (u8 ) = v6 .

Page 5
8. (a) (6 points) Draw the following graphs: K5 , Q2 , Q3 . How many edges and vertices
does each graph have?

Solution:

(b) (3 points) Is there a graph (not necessarily simple) with five vertices with degrees
{3, 2, 1, 3, 2}. If yes, give an example. If no, explain why.

Solution: There is no such graph, because the sum of these numbers is 11, but
the degree sum of a graph should always be even.

(c) (3 points) Represent these graphs with an adjacency matrix: C4 , P4 .


0 1 0 1
0101 0100
B1010C B1010C
Solution: B C B
@0101A and @0101A
C

1010 0010

9. (10 points) Use proof by contradiction to show that at least 10 of any 64 days chosen
must fall on the same day of the week.

Solution: Assume that we have at most 9 from each day of the week. Then the
total number of days is at most 9 · 7 = 63, but there are 64 days, a contradiction.

Page 6

You might also like