User Tools

Site Tools


b:head_first_statistics:permutation_and_combination

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
b:head_first_statistics:permutation_and_combination [2020/10/15 19:37] – [What if horse order doesn’t matter] hkimscilb:head_first_statistics:permutation_and_combination [2025/10/01 08:36] (current) – [exercises] hkimscil
Line 3: Line 3:
 ====== Permutation ====== ====== Permutation ======
  
-세마리 말이 들어오는 순서+세마리 말이 들어오는 순서의 경우의 수
 {{:b:head_first_statistics:pasted:20191015-073815.png}} {{:b:head_first_statistics:pasted:20191015-073815.png}}
 ===== So what if there are n horses? ===== ===== So what if there are n horses? =====
Line 72: Line 72:
 b, a2, a1 b, a2, a1
  
-n! p! q! +$$ \frac {n!} {p! q!} $$
  
 +<BOOKMARK:arranging_group>
 {{:b:head_first_statistics:pasted:20191015-075959.png}} {{:b:head_first_statistics:pasted:20191015-075959.png}}
 +
 6 horses 6 horses
 2 groups 3 horses per each group 2 groups 3 horses per each group
Line 95: Line 96:
  
 <WRAP box> <WRAP box>
-__<fc #ff0000><fs xx-large>Q:</fs></fc>__ The Statsville Derby have decided to experiment with their races. They've decided to hold a race between 3 horses, 2 zebras and 5 camels, where all the animals are equally likely to finish the race first.+X = {a a b c c c} 라면? 
 +n(X) = 6 이므로 총 6!  
 +a가 둘, c가 셋으로 묶이므로 
 +6! / (2! * 3!) 
 += 6*5*2 = 60 
 + 
 + 
 +</WRAP> 
 + 
 +<WRAP box> 
 +__<fc #ff0000><fs xx-large>Q:</fs></fc>__ The Statsville Derby have decided to experiment with their races. They've decided to hold a race between <fc #ff0000>3 horses, 2 zebras and 5 camels</fc>, where all the animals are equally likely to finish the race first.
  
 1. How many ways are there of finishing the race if we’re interested in individual animals? 1. How many ways are there of finishing the race if we’re interested in individual animals?
Line 125: Line 136:
 20 horses 20 horses
 {{:b:head_first_statistics:pasted:20191015-082956.png}} {{:b:head_first_statistics:pasted:20191015-082956.png}}
 +
  
 <code> <code>
Line 144: Line 156:
  
 {{:b:head_first_statistics:pasted:20191015-083059.png}} {{:b:head_first_statistics:pasted:20191015-083059.png}}
 +$ {}{}_{n}\mathrm{P}_{r} $ 
  
 ===== What if horse order doesn’t matter ===== ===== What if horse order doesn’t matter =====
Line 160: Line 173:
 \end{eqnarray*} \end{eqnarray*}
  
 +Among the two, the order doesn't matter. Then, we follow the same logic as [[#arranging_group|the above]]
 2 representatives 2 representatives
 A B | B A A B | B A
Line 167: Line 180:
  
 \begin{eqnarray*} \begin{eqnarray*}
-_{3}C_{2} * 2! & = & _{3}P_{2} \\ +\text{Answer we want} & = & \frac {_{3}P_{2}}{2!} \\ 
-_{3}C_{2} & = & \frac {_{3}P_{2}}{2!} \\+\text{We call this} & = &  _{3}C_{2}  \\
 _{3}C_{2} & = & \frac {\frac{3!}{(3-2)!}} {\frac {2!} {1}} \\ _{3}C_{2} & = & \frac {\frac{3!}{(3-2)!}} {\frac {2!} {1}} \\
 _{3}C_{2} & = & \frac {3!}{2! * (3-2)!} = 3 _{3}C_{2} & = & \frac {3!}{2! * (3-2)!} = 3
Line 189: Line 202:
 {{:b:head_first_statistics:pasted:20191015-084051.png}} {{:b:head_first_statistics:pasted:20191015-084051.png}}
  
-$\displaystyle {^{n} P_{r}$ +\begin{eqnarray*
-$\displaystyle ^{n} P_{r} = \displaystyle \frac {n!} {(n-r)!}$ +\displaystyle ^{n} P_{r} = \displaystyle \dfrac {n!} {(n-r)!} \\ 
-A permutation is the number of ways in which you can choose objects from a pool, and where the order in which you choose them counts. It’s a lot more specific than a combination as you want to count the number of ways in which you fill each position.+\end{eqnarray*}
  
 +A **permutation** is the number of ways in which you can choose objects from a pool, and **where the order in which you choose them counts**. It’s a lot more specific than a combination as you want to count the number of ways in which you fill each position.
  
-$\displaystyle ^{n} C_{r}+\begin{eqnarray*} 
-$\displaystyle ^{n} C_{r} = \displaystyle \frac {n!} {r! \cdot (n-r)!}$ +\displaystyle ^{n} C_{r} & = & \displaystyle \dfrac {^{n} P_{r}} {r!} \\ 
-A combination is the number of ways in which you can choose objects from a pool, without caring about the exact order in which you choose them. It’s a lot more general than a permutation as you don’t need to know how each position has been filled. It’s enough to know which objects have been chosen.+\displaystyle \frac {n!} {r! \cdot (n-r)!} \\ 
 +\end{eqnarray*} 
 +**combination** is the number of ways in which you can choose objects from a pool, **without caring about the exact order in which you choose them**. It’s a lot more general than a permutation as you don’t need to know how each position has been filled. It’s enough to know which objects have been chosen.
  
 ===== e.g. ===== ===== e.g. =====
Line 206: Line 222:
 2. The coach classes 3 of the players as expert shooters. What’s the probability that all 3 of these players will be on the court at the same time, if they’re chosen at random? 2. The coach classes 3 of the players as expert shooters. What’s the probability that all 3 of these players will be on the court at the same time, if they’re chosen at random?
 </WRAP> </WRAP>
 +
 +<WRAP box>
 +$ {}_{52} P _{5} $
 +<code>
 +# only combination function is available in r, choose
 +# for permutation
 +> choose(52,5)
 +[1] 2598960
 +> permute <- function(n,r) { 
 +>   choose(n,r) * factorial(r) 
 +> }
 +> permute(52, 5)
 +> [1] 311875200
 +> # or 
 +> factorial(52)/factorial(52-5)
 +[1] 311875200
 +
 +</code>
 +</WRAP>
 +답. 12명 중에서 순서는 상관없는 5명이므로 
 +${}_{12} C _{5} $
 <code> <code>
 ## n! / r!(n-r)! ## n! / r!(n-r)!
Line 217: Line 254:
  
 b b
-b/a 
 </code> </code>
 <code> <code>
Line 230: Line 266:
 > b > b
 [1] 36 [1] 36
-> b/a 
-[1] 0.04545455 
  
 </code> </code>
Line 244: Line 278:
 A flush is where all 5 cards belong to the same suit. What’s the probability of getting this? A flush is where all 5 cards belong to the same suit. What’s the probability of getting this?
 </WRAP> </WRAP>
 +{{https://upload.wikimedia.org/wikipedia/commons/thumb/0/02/Piatnikcards.jpg/1920px-Piatnikcards.jpg?800}} 
 +see [[wp>List_of_poker_hands]] 
 +{{https://upload.wikimedia.org/wikipedia/commons/thumb/e/e2/A_studio_image_of_a_hand_of_playing_cards._MOD_45148377.jpg/1024px-A_studio_image_of_a_hand_of_playing_cards._MOD_45148377.jpg?400}}
 <code> <code>
 ## 52장의 카드 중에서 5장 고를 조합은 ## 52장의 카드 중에서 5장 고를 조합은
 factorial(52)/(factorial(5)*factorial(52-5)) factorial(52)/(factorial(5)*factorial(52-5))
-all <- factorial(52)/(factorial(5)*factorial(52-5))+all2 <- factorial(52)/(factorial(5)*factorial(52-5)) 
 +all2 
 +# or  
 +all <- choose(52, 5) 
 +all
 ## royal flush = 10, 11, 12, 13, 1 각 문양 ## royal flush = 10, 11, 12, 13, 1 각 문양
 ## 즉, 4가지. 따라서 전체 조합 중 4가지만 해당됨 ## 즉, 4가지. 따라서 전체 조합 중 4가지만 해당됨
Line 299: Line 339:
 </code> </code>
  
 +===== exercises =====
 +말 3마리, 얼룩말 4마리, 그리고 낙타 6마리 중에서 낙타 4마리와 얼룩말 3마리를 뽑아서 일렬로 앉히는 경우의 수를 구하시오. 
 +<code>
 +> # 6C4 * 4C3 * 7!
 +> choose(6,4) * choose(4,3) * factorial(4+3)
 +[1] 311875200
 +
 +</code>
  
 +tennessee 를 서로 다른 방법으로 배치할 수 있는 경우의 수는?
 +<code>
 +> # t
 +> # eeee
 +> # nn
 +> # ss
 +> # 9 letters
 +> # 9!/4!*2!*2!
 +> factorial(9)/(factorial(4)*factorial(2)*factorial(2))
 +[1] 3780
 +
 +</code>
 +
 +AGAIN이라는 단어가 있다. 이 단어를 알파벳 순으로 조합하여 나열한다면 49번째 오는 단어는 어떤 것일까?
 +
 +처음 A 로 시작하게 되는 단어는 G A I N 의 단어를 조합하여 나오는 수 4! = 24 단어
 +다음에는 G 로 시작하는 단어 A A I N 의 단어의 조합은 4!/2! = 12 단어
 +I 로 시작하는 단어는 A G A N 의 조합은 4!/2! = 12 단어
 +그렇다면 N으로 시작하는 첫단어가 답
 +N A A G I 
 +
 +S M I L E 이라는 단어의 문자에서 3 개를 뽑아서 나열하는 경우의 수는?
 +
 +$ _{5}P_{3} = \dfrac {5!}{2!} = 60 $
 +
 +AJOU UNIVERSITY 단어에서 AJOU 네 단어가 서로 이웃해서 모든 단어가 나열되는 경우의 수는?
 +X U N I V E R S I  T  Y
 +1 2 3 4 5 6 7 8 9 10 11
 +11 글자의 조합은 11! / 2!
 +A J O U 의 조합도 신경을 써야 하므로 4! 을 곱해준다.
 +
 +POWERFUL 라는 단어의 글자들을 나열하려고 한다. 모음이 앞이나 뒤에 적어도 한번은 들어가도록 나열하는 경우의 수는? W는 자음
 +이다.
 +모 . . . . 모
 +모 . . . . 자
 +자 . . . . 모
 +자 . . . . 자
 +의 경우라고 생각해야 할 듯 
 +모음은 O E U 
 +자음은 P W R F L 
 +전체 글자는 8 글자   8!
 +양쪽에 자음이 오는 경우는 5P2 = 20
 +
 +
 +\begin{eqnarray*}
 +{n \choose x} \\
 +\binom{n}{r} \\
 +_{n}C_{r} \\
 +^{n}P_{r} \\
 +_{n}P_{r} \\
 +
 +\end{eqnarray*}
b/head_first_statistics/permutation_and_combination.1602758239.txt.gz · Last modified: by hkimscil

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki