Docsity

Inductive Definition - Discrete Mathematics - Solved Exam, Exams of Discrete Mathematics

Toggle sidebar
bg1
CS 173: Midterm Exam 2
Fall 2004
Name:
NetID:
Lecture Section:
General Directions
1. Make sure your name is on every page.
2. There are 10 pages, including a sheet of scratch paper. Make sure that you answer all 13 questions.
3. Remember to write clearly and legibly. Unreadable answers will receive no credit.
4. This is a closed book exam. No notes of any kind are allowed.
5. Remember to time yourself.
Question Points Out of
1 5
2 5
3 5
4 5
5 5
6 5
7 5
8 5
9 10
10 10
11 10
12 10
13 20
Total 100
Page 1 of 11
Answer Key
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Inductive Definition - Discrete Mathematics - Solved Exam and more Exams Discrete Mathematics in PDF only on Docsity!

CS 173: Midterm Exam 2

Fall 2004

Name:

NetID:

Lecture Section:

General Directions

  1. Make sure your name is on every page.
  2. There are 10 pages, including a sheet of scratch paper. Make sure that you answer all 13 questions.
  3. Remember to write clearly and legibly. Unreadable answers will receive no credit.
  4. This is a closed book exam. No notes of any kind are allowed.
  5. Remember to time yourself.

Question Points Out of

1 5

2 5

3 5

4 5

5 5

6 5

7 5

8 5

9 10

10 10

11 10

12 10

13 20

Total 100

Multiple Choice

Problem 1 (5pts)

Given the inductive definition:

,

, and

for

,

is:

a) 8

b) 14

c) 34

d) 36

Solution

. The answer is c.

Problem 2 (5pts)

is a collection of strings of symbols. It is recursively defined by

  1. 8 and 9 belong to

.

  1. if string : belongs to

, so does :;.

Which of the following does NOT belong to

?

a) 8 <9=9>

b) 9 =9=

c) 9?

d) 8

Solution

”a” is never concatenated onto the end of any string using the rules provided. Therefore, c does not belong.

Problem 6 (5pts)

The harmonic numbers []\ , ^

_ " < "%! 2HM`

, are defined by

[a\

_b

 HM`

^

`

Let

and c be two natural numbers, which of the following is equal to the expression:

!Qb

 HM`

d 

e

CMH`

e c

f

a) [hg ij

[Zj

b) [Zg ij

[Zg

c) [ gij

[ j

d) [ gij

[ g

Solution

!Qblk D

lk W

CMH`mk g

N k g 6i k

k g6i D

`

HM k g 6ij nbok D

lk W

CMM`pk g

 Q/nk D

lk W

 MM`P k g i j

[Zg

[Zg ij

[Zg ij

[hg

The correct answer is b.

Problem 7 (5pts)

When sorted in decreasing order of growth rate, which one of the following functions would be first?

a)

XdC=QbFMG IW2

b)

h+6DFHGI

c) q

g 6rQi ks^ q

(^) g6rQi Ws q

grVit s g q

gri Ds q

griu s

d)

6DB XvFHGI,D/C

Solution

a)

XdC=QbFMG IW2 L

vFHGIB

b)

h+6DFHGIw L

DFHGI

c) q

g 6rQi ks^ q

(^) g6rQi Ws q

grVit s g q

gri Ds q

griu s

L

xyX (^) t L

d)

6DB XvFHGI,D/C L

vFMG Ib

Therefore, b grows the fastest out of the choices.

Problem 8 (5pts)

How many numbers must be selected from the set z

! Q-, "+! "{! >PK! 2P < 2>-J >2+! >2{! " 6K<|

in order to guarantee that at least

one pair adds up to 22?

a) 5

b) 6

c) 7

d) 8

Solution

There are 10 elements, which means 5 pairs. There are 5 pairs of elements that add up to 22 (pigeonholes). So, if

you select 6 elements (pigeons), you are assured to get at least one pair that adds up to 22. Therefore, b is the correct

answer.

Problem 10 (10pts)

Use the definition of big-O to show that for any positive integer constants 8 and 9 ,

?‚b U

.

You may use the binomial theorem: @hƒ! (^) g  „ (^) g†M‡Rˆ † g‰ ‰ q

g.Š

s‰

g .Š

Solution

To show

e 8

U

, we should prove both

e 8

L

and

L

Ve 8

.

  1. We prove

L

V

firstly. 8 is positive, thus

for all

$K

. Further, because 9 is positive, we have

Qw 8

‚Zl ‚

. Thus, let ‹

and 

, we have

Z

V

for any

. That is  ‚  L

V

.

  1. We then show

L

. When

, we have

X

. Thus

X (^) ‚ o (^) ‚ ‚

. Let ‹

and 

8 , we have

d 8

C‹

for all

. That is

e 8

L

.

Thus,

h 8

U

.

Criteria

  1. In this problem, we should prove two big-O problems: 5 points/subproblem
  2. For each subproblem, you will get 1 point off if you don’t show ‹ and  explicitly.
  3. If you use binomial theorem, but you do not explicitly expand

d 8

or expand incorrectly: 2 points off.

  1. Only saying

is dominant by

after expanding

, then getting

or

O

: 1 point off for each. If without expanding

d 8

and getting the two inequities, 3 points off for each.

  1. Only providing examples for the proof: 3 points off for each subproblem.
  2. Induction does not work. (NOTE: the problem requires you prove by the definition of Big-O). If you use indic- tion, you should provide a const ‹ and  for your inductive step. Otherwise, 7 points off totally.
  3. Most of you get some points off for unclear or not detailed argument, though your argument is correct in prin- ciple.

Problem 11 (10pts)

Prove using induction that every convex polygon with

vertices has exactly

g q

g .Š Ws D diagonals.

(A convex polygon is a polygon with the property that every line segment drawn between any two points inside the

polygon lies entirely inside the polygon.)

Solution

Looking over the problem, we first identify the set of objects that we will induct on - the set of all convex polygons

with

vertices. The property we wish to prove is that all such polygons possess

g q

g .Š Ws D diagonals. We prove this

by induction on the number of vertices as follows:

Base Case: A triangle, by inspection, has

K

diagonals. Likewise, for

, our formula produces

W

q

W

W

s D

W

q

s D

K

diagonals.

Inductive Hypothesis: We can assume either the strong or weak inductive hypothesis. In this case, we assume that a

convex polygon with

vertices has

g q

g .Š Ws D diagonals.

Inductive Step: We wish to show that a convex polygon with

;l vertices possesses q

g 6i kQs^ q

(^) g.Š Ds D diagonals. To

do this, we need to relate the

]

vertex polygon back to a polygon of

vertices. We observe that if we add a vertex

to an

vertex polygon, the new vertex produces

a diagonals (one line segment to each of the other vertices, minus

the one to the right and the one to the left, since these become sides). Further, another diagonal is produced - the one

between the vertices on either side of the new vertex. This means that

P

diagonals are added every time a vertex

is added, so –a—˜™8S.š

h$P – ]— ˜™8S.š

R$”P

. But, we know from our inductive hypothesis that the

number of diagonals in an

vertex polygon is

g q

g .Š Ws D , so –]— ˜™8S<š

(w (^) g q

(^) g.Š Ws D

•ž^ g6r>Š Wg D

 Dg.Š D D

g6r=Š Wg6i Dg.Š D D

 g6r>ŠEg.Š D D

q

g6i^ kQs^ q

(^) g.Š Ds D

. This completes our proof.

Criteria

  1. points were assigned to the base case, points to the inductive hypothesis, points to figuring out that line segments to each of the other vertices from the new vertex produced

diagonals, points to figuring out that the side vertices produced another diagonal, and points for correct math after that point.

  1. Proving a rectangle instead of a triangle for a base case lost

point. Some people proved multiple base cases, and received full credit as long as the triangular case was proved, since this did not adversely affect the proof.

  1. Many people observed (oftentimes by reverse engineering the problem) that adding a vertex added

diag- onals, but failed to justify it. The justification is absolutely critical, since without it there is no way to relate an $ vertex polygon to an

vertex polygon, and therefore no way to apply the inductive hypothesis. This lost

  • points total.
  1. Some people observed that adding a vertex added

diagonals, but justified it incorrectly by stating that the addition of a vertex created

diagonals, and applying it to

to get

d O a ’ new diagonals. This lost

points total.

  1. Some people made minor arithmetic errors in the final stages of their proof. This lost

point, unless the person

used circular reasoning to show that q

g 6i kQs^ q

(^) g.Š Ds D

q

g6i kQs^ q

(^) g.Š Ds D , which lost points.

Long Problem

Problem 13 (20pts)

A certain set

of integers is defined recursively by the following rules:

  1. 0 is in
  1. If ˜ is in

, then ˜

and ˜

are in

.

a) What is the largest integer not in

? (8 points)

b) Let ^ be your answer to part a). Prove that all integers ^

and greater are in

. (12 points) ( HINT: Use induction with a basis consisting of the integers ^

through ^

.)

Solution

a) 23 is the largest integer not in

.

b) This can be proved using Strong Induction.

Basis step: X-a (') (”¤O') . * (') . 6+5 ('3b”¤O'/% . ¤v ('b-3”¤O'3 . 6{5$¤O'b- . According to the definition of set

, 24, 25, 26, 27 and 28 are all in

.

Inductive step: Suppose for

,  is in set

. Now check

. It can be rewritten as

. Notice that

is either one of the base cases or one of the  ’s, where

. In both cases,

is in

. According to the definition rule 2,

, i.e.

is in set

.

Criteria

  1. For part a, you can use whatever approach to solve this part. You get full points if you come up with the right answer,

. With/without explanations are both OK. If your solution is wrong (either a wrong number or something like a form), there is a possibility to get one or two points if some part of your explanation is reasonable.

  1. Using induction is one of the good ways of proving this problem. Normal induction and strong induction are both OK. We show the strong induction version, which might be slightly easier than other approaches.
  2. The basis step is worth 4 points. One or two points might be deducted if you did not explain why the numbers 24 through 28 are in set

. Merely listing them is not enough.

  1. The inductive step is worth 8 points.
  2. You may lose points in part b for:
  • Incomplete base cases.
  • Incomplete inductive hypothesis for strong induction.
  • Undefined symbols (used without a proper definition of its range, for example).
  • Lack of generality in your proof in the inductive step.