1. Trang chủ
  2. » Tất cả

Chapter 6 counting

72 1 0
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Tiêu đề Counting
Tác giả Huynh Tuong Nguyen, Tran Vinh Tan
Trường học University of Technology - VNUHCM
Chuyên ngành Computer Science and Engineering
Thể loại Chương
Năm xuất bản 2011
Thành phố Ho Chi Minh City
Định dạng
Số trang 72
Dung lượng 563,44 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Counting Counting Huynh Tuong Nguyen, Tran Vinh Tan 6 1 Chapter 6 Counting Discrete Structures for Computing on 25 April 2011 Huynh Tuong Nguyen, Tran Vinh Tan Faculty of Computer Science and Engineer[.]

Trang 1

Huynh Tuong Nguyen, Tran Vinh Tan

Chapter 6

Counting

Discrete Structures for Computing on 25 April 2011

Huynh Tuong Nguyen, Tran Vinh TanFaculty of Computer Science and Engineering

University of Technology - VNUHCM

Trang 2

Huynh Tuong Nguyen, Tran Vinh Tan

Contents

Trang 4

Huynh Tuong Nguyen, Tran Vinh Tan

Introduction

Example

Trang 5

Huynh Tuong Nguyen, Tran Vinh Tan

Trang 6

Huynh Tuong Nguyen, Tran Vinh Tan

Problems

brute force attack

Trang 7

Huynh Tuong Nguyen, Tran Vinh Tan

Problems

brute force attack

Trang 8

Huynh Tuong Nguyen, Tran Vinh Tan

Problems

brute force attack

Trang 9

ports How many different ports in the center?

Solution

There are two tasks to choose a port:

Because there are 32 ways to choose the router and 24 ways tochoose the port no matter which router has been selected, thenumber of ports are 32 × 24 = 768 ports

Definition (Product Rule (Luật nhân))

two tasks If there are n1ways to do the first task and for each of

Can be extended to T1, T2, , Tmtasks in sequence

Trang 10

ports How many different ports in the center?

Solution

There are two tasks to choose a port:

Because there are 32 ways to choose the router and 24 ways to

choose the port no matter which router has been selected, the

number of ports are 32 × 24 = 768 ports

Definition (Product Rule (Luật nhân))

two tasks If there are n1ways to do the first task and for each of

Can be extended to T1, T2, , Tmtasks in sequence

Trang 11

ports How many different ports in the center?

Solution

There are two tasks to choose a port:

Because there are 32 ways to choose the router and 24 ways to

choose the port no matter which router has been selected, the

number of ports are 32 × 24 = 768 ports

Definition (Product Rule (Luật nhân))

two tasks If there are n1ways to do the first task and for each of

Can be extended to T1, T2, , Tmtasks in sequence

Trang 12

Huynh Tuong Nguyen, Tran Vinh Tan

Product Rule

Example

ports How many different ports in the center?

Solution

There are two tasks to choose a port:

Because there are 32 ways to choose the router and 24 ways to

choose the port no matter which router has been selected, the

number of ports are 32 × 24 = 768 ports

Definition (Product Rule (Luật nhân))

Trang 13

Two new students arrive at the dorm and there are 12 rooms

two students?

Example (2)How many different bit strings of length seven are there?

Example (3)How many one-to-one functions are there from a set with melements to one with n elements?

Trang 14

Two new students arrive at the dorm and there are 12 rooms

two students?

Example (2)

How many different bit strings of length seven are there?

Example (3)How many one-to-one functions are there from a set with melements to one with n elements?

Trang 15

Huynh Tuong Nguyen, Tran Vinh Tan

More examples

Example (1)

Two new students arrive at the dorm and there are 12 rooms

two students?

Example (2)

How many different bit strings of length seven are there?

Example (3)

How many one-to-one functions are there from a set with m

elements to one with n elements?

Trang 16

A student can choose a project from one of three fields:

Information system (32 projects), Software Engineering (12

projects) and Computer Science (15 projects) How many ways are

there for a student to choose?

Solution: 32 + 12 + 15Definition (Sum Rule (Luật cộng))

set of n2 ways, then there aren1+ n2 ways to do the task

Can be extended to n1, n2, , nmdisjoint ways

Trang 17

A student can choose a project from one of three fields:

Information system (32 projects), Software Engineering (12

projects) and Computer Science (15 projects) How many ways are

there for a student to choose?

Solution: 32 + 12 + 15

Definition (Sum Rule (Luật cộng))

set of n2 ways, then there aren1+ n2 ways to do the task

Can be extended to n1, n2, , nmdisjoint ways

Trang 18

A student can choose a project from one of three fields:

Information system (32 projects), Software Engineering (12

projects) and Computer Science (15 projects) How many ways are

there for a student to choose?

Solution: 32 + 12 + 15

Definition (Sum Rule (Luật cộng))

set of n2 ways, then there aren1+ n2 ways to do the task

Can be extended to n1, n2, , nmdisjoint ways

Trang 19

Huynh Tuong Nguyen, Tran Vinh Tan

Sum Rule

Example

A student can choose a project from one of three fields:

Information system (32 projects), Software Engineering (12

projects) and Computer Science (15 projects) How many ways are

there for a student to choose?

Solution: 32 + 12 + 15

Definition (Sum Rule (Luật cộng))

set of n2 ways, then there aren1+ n2 ways to do the task

Can be extended to n1, n2, , nmdisjoint ways

Trang 20

or two alphanumeric characters, where uppercase and lowercase

begin with a letter and must bedifferent fromthe five strings of

two characters that are reserved for programming use How many

different variables names are there in this language?

Solution

Let V equal to the number of different variable names

the number of these that are two characters long Then, by sumrule, V = V1+ V2

are 26 · 36 strings of length two that begin with a letter and endwith an alphanumeric character However, five of these are

different names for variables in this language

Trang 21

Huynh Tuong Nguyen, Tran Vinh Tan

Using Both Rules

Example

or two alphanumeric characters, where uppercase and lowercase

begin with a letter and must bedifferent fromthe five strings of

two characters that are reserved for programming use How many

different variables names are there in this language?

Solution

Let V equal to the number of different variable names

the number of these that are two characters long Then, by sum

rule, V = V1+ V2

are 26 · 36 strings of length two that begin with a letter and end

with an alphanumeric character However, five of these are

different names for variables in this language

Trang 22

ways

Trang 23

ways

Trang 24

ways

Trang 25

ways

Trang 26

ways

Trang 27

Huynh Tuong Nguyen, Tran Vinh Tan

Inclusion-Exclusion

Example

Solution

ways

Trang 30

Huynh Tuong Nguyen, Tran Vinh Tan

Inclusion-Exclusion

|A ∪ B| = |A| + |B| − |A ∩ B|

Trang 34

Huynh Tuong Nguyen, Tran Vinh Tan

Inclusion-Exclusion

|A ∪ B ∪ C| =???

Trang 35

Huynh Tuong Nguyen, Tran Vinh Tan

Example

onlyArsenal,10liked onlyChelsea,12liked onlyMUand40liked

all three clubs How many of the student surveyed likedboth MU

andChelseabut notArsenal?

Trang 36

Huynh Tuong Nguyen, Tran Vinh Tan

Pigeonhole Principle

Trang 37

thesame birthday.

Because there are only 366 possible birthdays

Example (2)

Because there are 26 letters in the English alphabet

Trang 38

thesame birthday.

Because there are only 366 possible birthdays

Example (2)

Because there are 26 letters in the English alphabet

Trang 39

thesame birthday.

Because there are only 366 possible birthdays

Example (2)

Because there are 26 letters in the English alphabet

Trang 40

Huynh Tuong Nguyen, Tran Vinh Tan

Examples

Example (1)

thesame birthday

Because there are only 366 possible birthdays

Example (2)

Because there are 26 letters in the English alphabet

Trang 41

Huynh Tuong Nguyen, Tran Vinh Tan

Examples

Example (1)

thesame birthday

Because there are only 366 possible birthdays

Example (2)

Because there are 26 letters in the English alphabet

Trang 42

Prove that if seven distinct numbers are selected from

{1, 2, , 11}, then some two of these numbers sum to 12

Solution

{3, 9}, {4, 8}, {5, 7}, {6}

pigeonhole corresponding to the set that contains it

placed in six pigeonholes, some pigeonhole contains twonumbers

Trang 43

Prove that if seven distinct numbers are selected from

{1, 2, , 11}, then some two of these numbers sum to 12

Solution

{3, 9}, {4, 8}, {5, 7}, {6}

pigeonhole corresponding to the set that contains it

placed in six pigeonholes, some pigeonhole contains twonumbers

Trang 44

Prove that if seven distinct numbers are selected from

{1, 2, , 11}, then some two of these numbers sum to 12

Solution

{3, 9}, {4, 8}, {5, 7}, {6}

pigeonhole corresponding to the set that contains it

placed in six pigeonholes, some pigeonhole contains twonumbers

Trang 45

Prove that if seven distinct numbers are selected from

{1, 2, , 11}, then some two of these numbers sum to 12

Solution

{3, 9}, {4, 8}, {5, 7}, {6}

pigeonhole corresponding to the set that contains it

placed in six pigeonholes, some pigeonhole contains twonumbers

Trang 46

Huynh Tuong Nguyen, Tran Vinh Tan

Exercise

Example

Prove that if seven distinct numbers are selected from

{1, 2, , 11}, then some two of these numbers sum to 12

Solution

{3, 9}, {4, 8}, {5, 7}, {6}

pigeonhole corresponding to the set that contains it

placed in six pigeonholes, some pigeonhole contains two

Trang 49

Huynh Tuong Nguyen, Tran Vinh Tan

Examples – Permutations

How many ways can we arrange three students to stand in line for

a picture?

Number of choices: 6 = 3!

Trang 50

Apermutation(hoán vị) of a set of distinct objects is anordered

arrangementof these objects

An ordered arrangement of r elements of a set is called an

r-permutation (hoán vị chập r)

(n − r)!

Example

second-prizewinner, and athird-prizewinner from 100 differentpeople who have entered a contest?

P (100, 3) = 100 · 99 · 98 = 970, 200

Trang 51

Apermutation(hoán vị) of a set of distinct objects is anordered

arrangementof these objects

An ordered arrangement of r elements of a set is called an

r-permutation (hoán vị chập r)

(n − r)!

Example

second-prizewinner, and athird-prizewinner from 100 different

people who have entered a contest?

P (100, 3) = 100 · 99 · 98 = 970, 200

Trang 52

Huynh Tuong Nguyen, Tran Vinh Tan

Permutations

Definition

Apermutation(hoán vị) of a set of distinct objects is anordered

arrangementof these objects

An ordered arrangement of r elements of a set is called an

r-permutation (hoán vị chập r)

(n − r)!

Example

second-prizewinner, and athird-prizewinner from 100 different

people who have entered a contest?

Trang 55

Huynh Tuong Nguyen, Tran Vinh Tan

Examples – Combinations

How many ways to choose two students from a group of four to

offer scholarship?

Number of choices: 6

Trang 56

Anr-combination(tổ hợp chập r) of elements of a set is an

unordered selectionof r elements from the set Thus, an

r-combination is simply a subset of the set with r elements

Trang 57

Anr-combination(tổ hợp chập r) of elements of a set is an

unordered selectionof r elements from the set Thus, an

r-combination is simply a subset of the set with r elements

How many ways are there to select eleven players from a

22-member football team to start up?

Trang 58

Huynh Tuong Nguyen, Tran Vinh Tan

Combinations

Definition (Combinations)

Anr-combination(tổ hợp chập r) of elements of a set is an

unordered selectionof r elements from the set Thus, an

r-combination is simply a subset of the set with r elements

How many ways are there to select eleven players from a

22-member football team to start up?

22!

Trang 59

Huynh Tuong Nguyen, Tran Vinh Tan

Exercises – Permutations with Repetition

must begin her trip in a specified city, but she can visit the

other seven cities in any order she wishes How many possible

orders can the salesman use when visiting these cities?

and 11 in CE department How many ways are there to select

a defend committee if the committee is to consist of three

faculty members from the CS and four from the CE

department?

Trang 62

Huynh Tuong Nguyen, Tran Vinh Tan

Permutations with Repetition

Trang 63

Huynh Tuong Nguyen, Tran Vinh Tan

Example

Question: How many ways we can choose3 students fromthe

facultiesof Computer Science, Electrical Engineering and

Mechanical Engineering?

Trang 64

Huynh Tuong Nguyen, Tran Vinh Tan

Trang 66

Huynh Tuong Nguyen, Tran Vinh Tan

Trang 67

There are C(n + r − 1, r) r-combinations from a set with n

elements when repetition of elements is allowed

ExampleHow many solutions does the equation

x1+ x2+ x3= 11have, where x1, x2, and x3are nonnegative integers?

Trang 68

Huynh Tuong Nguyen, Tran Vinh Tan

Combinations with Repetition

Theorem

There are C(n + r − 1, r) r-combinations from a set with n

elements when repetition of elements is allowed

Example

How many solutions does the equation

x1+ x2+ x3= 11have, where x1, x2, and x3are nonnegative integers?

Trang 69

Huynh Tuong Nguyen, Tran Vinh Tan

Examples

Question: How many permutations are there ofMISSISSIPPI?

Trang 70

Huynh Tuong Nguyen, Tran Vinh Tan

Examples

Question: How many permutations are there ofMISSISSIPPI?

Trang 71

The number of different permutations of n objects, where there

are n1indistinguishable objects of type 1, n2 indistinguishable

objects of type 2, , and nkindistinguishable objects of type k, is

n!

n1!n2! · · · nk!

ExampleHow many permutations are there of MISSISSIPPI?

Trang 72

Huynh Tuong Nguyen, Tran Vinh Tan

Permutations with Indistinguishable Objects

Theorem

The number of different permutations of n objects, where there

are n1indistinguishable objects of type 1, n2 indistinguishable

objects of type 2, , and nkindistinguishable objects of type k, is

Ngày đăng: 02/04/2023, 06:12

TỪ KHÓA LIÊN QUAN