Discrete Structures, Test 2 Monday, March 28, 2016 SOLUTIONS, VERSION α

Similar documents
378 Relations Solutions for Chapter 16. Section 16.1 Exercises. 3. Let A = {0,1,2,3,4,5}. Write out the relation R that expresses on A.

KENDRIYA VIDYALAYA IIT KANPUR HOME ASSIGNMENTS FOR SUMMER VACATIONS CLASS - XII MATHEMATICS (Relations and Functions & Binary Operations)

Solutions for HW9. Bipartite: put the red vertices in V 1 and the black in V 2. Not bipartite!

Minimal DFA. minimal DFA for L starting from any other

Logic, Set Theory and Computability [M. Coppenbarger]

Discrete Structures Lecture 11

Functions. mjarrar Watch this lecture and download the slides

CS311 Computational Structures Regular Languages and Regular Grammars. Lecture 6

NON-DETERMINISTIC FSA

Technische Universität München Winter term 2009/10 I7 Prof. J. Esparza / J. Křetínský / M. Luttenberger 11. Februar Solution

Myhill-Nerode Theorem

CS 310 (sec 20) - Winter Final Exam (solutions) SOLUTIONS

The University of Nottingham SCHOOL OF COMPUTER SCIENCE A LEVEL 2 MODULE, SPRING SEMESTER MACHINES AND THEIR LANGUAGES ANSWERS

Homework 3 Solutions

Nondeterministic Finite Automata

Graph Theory. Simple Graph G = (V, E). V={a,b,c,d,e,f,g,h,k} E={(a,b),(a,g),( a,h),(a,k),(b,c),(b,k),...,(h,k)}

Total score: /100 points

Lecture 3: Equivalence Relations

CIT 596 Theory of Computation 1. Graphs and Digraphs

If the numbering is a,b,c,d 1,2,3,4, then the matrix representation is as follows:

12.4 Similarity in Right Triangles

QUADRATIC EQUATION. Contents

= state, a = reading and q j

Abstraction of Nondeterministic Automata Rong Su

Pre-Lie algebras, rooted trees and related algebraic structures

Convert the NFA into DFA

Algorithms & Data Structures Homework 8 HS 18 Exercise Class (Room & TA): Submitted by: Peer Feedback by: Points:

Section 1.3 Triangles

Counting Paths Between Vertices. Isomorphism of Graphs. Isomorphism of Graphs. Isomorphism of Graphs. Isomorphism of Graphs. Isomorphism of Graphs

The University of Nottingham SCHOOL OF COMPUTER SCIENCE A LEVEL 2 MODULE, SPRING SEMESTER LANGUAGES AND COMPUTATION ANSWERS

Special Numbers, Factors and Multiples

Coalgebra, Lecture 15: Equations for Deterministic Automata

First Midterm Examination

CSE : Exam 3-ANSWERS, Spring 2011 Time: 50 minutes

GM1 Consolidation Worksheet

System Validation (IN4387) November 2, 2012, 14:00-17:00

Non Right Angled Triangles

INTEGRATION. 1 Integrals of Complex Valued functions of a REAL variable

Logic Synthesis and Verification

Compression of Palindromes and Regularity.

Harvard University Computer Science 121 Midterm October 23, 2012

Ch. 2.3 Counting Sample Points. Cardinality of a Set

PYTHAGORAS THEOREM WHAT S IN CHAPTER 1? IN THIS CHAPTER YOU WILL:

Mid-Term Examination - Spring 2014 Mathematical Programming with Applications to Economics Total Score: 45; Time: 3 hours

First Midterm Examination

Formal Languages and Automata

Regular expressions, Finite Automata, transition graphs are all the same!!

Part I: Study the theorem statement.

50 AMC Lectures Problem Book 2 (36) Substitution Method

SECTION A STUDENT MATERIAL. Part 1. What and Why.?

Regular languages refresher

S56 (5.3) Vectors.notebook January 29, 2016

QUADRATIC EQUATION EXERCISE - 01 CHECK YOUR GRASP

TOPIC: LINEAR ALGEBRA MATRICES

CM10196 Topic 4: Functions and Relations

CS 373, Spring Solutions to Mock midterm 1 (Based on first midterm in CS 273, Fall 2008.)

Exercise 3 Logic Control

The Word Problem in Quandles

STRAND J: TRANSFORMATIONS, VECTORS and MATRICES

State Minimization for DFAs

Foundations of Computer Science Comp109

AP Calculus AB Unit 4 Assessment

Trigonometry and Constructive Geometry

CMPSCI 250: Introduction to Computation. Lecture #31: What DFA s Can and Can t Do David Mix Barrington 9 April 2014

Probability. b a b. a b 32.

A negative answer to a question of Wilke on varieties of!-languages

1 PYTHAGORAS THEOREM 1. Given a right angled triangle, the square of the hypotenuse is equal to the sum of the squares of the other two sides.

Transition systems (motivation)

m A 1 1 A ! and AC 6

18.06 Problem Set 4 Due Wednesday, Oct. 11, 2006 at 4:00 p.m. in 2-106

Lesson 2.1 Inductive Reasoning

where the box contains a finite number of gates from the given collection. Examples of gates that are commonly used are the following: a b

Lecture Notes No. 10

Pythagoras Theorem. The area of the square on the hypotenuse is equal to the sum of the squares on the other two sides

Strong Bisimulation. Overview. References. Actions Labeled transition system Transition semantics Simulation Bisimulation

State space systems analysis (continued) Stability. A. Definitions A system is said to be Asymptotically Stable (AS) when it satisfies

PYTHAGORAS THEOREM,TRIGONOMETRY,BEARINGS AND THREE DIMENSIONAL PROBLEMS

The area under the graph of f and above the x-axis between a and b is denoted by. f(x) dx. π O

April 8, 2017 Math 9. Geometry. Solving vector problems. Problem. Prove that if vectors and satisfy, then.

3 Angle Geometry. 3.1 Measuring Angles. 1. Using a protractor, measure the marked angles.

5. Every rational number have either terminating or repeating (recurring) decimal representation.

SWEN 224 Formal Foundations of Programming WITH ANSWERS

Lesson 2: The Pythagorean Theorem and Similar Triangles. A Brief Review of the Pythagorean Theorem.

PROPERTIES OF TRIANGLES

Lecture 11 Binary Decision Diagrams (BDDs)

Figure 1. The left-handed and right-handed trefoils

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

Project 3: Using Identities to Rewrite Expressions

AP Calculus BC Chapter 8: Integration Techniques, L Hopital s Rule and Improper Integrals

Math Lesson 4-5 The Law of Cosines

Trigonometry Revision Sheet Q5 of Paper 2

Designing finite automata II

CS241 Week 6 Tutorial Solutions

Finite State Automata and Determinisation

1. For each of the following theorems, give a two or three sentence sketch of how the proof goes or why it is not true.

MATH 409 Advanced Calculus I Lecture 22: Improper Riemann integrals.

More Properties of the Riemann Integral

Lesson 2.1 Inductive Reasoning

CHENG Chun Chor Litwin The Hong Kong Institute of Education

Compiler Design. Spring Lexical Analysis. Sample Exercises and Solutions. Prof. Pedro C. Diniz

Transcription:

Disrete Strutures, Test 2 Mondy, Mrh 28, 2016 SOLUTIONS, VERSION α α 1. (18 pts) Short nswer. Put your nswer in the ox. No prtil redit. () Consider the reltion R on {,,, d with mtrix digrph of R.. Drw the d () For the reltion R from prt (), find the mtrix of R R. The mtrix of R R is given y the mtrix produt M R M R, where M R is the mtrix from prt (). Then reple ll nonzero entries with 1s. So ompute M R M R = is then. = 2 0 1 0. Now the nswer () Find the inverse funtion of f(x) = x + 9 (where the domin nd odomin re oth the set of rel numers). y = x + 9, so x = 1 (y 9), nd f 1 (x) = 1 x. (d) Let f nd g e funtions on the set of it-strings, defined y f(s) = 0s1 nd g(s) = s10. Compute f(g(11)). f(g(11)) = f(1110) = 011101. 4 (e) Compute (n 1). Your nswer should e in the form of n integer. n=1 4 (n 1) = (1 1) (2 1) ( 1) (4 1) = 0 1 8 27 = 0. n=1 1

(f) For R the reltion in prt (), write down the reltion R in terms of set of ordered pirs. R = {(, ), (, ), (, ), (, ), (d, ). (g) Let g e funtion from the integers to the integers given y g(n) = n/2. Is g one-to-one or onto or oth or neither? g is onto ut not one-to-one. g is onto sine for every integer n, g(2n) = n, nd so n is the the rnge of g. g is not one-to-one sine for exmple g(0) = g(1) = 0. (h) Let h e the funtion from {1, 2,, 4 to {,, given y {(1, ), (2, ), (, ), (4, ). Drw its rrow digrm. 1 2 4 (i) For the funtion h from prt (h), ompute h(). h() =. 2. (6 pts) Write n lgorithm min index(s, n) whih returns the index of the first ourrene of the smllest vlue of the sequene s 1,..., s n. So if s is 7, 0, 5, 0, 8, the output would e 2. min index(s,n){ j=1 // index of smllest vlue to e returned for i=2 to n{ if (s i < s j ) j=i return j. (8 pts) Consider the following lgorithm f f(s,n){ for i=1 to n-1 { if (s i < s i+1 ) return flse return true () Wht is the output for s = 10, 9, 5, 0 nd n = 4? Tre your steps. true. In the for loop, i goes from 1 to. For i = 1, we hek s 1 < s 2 is flse sine 10 9. For i = 2, we hek s 2 < s is flse sine 9 5. For i =, we hek s < s 4 is flse sine 5 0. So the for loop exists, nd the return vlue is true. 2

() Wht is the output for s = 7, 5, 0, 6, 9 nd n = 5? Tre your steps. flse. In the for loop, i goes from 1 to 4. For i = 1, we hek s 1 < s 2 is flse, sine 7 5. For i = 2, we hek s 2 < s is flse, sine 5 0. For i =, we hek s < s 4 is true, sine 0 < 6. So flse is returned from inside the for loop. () Desrie ll the sequenes for whih the return vlue is true. In other words, wht does this lgorithm ompute in terms of sequenes? This lgorithm returns true for sequenes whih re noninresing. In other words, we hve to hve s i s i+1 for ll i from 1 to n 1. 4. (24 pts) True/Flse. Cirle T or F. No explntion needed. () T F If R is the reltion whose digrph is elow, then R is trnsitive. d T. A quik justifition is to note tht R is equivlent to the prtil order of divides on {1, 2,, 4, under the mp {,,, d {1, 2, 4,. We know prtil orders re ll trnsitive. Otherwise, ompute the mtrix M R nd the mtrix 1 1 1 1 1 1 1 1 produt M R M R = 0 1 1 0 0 1 1 0 = 0 0 0 1 1 2 2 0 1 2 0 0 0 0 1 1 1 1 1 0 1 1 0 0 0 0 1. So the mtrix of R R is. Sine these mtries re the sme, R is trnsitive. (We need only hek tht for every 1 in the mtrix M R R, there is orresponding 1 in M R.) Alterntely, we n inspet the digrph to show tht for every pth of length 2, there is diret pth (of length 1) etween the orresponding verties.

i=1 () T F If R, S re oth reflexive reltions on set X, then R S is reflexive. T. Sine R nd S re oth reflexive, we hve x X, (xrx xsx). This is just the sme s x(r S)x, nd so R S is reflexive. () T F If R, S re oth prtil orders on set X, then R S is prtil order. F. For for exmple R is nd S is on the integers, then R S is just the reltion Z Z, whih is not prtil order (sine it is not ntisymmetri). (d) T F If R is prtil order on set X, then R 1 is lso prtil order. T. Chek: R 1 is reflexive sine xr 1 x is the sme s xrx, whih is lwys true sine R is reflexive. R 1 is ntisymmetri, sine if x, y X, then xr 1 y yr 1 x is the sme s yrx xry. Sine R is ntisymmetri, this implies y = x. Therefore, R 1 is ntisymmetri s well. We showed in Quiz 6, question 4, tht R trnsitive implies R 1 trnsitive. Thus R 1, sine it is reflexive, ntisymmetri, nd trnsitive, is prtil order. (e) T F Let f e funtion from the rel numers R to R, given y f(x) = x 2. Then f is ijetion. T. It inverse is f 1 (x) = 1 (x + 2). (f) T F Let g e funtion from the integers Z to Z, given y g(n) = n 2. Then g is ijetion. F. g is not onto, sine there is for exmple no integer n so tht g(n) = n 2 = 0. (The only rel solution is n = 2, whih is not n integer.) (g) T F Let the domin of disourse e the set of strings on the set X = {0, 1 of its. Then x y( xy = y ). T. x = λ the empty string works. (h) T F Let the domin of disourse e the set of strings on the set X from prt (g). Then x y( xy = y ). F. x = 0 is ounterexmple (note x = 1). Then xy = x + y = 1 + y is never equl to y. 10 (i) T F i 2 is even. (This one n e done without lultor.) F. The sum 1 2 + 2 2 + 2 + 4 2 + 5 2 + 6 2 + 7 2 + 8 2 + 9 2 + 10 2 is the sum of 5 odd numers nd 5 even numers, whih must e odd. (j) T F The reltion R from prt () is symmetri. F. For exmple, R ut R. 4

(k) T F There is n equivlene reltion on the lphet with extly 5 distint equivlene lsses. T. For exmple, onsider the equivlene reltion whose equivlene lsses onsist of {,,, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v nd {w, {x, {y, {z. (l) T F There is n equivlene reltion on the lphet with extly 0 distint equivlene lsses. F. The equivlene reltion must orrespond to prtition of the lphet, whih hs 26 letters. Sine elements of the prtition (whih re the equivlene lsses) re nonempty disjoint susets, there n e t most 26 distint equivlene lsses. 5