浅谈nPr, nCr 及 nHr
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
淺談nPr, nCr及nHr
John NG P r
n
定義
nPr = n(n-1)(n-2)…(n-r+1) (這裡,n, r是正整數,其中n≥r)
即是由n開始,乘(n-1),再乘(n-2)如此類推共乘r個數。
可見上式最後一項是(n-r+1)。
應用
實際上nPr是n個人排一條r人隊的不同排列(permutation)方式的總數。
例如有四人:a,b,c,d;他們有以下不同的排列方式:
abcd abdc acbd acdb adbc adcb
bacd badc bcad bcda bdac bdca
cabd cadb cbad cbda cdab cdba
dabc dacb dbac dbca dcab dcba
共24種。
現在計數4P4 = 4⨯3⨯2⨯1 = 24。
為何兩個答案會吻合呢?
解釋
我們可以這樣想:
4人排4人隧,第一位(龍頭)可以站a,b,c或d四人,即有4種方式。
假設a站第一個位,第二位則只能是b,c或d其中一個站,即有3種方式;連同第一位的4種方式,共有4⨯3種方式;如此,第三位只有2種方式,連同第一、二位的4⨯3種方式,總共有4⨯3⨯2種方式;最後到第四位(龍尾),只剩下1種方式;故4人排4人隧共有4⨯3⨯2⨯1種方式;正是4P4了。
基本問題
Q1:列出5人排2人隧的所有方式,數一數共有多少種,看看是否等於5P2。
Q2:n P n等於n P(n-1)嗎?和n!有何關係?
Q3:用1,2,3,4四個數字可以組成多少個不同的4位數呢?
(請考慮可以重覆使用和不可重覆使用兩個情況)
Q4:用1,2,3,4,5,6,7,8,9,0十個數組成的十位數有多少個(數字不可重覆使用)?Q5:有10人排隊,其中有阿John和阿May;若阿John一定要排在阿May之後,請問總共可有多少種排列方式?
ANS: Q3. 重覆時:44不重覆時:4! Q4. 9⨯9! Q5. 9!
n C r
定義
n C r =
n r n r !
!()!
- (這裡n , r 是非負整數,其中n ≥ r )
應用
實際上n C r 是n 個人中抽出r 個人的組合(combination )方式的總數。
例如有五人:a ,b ,c ,d ,e ;當中抽出3人的組合:
abc abd abe acd ace ade bcd bce bde cde
只有10種。
組合和排列不同,組合是“不計次序”的,例如abc ,acb ,bac ,bca ,cab ,cba 只算為同一種組合方式,卻是六種不同的排列方式。
現在計算5C 3 =
5353!
!()!
- = 10。
為何兩個答案會吻合呢?
解釋
我們可以這樣想:
如上所述,一個組合方式,例如abc ,其實對應著六個排列方式,即把a ,b ,c 3人排3人隊的排法,共3P 3 = 3! 種。
一般地,n 人抽出r 人,每一個組合,也對應著r P r = r ! 種排列方法。
現在假設n 人抽出r 人的抽法(組合方式)共有N 種,因每種組合對應 r ! 種排列,故共N ⨯r ! 種排列。
但n 人排r 人隊的排列法
共有n P r 種,所以 N ⨯r ! = n P r => N =
n
r P r n n n r r !()...()
!
=
--+11 故 N = n C r 。
實例
一.右圖共可數出多少個長方形呢?
要組成長方形,只需在7條垂直線中抽出2條(共7C 2),每對這樣的垂直線
再配兩條水平線,即要在5條水平線中抽出2條(共5C 2)故共可配出7C 2⨯5C 2= 21⨯10 = 210個長方形。
=--+---⨯⨯---⨯⨯=
-n n n r n r n r r n r n r n r n r ()...()()()...!()()...!!()!
111321132
1
二.証明 n C r + n C r -1 = n +1C r 當然可以用n C r 的定義來証(very easy!),但我想用組合數的概念去証。
想想n +1C r 的意義是從n +1人中抽出r 人的組合數目;假設阿John 是n +1人中的一個,被抽出的r 人只能有以下兩種情況:(一)包括阿John 及(二)不包括阿John 。
第一種情況,因包括John ,餘下的r -1人便要從n 人中抽出,抽法有n C r -1種。
第二種情況不包括John , 即被抽出的那r 人只能從n 人中抽出,抽法有n C r ; 故此, n +1C r = n C r + n C r -1。
三.証明 (1 + x )n =n r
r r n
C x =∑
明顯地,LHS 拆開後必成一degree 為n 的polynomial ,故可以假設
(1 + x )n
=
a x
r r
r n
=∑0
,其中a r 是常數。
現在即是要証明 a r = n C r 。
現在想像
(1 + x )n = (1 + x )(1 + x )…(1 + x ) 是n 個箱。
展開(expand )後考慮某一項,例如 a r x r ,即展開後有a r 個x r 存在,但如何得到x r 呢?只要在n 個“箱”中抽出r 個x ;其餘的1便在餘下的n - r 個箱中抽出;在n 個“箱”中抽出r 個x 的組合方
式共有n C r 種,即有n C r 個x r ,亦即是說:a r = n C r 。
四.有一枚銀,擲出“公”的機會是0.3,若擲該銀5次,得3個“字”的機會
是多少? 其中一個可能結果是TTTHH ,考慮2個H 的位置,它們佔有5個位的其中2個位置,即從5個位中抽出2個給H “座”,共有5C 2=10個可能性,而每個機會發生的概率是 (0.3)3(1-0.3)2 = 0.01323 ,所以要求的概率 = 10⨯0.01323 = 0.1323。
五.若set A 有n 個elements ,那麼power set of A 有多少個elements ? Power set of A 有多少個elements 即是問A 有多少個subsets 。
0個element 的subset (在A 中抽0個element )有n C 0 個; 1個element 的subset (在A 中抽1個element )有n C 1 個; 2個element 的subset (在A 中抽2個element )有n C 2 個; …
n 個element 的subset (在A 中抽n 個element )有n C n 個。
故A 共有n C 0+n C 1+n C 2+ … + n C n 個subsets ,利用binomial theorem , 易知這總和為2n 。
六.以下是5張撲克牌某些特別組合(例如同花順、蛇等)出現的機會,最好
自行找出答案後才看正確答案。
Probabilities in Poker
Probabilities of drawing
Below are the probabilities of drawing the following hands, without discarding: Hand Exact Probability Approximate Probability
--------------- ---------------------- -----------------------------
Royal Flush: 4 in 2,598,960 1 in 649,740
Straight Flush: 36 in 2,598,960 1 in 72,193
Four of a Kind: 624 in 2,598,960 1 in 4,165
Full House: 3,744 in 2,598,960 1 in 694
Flush: 5,108 in 2,598,960 1 in 509
Straight: 10,200 in 2,598,960 1 in 255
Three of a Kind: 54,912 in 2,598,960 1 in 47
Two Pair: 123,552 in 2,598,960 1 in 21
One Pair: 1,098,240 in 2,598,960 1 in 2.4
Nothing: 1,302,540 in 2,598,960 1 in 2.0
Derivations
The number of ways to arrange 5 cards out of 52 is = 2,598,960.
Royal Flush
The number of different royal flushes are four (one for each suit).
Straight Flush
The highest card in a straight flush can be 5,6,7,8,9,10,Jack,Queen, or King. Thus there are 9 possible high cards, and 4 possible suits, creating 9 ⨯ 4 = 36 different possible straight flushes.
Four of a Kind
There are 13 different possible ranks of the 4 of a kind. The fifth card could be anything of the remaining 48. Thus there are 13 ⨯ 48 = 624 different four of a kinds.
Full House
There are 13 different possible ranks for the three of a kind, and 12 left for the two of a kind. There are 4 ways to arrange three cards of one rank (4 different cards to leave
out), and = 6 ways to arrange two cards of one rank. Thus there are 13 ⨯ 12 ⨯ 4
⨯ 6 = 3,744 ways to create a full house.
Flush
There are 4 suits to choose from and = 1,287 ways to arrange five cards in the
same suit. Then subtract the royal and straight flushes to avoid double counting. The total number of flushes is 4 ⨯ 1,287 - 4 - 36 = 5,108.
Straight
The highest card in a straight flush can be 5,6,7,8,9,10,Jack,Queen,King, or Ace. Thus there are 10 possible high cards. Each card may be of four different suits. Then subtract the royal and straight flushes to avoid double counting. Thus the number of ways to arrange a straight is 10 ⨯ 45- 4 - 36 = 10,200.
Three of a Kind
There are 13 ranks to choose from for the three of a kind and 4 ways to arrange 3
cards among the four to choose from. There are = 66 ways to arrange the
other two ranks to choose from for the other two cards. In each of the two ranks there are four cards to choose from. Thus the number of ways to arrange a three of a kind is 13 ⨯ 4 ⨯ 66 ⨯ 42 = 54,912.
Two Pair
There are = 78 ways to arrange the two ranks represented. In both ranks there
are = 6 ways to arrange two cards. There are 44 cards left for the fifth card.
Thus there are 78 ⨯ 62 ⨯ 44 = 56,784 ways to arrange a three of a kind.
One Pair
There are 13 ranks to choose from for the pair and = 6 ways to arrange the two
cards in the pair. There are = 220 ways to arrange the other three ranks of the
singletons, and four cards to choose from in each rank. Thus there are 13 ⨯ 6 ⨯ 220 ⨯43 = 1,098,240 ways to arrange a pair.
Nothing
There must be five different ranks represented, of which there are = 1,287
possible combinations. Each rank has four cards to choose from. Finally subtract the number of straights, flushes, straight flushes, and royal flushes, to avoid double counting. Thus the number of ways to arrange nothing is 1,287 ⨯ 45 - 4 - 36 - 5,108 - 10,200 = 1,302,540.
基本問題
Q1:列出5人抽出2人的所有組合方式,數一數共有多少種,看看是否等於5C 2。
Q2:在平面上給定25個點,其中任意3點都不是在同一直線上,過兩點可作
一條直線,過3點可作一個三角形;問這樣的直線和三角形各有多少?
Q3:用20條直徑把一個圓平均分為40份,共可有多少個“正常扇形”(即頂
角為銳角的扇形)。
Q4:利用組合概念証明以下結果:
⎪⎪⎭⎫ ⎝⎛+=⎪⎪⎭⎫ ⎝⎛⎪⎪⎭⎫ ⎝⎛++⎪⎪⎭⎫ ⎝⎛-⎪⎪⎭⎫ ⎝⎛+⎪⎪⎭⎫ ⎝⎛-⎪⎪⎭⎫ ⎝⎛+⎪⎪⎭⎫ ⎝⎛⎪⎪⎭⎫ ⎝⎛r n m n r m r n m r n m r n m 0...22110 其中m , n , r 為自然數並r ≤ min(m ,n )。
Q5:如下圖,由A 點出發往B 點,在每個交點位(junction )只能選擇向上或
向右行,那麼由A 點往B 點的路線共有多少條?(下圖顯示了其中一條)
Q6:有n 個除了顏色外完全相同的球,其中n 1個是紅色,n 2個藍色,n 3個黃色,
n 4個是綠色;其中n 1+ n 2+ n 3+ n 4= n 。
現把這n 個球排成一直線,試用組合
的概念證明共有!!!!!
4321n n n n n 種排列方式。
Q7:把4個人a,b,c 及d 分成2組,組合方式可以如下: {ab, cd} {ac, bd} {ad, bc} 共有3種。
現問,若把20人分成5組,問有多少 種組合方式?
ANS: Q2. 300, 2300 Q3. 760
Q5. 10C 4
Q7.
5
)!4(!5!
20
n H r
(這是out of syllabus 的,有時間及興趣的話可作參考)
定義
n H r = ⎪⎪⎭⎫ ⎝⎛--+11n r n 或 ⎪⎪⎭
⎫ ⎝⎛-+r r n 1(這裡n , r 是非負整數) 注:這裡的n 可以小於r ,如2H 3 = 4C 1 = 4
用n H r 可算數什麼?例如在a, b, c 中“抽出”5個字母,有多少組合方式?為什麼被抽出的數目大於可被抽出的數目呢?因為字母可重覆使用,如 aaabc, bbcaa 等。
答案就是3H 5 = 7C 2 = 21種。
如何証明“在n 件不同的可重覆使用的物件中
抽出r 件的組合數目就是⎪⎪⎭
⎫
⎝⎛--+11n r n ”?解說:
考慮在a, b, c 中抽出5個字母,如aaabc, bbcaa, 把這些events 和一個座標對應:
可見events 的數目就是coordinates 的數目,而coordinates 的數目就是問 x 1 + x 2 + x 3 = 5 這個equation 有多少個非負整數解 (Non-negative integral solutions)。
如何數算非負整數解的數目呢? 可以考慮5 (= r ) 塊石頭:
o o o o o
利用2 (= n - 1) 枝竹簽分它們分成3 (= n ) 份,例如
o o o |o |o
這就對應著 (3,1,1) 這個解,又例如
o o o ||o o
就是對應著 (3,0,2) 這個解了。
所以總共有多少個非負整數解就是把2枝竹簽放在6 (= r + 1) 個位置的放法數目。
是26 嗎?非也,這只是2個不同的物件放在6個位置的放法數目,現在2枝竹簽是一樣的,如何避免重覆數算的情況?只要我們避免出現在同一位置放2枝人簽便可,怎樣可以?只要找尋的是大於零的整數解:沒有0作為其中一個coordinate ,即沒有2枝竹簽在同一個位置;要得這個情況,我們只要把equation x 1 + x 2 + x 3 = 5改變為 (x 1 + 1) + (x 1 + 1) + (x 1 + 1) = 5 + 3 => y 1 + y 2 + y 3 = 8,故此這個equation 的大於零整數解數目,就是原本equation 的非負整數解的數目。
要求出y 1 + y 2 + y 3 = 8的大於零整數解數目,我們可以類似地用分石頭的方法去數算:考慮8 (= n + r ) 塊石頭, o o o o o o o o
只要把2 (= r - 1)枝竹簽放在8塊石頭之間的7 (= n + r - 1)個位置,例如 o o o | o o o o | o
代表 (y 1,y 2,y 3) = (3,4,1) 對應著 (x 1,x 2,x 3) = (2,3,0),而有多少個 (y 1,y 2,y 3) 就是把
2 (= n- 1)技竹簽放在7 (= n + r- 1) 個位置的放法數,而每個位置只能放一枝,總共有多少?就是在7個位抽出2個位放,即是7C2。
所以一般地,n個可重覆使用的物件抽出r個,抽法有n+r-1C n-1,定義它為n H r是也!當然以上的“proof”不是唯一,同學們可自行想出其他方法處理。
OK?
承上例,現在列出7C2 = 21種情況如下:
(0,0,5) (1,0,4) (2,0,3) (3,0,2) (4,0,1) (5,0,0) (0,1,4) (1,1,3) (2,1,2) (3,1,1) (4,1,0)
(0,2,3) (1,2,2) (2,2,1) (3,2,0)
(0,3,2) (1,3,1) (2,3,0)
(0,4,1) (1,4,0)
(0,5,0)
基本問題
Q1:How many terms are there when expanding (x1 + x2+ … + x m)n and grouping like terms, where m, n are natural numbers.
Q2:To throw 6 fair dice, find the probability that obtaining sum of points = 18.
ANS:Q1. m H n Q2. Yourself.。