COMP 2804 Solutions Assignment 1

Similar documents
distinct distinct n k n k n! n n k k n 1 if k n, identical identical p j (k) p 0 if k > n n (k)

Jacobi symbols. p 1. Note: The Jacobi symbol does not necessarily distinguish between quadratic residues and nonresidues. That is, we could have ( a

Section 5.1 The Basics of Counting

Discrete Mathematics: Lectures 8 and 9 Principle of Inclusion and Exclusion Instructor: Arijit Bishnu Date: August 11 and 13, 2009

6.4 Binomial Coefficients

Math 4707 Spring 2018 (Darij Grinberg): midterm 2 page 1. Math 4707 Spring 2018 (Darij Grinberg): midterm 2 with solutions [preliminary version]

Homework 3. = k 1. Let S be a set of n elements, and let a, b, c be distinct elements of S. The number of k-subsets of S is

CSE 191, Class Note 05: Counting Methods Computer Sci & Eng Dept SUNY Buffalo

CS 70 Second Midterm 7 April NAME (1 pt): SID (1 pt): TA (1 pt): Name of Neighbor to your left (1 pt): Name of Neighbor to your right (1 pt):

Injections, Surjections, and the Pigeonhole Principle

f(1), and so, if f is continuous, f(x) = f(1)x.

42 Dependence and Bases

(ii) Two-permutations of {a, b, c}. Answer. (B) P (3, 3) = 3! (C) 3! = 6, and there are 6 items in (A). ... Answer.

Chapter 2. Asymptotic Notation

6.3 Testing Series With Positive Terms

MATH 324 Summer 2006 Elementary Number Theory Solutions to Assignment 2 Due: Thursday July 27, 2006

Putnam Training Exercise Counting, Probability, Pigeonhole Principle (Answers)

Teacher s Marking. Guide/Answers

Lecture Overview. 2 Permutations and Combinations. n(n 1) (n (k 1)) = n(n 1) (n k + 1) =

MA541 : Real Analysis. Tutorial and Practice Problems - 1 Hints and Solutions

Double Derangement Permutations

MATH10040 Chapter 4: Sets, Functions and Counting

ECE 901 Lecture 4: Estimation of Lipschitz smooth functions

and each factor on the right is clearly greater than 1. which is a contradiction, so n must be prime.

Math 155 (Lecture 3)

Let us consider the following problem to warm up towards a more general statement.

Math 475, Problem Set #12: Answers

Sequence A sequence is a function whose domain of definition is the set of natural numbers.

Bernoulli Polynomials Talks given at LSBU, October and November 2015 Tony Forbes

Intermediate Math Circles November 4, 2009 Counting II

3sin A 1 2sin B. 3π x is a solution. 1. If A and B are acute positive angles satisfying the equation 3sin A 2sin B 1 and 3sin 2A 2sin 2B 0, then A 2B

Find a formula for the exponential function whose graph is given , 1 2,16 1, 6

18th Bay Area Mathematical Olympiad. Problems and Solutions. February 23, 2016

Math 2112 Solutions Assignment 5

Infinite Sequences and Series

[ 47 ] then T ( m ) is true for all n a. 2. The greatest integer function : [ ] is defined by selling [ x]

X. Perturbation Theory

Chapter 6 Infinite Series

Exercises 1 Sets and functions

1.2 AXIOMATIC APPROACH TO PROBABILITY AND PROPERTIES OF PROBABILITY MEASURE 1.2 AXIOMATIC APPROACH TO PROBABILITY AND

sin(n) + 2 cos(2n) n 3/2 3 sin(n) 2cos(2n) n 3/2 a n =

UNIVERSITY OF NORTHERN COLORADO MATHEMATICS CONTEST. First Round For all Colorado Students Grades 7-12 November 3, 2007

18.S34 (FALL, 2007) GREATEST INTEGER PROBLEMS. n + n + 1 = 4n + 2.

MA131 - Analysis 1. Workbook 2 Sequences I

Combinatorics and Newton s theorem

10.5 Positive Term Series: Comparison Tests Contemporary Calculus 1

PARTIAL DIFFERENTIAL EQUATIONS SEPARATION OF VARIABLES

Solutions to Final Exam

Objective Mathematics

MA131 - Analysis 1. Workbook 3 Sequences II

Sequences I. Chapter Introduction

The Structure of Z p when p is Prime

USA Mathematical Talent Search Round 3 Solutions Year 27 Academic Year

Randomized Algorithms I, Spring 2018, Department of Computer Science, University of Helsinki Homework 1: Solutions (Discussed January 25, 2018)

Solutions. tan 2 θ(tan 2 θ + 1) = cot6 θ,

Books Recommended for Further Reading

GENERALIZATIONS OF ZECKENDORFS THEOREM. TilVIOTHY J. KELLER Student, Harvey Mudd College, Claremont, California

Al Lehnen Madison Area Technical College 10/5/2014

Permutations & Combinations. Dr Patrick Chan. Multiplication / Addition Principle Inclusion-Exclusion Principle Permutation / Combination

CS 336. of n 1 objects with order unimportant but repetition allowed.

2.4 Sequences, Sequences of Sets

On a Smarandache problem concerning the prime gaps

The Hypergeometric Coupon Collection Problem and its Dual

Langford s Problem. Moti Ben-Ari. Department of Science Teaching. Weizmann Institute of Science.

Math 4707 Spring 2018 (Darij Grinberg): homework set 4 page 1

Some Basic Counting Techniques

(A sequence also can be thought of as the list of function values attained for a function f :ℵ X, where f (n) = x n for n 1.) x 1 x N +k x N +4 x 3

HOMEWORK 2 SOLUTIONS

4.3 Growth Rates of Solutions to Recurrences

Seunghee Ye Ma 8: Week 5 Oct 28

1 (12 points) Red-Black trees and Red-Purple trees

University of Colorado Denver Dept. Math. & Stat. Sciences Applied Analysis Preliminary Exam 13 January 2012, 10:00 am 2:00 pm. Good luck!

19.1 The dictionary problem

3.1 Counting Principles

Statistics for Applications Fall Problem Set 7

Stream Ciphers (contd.) Debdeep Mukhopadhyay

Summer MA Lesson 13 Section 1.6, Section 1.7 (part 1)

SEQUENCE AND SERIES NCERT

Metric Dimension of Some Graphs under Join Operation

Math 113 Exam 3 Practice

A PROBABILITY PROBLEM

page Suppose that S 0, 1 1, 2.

Optimal Estimator for a Sample Set with Response Error. Ed Stanek

Binomial transform of products

Contents Two Sample t Tests Two Sample t Tests

Square-Congruence Modulo n

Lecture 10: Bounded Linear Operators and Orthogonality in Hilbert Spaces

Induction: Solutions

( ) GENERATING FUNCTIONS

REVIEW OF CALCULUS Herman J. Bierens Pennsylvania State University (January 28, 2004) x 2., or x 1. x j. ' ' n i'1 x i well.,y 2

Counting Well-Formed Parenthesizations Easily

Mathematical Preliminaries

Sequences A sequence of numbers is a function whose domain is the positive integers. We can see that the sequence

ARITHMETIC PROGRESSIONS

Introduction to Probability. Ariel Yadin. Lecture 2

CIS Spring 2018 (instructor Val Tannen)

Different kinds of Mathematical Induction

Sequences and Series of Functions

[ 11 ] z of degree 2 as both degree 2 each. The degree of a polynomial in n variables is the maximum of the degrees of its terms.

The Random Walk For Dummies

Transcription:

COMP 2804 Solutios Assiget 1 Questio 1: O the first page of your assiget, write your ae ad studet uber Solutio: Nae: Jaes Bod Studet uber: 007 Questio 2: I Tic-Tac-Toe, we are give a 3 3 grid, cosistig of uared cells Two players, Xavier ad Olivia, tae turs arig the cells of this grid Whe it is Xavier s tur, he chooses a uared cell ad ars it with the letter X Siilarly, whe it is Olivia s tur, she chooses a uared cell ad ars it with the letter O The first tur is by Xavier The players cotiue aig turs util all cells have bee ared Below, you see a exaple of a copletely ared grid O X X O X X X O O What is the uber of copletely ared grids? Justify your aswer What is the uber of differet ways (ie, ordered sequeces) i which the grid ca be copletely ared, whe followig the rules give above? Justify your aswer Solutio: For the first part, observe that the grid cosists of ie cells, ad that a copletely ared grid cotais five X s ad four O s To copletely ar a iitially epty grid, we have to choose five cells (out of ie); i the chose cells, we write X, whereas we write O i the reaiig four cells Therefore, the uber of copletely ared grids is equal to the uber of ways to choose five eleets out of ie Thus, the aswer is ( ) 9 5 For the secod part, we uber the cells arbitrarily 1, 2, 3,, 9 Ay sequece to ar all cells is othig but a perutatio of these ie itegers For exaple, the perutatio idicates the followig sequece of oves: Xavier writes X i cell 7, 7, 3, 4, 1, 9, 6, 8, 2, 5 1

Olivia writes O i cell 3, Xavier writes X i cell 4, Olivia writes O i cell 1, Xavier writes X i cell 9, Olivia writes O i cell 6, Xavier writes X i cell 8, Olivia writes X i cell 2, Xavier writes X i cell 5 Thus the aswer is 9! Questio 3: A password is a strig of 100 characters, where each character is a digit or a lowercase letter A password is called valid if it does ot start with abc, ad it does ot ed with xyz, ad it does ot start with 3456 Deterie the uber of valid passwords Justify your aswer Solutio: We defie the followig sets: U is the set of all strigs of 100 characters, where each character is a digit or a lowercase letter A is the set of all strigs i U that start with abc B is the set of all strigs i U that ed with xyz C is the set of all strigs i U that start with 3456 The questio ass for the value of A B C Usig De Morga ad the Copleet Rule, we get A B C = A B C = U A B C 2

To deterie the size of U, we observe that each strig i U cosists of 100 characters, ad for each character, there are 10 + 26 = 36 choices By the Product Rule, we have U = 36 100 To deterie the size of A, we observe that each strig i U cosists of 100 characters The first three characters are fixed, whereas for each of the reaiig 97 characters, there are 10 + 26 = 36 choices By the Product Rule, we have A = 36 97 By siilar reasoig, we have ad B = 36 97, C = 36 96, A B = 36 94, B C = 36 93 Sice A C = ad A B C =, we have A C = 0 ad A B C = 0 By the Priciple of Iclusio ad Exclusio, we have A B C = A + B + C A B A C B C + A B C We coclude that = 36 97 + 36 97 + 36 96 36 94 0 36 93 0 = 56 36 94 A B C = U A B C = 36 100 56 36 94 = 673 36 94 Questio 4: Let ad be itegers with 0 There are + 1 studets i Carleto s Coputer Sciece progra The Carleto Coputer Sciece Society has a Board of Directors, cosistig of oe presidet ad vice-presidets The presidet caot be vice-presidet Prove that ( ) ( ) + 1 ( + 1) = ( + 1 ), 3

by coutig, i two differet ways, the uber of ways to choose a Board of Directors Solutio: First way: First tas: Choose a presidet; there are + 1 ways to do this Secod tas: Choose vice-presidets Sice the presidet has already bee chose, there are are ( ) ways to do this By the Product Rule, the uber of ways to choose a Board of Directors is equal to Secod way: First tas: Choose vice-presidets; there are ( +1 ( ) ( + 1) (1) ) ways to do this Secod tas: Choose a presidet Sice the vice-presidets have already bee chose, there are are + 1 ways to do this By the Product Rule, the uber of ways to choose a Board of Directors is equal to ( ) + 1 ( + 1 ) (2) The values of (1) ad (2) ust be equal, because both of the cout the uber of ways to choose a Board of Directors Questio 5: Let ad be itegers with 2, ad cosider the set S = {1, 2, 3,, 2} A ordered sequece of eleets of S is called valid if this sequece is strictly icreasig, or this sequece is strictly decreasig, or this sequece cotais oly eve ubers (ad duplicate eleets are allowed) Deterie the uber of valid sequeces Justify your aswer Solutio: We defie the followig sets: A is the set of all ordered sequeces of eleets of S that are strictly icreasig B is the set of all ordered sequeces of eleets of S that are strictly decreasig C is the set of all ordered sequeces of eleets of S that cotai oly eve ubers 4

The questio ass for the value of A B C What is the size of A? Ay sequece of A correspods to a uique subset of S havig size Coversely, ay subset of S havig size correspods to a uique sequece i A It follows that ( ) 2 A = By the sae reasoig, we have B = ( ) 2 What is the size of C? Each sequece i C is a ordered sequece of leth, ad each eleet is a eve eleet of S Sice S cotais ay eve ubers, it follows that that there are choices for each eleet i ay such sequece It follows that C = We observe that A B =, because we assue that 2 This also iplies that A B C = Thus, A B = A B C = 0 What is the size of A C? Ay sequece of A C correspods to a uique subset of {2, 4, 6,, 2} havig size Coversely, ay subset of {2, 4, 6,, 2} havig size correspods to a uique sequece i A C It follows that ( ) A C = By the sae reasoig, we have B C = By the Priciple of Iclusio ad Exclusio, we have ( ) A B C = A + B + C A B A C B C + A B C ( ) ( ) ( ) ( ) 2 2 = + + 0 + 0 (( ) ( )) 2 = 2 + Questio 6: Let,, ad be itegers with 0, ad let S be a set of size Prove that ( )( ) ( )( ) =, 5

by coutig, i two differet ways, the uber of ordered pairs (A, B) with A S, B S, A B, A =, ad B = Solutio: First way: First tas: Choose a subset A of S Sice A has size, there are ( ) ways to do this Secod tas: Choose a subset B of S; this subset has size ad it ust cotai all eleets of A This is the sae as choosig a subset of S \ A (which has size ) of size There are ( ) ways to do this By the Product Rule, the uber of ordered pairs (A, B) with A S, B S, A B, A =, ad B = is equal to ( )( ) (3) Secod way: First tas: Choose a subset B of S Sice B has size, there are ( ) ways to do this Secod tas: Choose a subset A of S; this subset has size ad it ust be a subset of B There are ( ) ways to do this By the Product Rule, the uber of ordered pairs (A, B) with A S, B S, A B, A =, ad B = is equal to ( )( ) (4) The values of (3) ad (4) ust be equal, because both cout the uber of ordered pairs (A, B) with A S, B S, A B, A =, ad B = Questio 7: Let ad be itegers with 0 How ay bitstrigs of legth + 1 have exactly ay 1s? Let be a iteger with 0 What is the uber of bitstrigs of legth + 1 that have exactly ay 1s ad that start with } 1 {{ 1} 0? Use the above two results to prove that =0 ( ) = ( ) + 1 6

Solutio: We have see the aswer to the first part i class: ( ) + 1 For the secod part, we wat to cout bitstrigs havig legth + 1, that have exactly ay 1s, that start with } 1 {{ 1} 0 This eas that the first + 1 positios are fixed, ad of these positios cotai 1, i the last ( + 1) ( + 1) = positios, we have to place ay 1s This eas that we have to cout the bitstrigs of legth havig exactly ay 1s We ow fro class that the aswer is ( ) For the third part, we are goig to cout, i two differet ways, the bitstrigs of legth + 1 that have exactly ay 1s The first way is give by the first part of this questio: ( ) + 1 (5) For the secod way, we observe the followig: Each bitstrig of legth + 1 that has exactly ay 1s is of oe of the followig types: it starts with 0, ie, with } 1 {{ 1} 0 Fro the secod part, the uber of these is equal =0 to ( ) it starts with 10, ie, with } 1 {{ 1} 0 Fro the secod part, the uber of these is equal =1 to ( ) 1 1 7

it starts with 110, ie, with } 1 {{ 1} 0 Fro the secod part, the uber of these is =2 equal to ( ) 2 2 it starts with 1110, ie, with } 1 {{ 1} 0 Fro the secod part, the uber of these is =3 equal to ( ) 3 3 Etc, etc it starts with } 1 {{ 1} 0 Fro the secod part, the uber of these is equal to = ( ) If we add up the uber of bitstrigs of all these types, we see that the uber of bitstrigs of legth + 1 that have exactly ay 1s is equal to ( ) ( ) ( ) ( ) ( ) ( ) 1 2 3 + + + + + = (6) 1 2 3 Sice the values of (5) ad (6) are equal, because both cout the sae bitstrigs, we are doe Questio 8: Let ad be itegers with 0 Use Questios 4, 6, ad 7 to prove that ( ) ) = + 1 + 1 =0 ( =0 Solutio: Usig Questio 6, we get ( ) ( ) ( = ( =0 ) =0 ) I the latter su, the ter ( ) does ot deped o the suatio variable Thus, we ca tae it out of the suatio ad get ( ) ) = ( 1 ( ) ) =0 ( 8 =0

Usig Questio 7, this becoes ( ) ( ) = 1 ( ) + 1 ( =0 ) Fially, usig Questio 4, this becoes ( ) ) = + 1 + 1 =0 Questio 9: I this exercise, we cosider the sequece of itegers ( 3 0, 3 1, 3 2,, 3 1000 Prove that this sequece cotais two distict eleets whose differece is divisible by 1000 That is, prove that there exist two itegers ad with 0 < 1000, such that 3 3 is divisible by 1000 Hit: Cosider each eleet i the sequece odulo 1000 ad use the Pigeohole Priciple Use the first part to prove that this sequece cotais a eleet whose decial represetatio eds with 001 I other words, the last three digits i the decial represetatio are 001 Solutio: For the first part, cosider the sequece 3 0 od 1000, 3 1 od 1000, 3 2 od 1000,, 3 1000 od 1000 Each uber i this sequece is a iteger belogig to the set {0, 1, 2, 3,, 999}; this set has size 1000 Sice the sequece cosists of 1001 ubers, the Pigeohole Priciple tells us that there ust be at least two ubers i the sequece that are equal I other words, there exist two itegers ad with 0 < 1000, such that This eas that ie, 3 3 is divisible by 1000 3 od 1000 = 3 od 1000 (3 3 ) od 1000 = 0, For the secod part: I the first part, we have foud two itegers ad with 0 < 1000, such that 3 3 is divisible by 1000 Observe that 3 3 = 3 ( 3 1 ) 9

Thus, sice 3 3 is divisible by 1000, 3 ( 3 1 ) is divisible by 1000 Sice the greatest coo divisor of 3 ad 1000 is equal to 1, the uber 3 1 is divisible by 1000 Thus, there is a positive iteger such that 3 1 = 1000, ie, 3 = 1 + 1000 This eas that the last three digits i the decial represetatio of 3 are 001 10