b:head_first_statistics:permutation_and_combination
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
b:head_first_statistics:permutation_and_combination [2025/10/01 00:51] – [exercises] hkimscil | b:head_first_statistics:permutation_and_combination [2025/10/01 08:36] (current) – [exercises] hkimscil | ||
---|---|---|---|
Line 3: | Line 3: | ||
====== Permutation ====== | ====== Permutation ====== | ||
- | 세마리 말이 들어오는 순서 | + | 세마리 말이 들어오는 순서의 경우의 수 |
{{: | {{: | ||
===== So what if there are n horses? ===== | ===== So what if there are n horses? ===== | ||
Line 136: | Line 136: | ||
20 horses | 20 horses | ||
{{: | {{: | ||
+ | |||
< | < | ||
Line 155: | Line 156: | ||
{{: | {{: | ||
+ | $ {}{}_{n}\mathrm{P}_{r} $ | ||
===== What if horse order doesn’t matter ===== | ===== What if horse order doesn’t matter ===== | ||
Line 200: | Line 202: | ||
{{: | {{: | ||
- | $\displaystyle | + | \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 |
- | 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*} | ||
+ | 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. | ||
===== e.g. ===== | ===== e.g. ===== | ||
Line 219: | Line 224: | ||
<WRAP box> | <WRAP box> | ||
+ | $ {}_{52} P _{5} $ | ||
< | < | ||
# only combination function is available in r, choose | # only combination function is available in r, choose | ||
Line 224: | Line 230: | ||
> choose(52, | > choose(52, | ||
[1] 2598960 | [1] 2598960 | ||
- | > perm <- function(n, | + | > permute |
- | > perm(52, 5) | + | > choose(n,r) * factorial(r) |
+ | > } | ||
+ | > permute(52, 5) | ||
> [1] 311875200 | > [1] 311875200 | ||
+ | > # or | ||
+ | > factorial(52)/ | ||
+ | [1] 311875200 | ||
+ | > | ||
</ | </ | ||
</ | </ | ||
- | + | 답. 12명 중에서 순서는 상관없는 5명이므로 | |
+ | ${}_{12} C _{5} $ | ||
< | < | ||
## n! / r!(n-r)! | ## n! / r!(n-r)! | ||
Line 242: | Line 254: | ||
a | a | ||
b | b | ||
- | b/a | ||
</ | </ | ||
< | < | ||
Line 255: | Line 266: | ||
> b | > b | ||
[1] 36 | [1] 36 | ||
- | > b/a | ||
- | [1] 0.04545455 | ||
> | > | ||
</ | </ | ||
Line 334: | Line 343: | ||
< | < | ||
> # 6C4 * 4C3 * 7! | > # 6C4 * 4C3 * 7! | ||
- | > choose(6,4) * choose(4,3) * (4+3) | + | > choose(6,4) * choose(4,3) * factorial(4+3) |
- | [1] 420 | + | [1] 311875200 |
> | > | ||
</ | </ | ||
Line 370: | Line 379: | ||
A J O U 의 조합도 신경을 써야 하므로 4! 을 곱해준다. | A J O U 의 조합도 신경을 써야 하므로 4! 을 곱해준다. | ||
+ | POWERFUL 라는 단어의 글자들을 나열하려고 한다. 모음이 앞이나 뒤에 적어도 한번은 들어가도록 나열하는 경우의 수는? W는 자음 | ||
+ | 이다. | ||
+ | 모 . . . . 모 | ||
+ | 모 . . . . 자 | ||
+ | 자 . . . . 모 | ||
+ | 자 . . . . 자 | ||
+ | 의 경우라고 생각해야 할 듯 | ||
+ | 모음은 O E U | ||
+ | 자음은 P W R F L | ||
+ | 전체 글자는 8 글자 | ||
+ | 양쪽에 자음이 오는 경우는 5P2 = 20 | ||
b/head_first_statistics/permutation_and_combination.1759247507.txt.gz · Last modified: by hkimscil