離散數學
南台科技大學
資工系
蕭天泉
• 某人想由 A 地到 B 地,搭乘火車有 3 類車種可
選擇,搭乘汽車有 2 類車種可選擇。搭乘火
車或汽車由 A 地到 B 地有多少種方式可選擇?
• 3 + 2 = 5
• If a first task can be performed in m ways, while a second task can be performed in n ways, and the two tasks cannot be performed simultaneously, then performing either task can be accomplished in any one of m + n ways.
• 一餐廳點主菜附加甜點及飲料,有 4 種甜點
及 5 種飲料可供挑選 ( 只能各挑一種 ) ,有多
少種挑選甜點及飲料的方式?
• 4*5=20
• If a procedure can be broken down into first and second stages, and if there are m possible outcomes for the first stage and if, for each of these outcomes, there are n possible outcomes for the second stage, then the total procedure can be carried out, in the designated order, in mn ways.
練習題
• 身份證編號 A 1 2 3 4 5 6 7 8 9
身份字號之格式 a b n n n n n n n c
– 第一個符號 a : 大寫英文字母 A~Z ( 代表地區 )
– 第二個符號 b : 1 ( 男 ) 或 2 ( 女 )
– 第三個符號 n : 0 ~ 9
– 第四個符號 c :檢查數字 ( 由前 9 個符號決定 )
• 此種编碼方式,可編的人數最多是多少?
• Ans:
26x2x10x10x10x10x10x10x10=520,000,000
排列 (Permutations) 與
組合 ( Combinations)
• Definition of factorial ( 階乘之定義 )
– For an integer n ≧ 0, n factorial (denoted n!) is defined by
0!= 1, n!= (n)(n-1)(n2) ···(3)(2)(1), for n ≧ 1.
• 5!=
5x4x3x2x1=120
• 1!=1
• 0!=1
• n!=nx(n-1)! 5!=5(4!)=5x24=120
排列 (Permutation)
線狀排列
• P(n, r) = n(n-1)(n-2)···(n-r +1) n ≧ r ≧ 1
= n(n-1)(n2) ···(n-r+1 )(n-r)(n-r1)···1/(n-r)(n-r-1)···1
= n!/(n-r)!
從n個相異的物件中,取 r 個來排列 ( 每次取 1 個,
取後不放回 )
If there are n distinct objects and r is an integer, with n ≧ r ≧ 1, then by the rule of product, the number of permutations of size r for n objects is
P(n,r).
例題
1.一個有10位成員的俱樂部,每次挑3位來拍照;共
有多少種拍照方式?
Ans : P(10, 3) =10x9x8=720=10!/(10-3)!
2. 一個有10位成員的俱樂部,從中任挑3位作為主
席、秘書長及出納;共有多少種選擇方式?
Ans : P(10, 3) =10x9x8=720=10!/(10-3)!
• In a class of 10 students, five are to be chosen and seated in a row for a picture. How many such linear arrangements are possible?
– The key word here is arrangement, which designates the importance of order.
– Ans: 10x9x8x7x6=10!/5!
• The number of permutations of the letters in the word COMPUTER is
8!
• If only five of the letters are used, the number of permutations (of size 5) is
P(8, 5)
• Unlike Example 1.10, the number of (linear) arrangements of the four letters in BALL is
12, not 4!(= 24).
The arrangements of the four letters in
BALL is 4!/2! = 12.
• If there are n objects with n
1 indistinguishable objects of a first type, n
2 indistinguishable objects of a second type, …, and n r indistinguishable objects of an r th type, where n
1
+ n
2
+…+ n r
= n , then there are (linear) n
1
!
n
2
!
n r
!
arrangements of the given n objects.
• Determine the number of (staircase) paths in the xy-plane from (2, 1) to (7, 4), where each such path is made up of individual steps going one unit to the right (R) or one unit upward (U).
• Ans: Upward: 7- 2 = 5
Right: 4 -1 = 3
UUUUURRRR 8!/(5!3!)
環狀排列
• If 3 people, designated as a, b, c, are seated about a round table, how many different circular arrangements are possible, if arrangements are considered the same when one can be obtained from the other by rotation?
• a, b, c 三個物件的排列 (linear arrangements) 數目為 3! = 6
• abc cab bca acb bac cba
環狀排列 b a c c b a a c b c a b b c a a b c
Ans: 3!/3 = 2
習題
1. List all the permutations for the letters a, c, t.
(1.1, 1.2 #12)
2. Evaluate each of the following.
(1.1, 1.2 #14) c) P(10,7) d) P(12,3)
3. a) How many arrangements are there of all the letters in SOCIOLOGICAL?
(1.1, 1.2 #21) b) In how many of the arrangements in part (a) are A and G adjacent?
c) In how many of the arrangements in part (a) are all the vowels adjacent?
習題
4. Show that for all integers n, r ≧ 0, if n + 1 > r, then
(1.1, 1.2 #24) p ( n
1 , r )
n n
1
1
r p ( n , r )
習題
5. Find the value(s) of n in each of the following:
(1.1, 1.2 #25)
(a) P(n,2) = 90
(b) P(n,3) = 3P(n,2)
(c) 2P(n,2) + 50 = P(2n,2)