๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

๐“ก๐“ธ๐“ธ๐“ถ5: ๐’ฆ๐‘œ๐“‡๐‘’๐’ถ ๐’ฐ๐“ƒ๐’พ๐“‹/Discrete mathematics

[์ด์‚ฐ์ˆ˜ํ•™] Chapter 6. Counting methods and the pigeonhole principle

1. Basic Principles

  - Menu for Quick Lunch : ์ ์‹ฌ ๋ฉ”๋‰ด๋ฅผ ๊ณ ๋ฅด๋Š” ๊ฒฝ์šฐ์˜ ์ˆ˜

  1) Multiplication Principle(๊ณฑ์…ˆ๋ฒ•์น™)

     : k๊ฐœ์˜ ์—ฐ์†์ ์ธ ํ–‰๋™์ด ์žˆ์„ ๋•Œ, ์ด ํ–‰๋™์„ ์ˆ˜ํ–‰ํ•˜๋Š” ๊ฒฝ์šฐ์˜ ์ˆ˜๋Š” n1n2...nk

 

     ex) 8 bit string ์—์„œ 101์ด๋‚˜ 111๋กœ ์‹œ์ž‘ํ•˜๋Š” ๊ฒƒ์˜ ๊ฐœ์ˆ˜ : 2^5 * 2

  2) Addition Principle (๋ง์…ˆ๋ฒ•์น™)

  nj๊ฐœ์˜ elements๋ฅผ ๊ฐ€์ง€๊ณ  ์žˆ๋Š” k๊ฐœ์˜ pairwise disjoint sets๊ฐ€ ์žˆ์„ ๋•Œ, ์ด sets์˜ ๊ฒฐํ•ฉ X = ∪Xj ๋Š” n1 + n2+...+ nk์˜ elements๋ฅผ ๊ฐ€์ง„๋‹ค.

 

2. Permutations and Combinations (์ˆœ์—ด๊ณผ ์กฐํ•ฉ)

  1) Permutation : ์ˆœ์—ด (n!)

     r-permutation of n distinct elements๋Š” n๊ฐœ์˜ ์š”์†Œ์ค‘์— r๊ฐœ์˜ element๋ฅผ ๋ฐฐ์—ดํ•˜๋Š” ๊ฒฝ์šฐ์˜ ์ˆ˜ ( P(n,r) )

  2) Combination : ์กฐํ•ฉ ( C(n,r) = P(n,r) / r! = n!/(n-r)!r! )

 

3. Generalized Permutations and Combinations

  1) ์ค‘๋ณต๋œ ๊ฒƒ์ด ์žˆ๋Š” ์ˆœ์—ด : n! / n1!n2! ... nt!

  2) ์ค‘๋ณต ์กฐํ•ฉ H(n,r) = C(n+r-1, n-1) = C(n+r-1, r) 

 

 * Lexicographic order 

 : ๋‘ ๋ฌธ์ž์—ด α = s1s2... sp, β = t1t2...tq ๊ฐ€ ์žˆ์„ ๋•Œ,

   p<q์ด๊ณ  ๋ชจ๋“  i์— ๋Œ€ํ•ด si = ti์ด๊ฑฐ๋‚˜, ์–ด๋–ค i์— ๋Œ€ํ•ด์„œ si < ti ์ด๋ฉด α<β ์ด๋‹ค. 

ex) α = 1324, β = 1332, γ = 132์ด๋ฉด γ < α, α < β ์ด๋‹ค.

 

* Algorithm

  1) R-combination

    - set {X1, ..., Xn} ์—์„œ s1<s2<... ์ด๊ณ ,  ์ฃผ์–ด์ง„ ์ˆซ์ž s์— ๋Œ€ํ•ด ๋‹ค์Œ r-combination t๋ฅผ ๊ตฌํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š”?

 - max๊ฐ€ ์•„๋‹Œ  element sm์— ๋Œ€ํ•ด์„œ tm = sm +1, tm+1 =  sm+2 ... until tr

//Pseudo code

Combination(r, n){
  for i=1 to r, si = i;
  print(s1, ..., sr);
  
  for i=2 to C(n,r){
    m = r;
    max_val = n;
    
    while(sm == max_val) {
      m = m - 1;
      max_val = max_val -1 
    }
    
    sm = sm + 1;
    
    for j = m+1 to r
      sj = sj-1 +1;
      
    print(s1, ..., sr);
    }
  }

 

 

 2) Permutation 

function perm(n, S){
  //print first perm
  print(S);
   for(i=2; i<factorial(n); i++){
   
     print('===Iteration');
     
     m=n-1;
     
     while( S(m) > S(m+1) )
       m = m-1;
        
     print('index of right most digit that is less than its right');
     print(m);
     
     k=n;
     
     while(S(m) > S(k))
       k=k-1;
         
     print('index of right most digit that is greater than pivot');
     print(k);
     
     //swap sm and sk
     tmp = S(k);
     S(k) = S(m);
     S(m) = tmp;
     
     p=m+1;
     q = n;
     
     while(p<q){
       tmp = S(q);
       S(q) = S(p);
       S(p) = tmp;
       p++; q--;
     }
     
     print(S);
 }

 

 

4. Introduction to Discrete Probability

 - experiment : process that yields an outcome (์ˆ˜ํ–‰)

 - event : outcome or a set of outcomes from an experiment (์‚ฌ๊ฑด)

 - sample space : event of all possible outcomes (ํ‘œ๋ณธ๊ณต๊ฐ„)

 

 - probability : ํ™•๋ฅ  : E / S (Event, Sample space)

 

 

5. Discrete Probability Theory 

  - n๊ฐœ์˜ ๊ฐ€๋Šฅํ•œ ๊ฒฐ๊ณผ๊ฐ€ ์žˆ์„ ๋•Œ, ์ด ๊ฒฐ๊ณผ๋“ค์ด ์™„์ „ํžˆ ๊ฐ™๊ฒŒ ๋‚˜์˜จ๋‹ค๋ฉด, ๊ฐ๊ฐ์€ 1/n์˜ ํ™•๋ฅ ์„ ๊ฐ–๋Š”๋‹ค.

  - ๋งŒ์•ฝ ๊ฐ ํ™•๋ฅ ์ด ๊ฐ™์ง€ ์•Š๋‹ค๋ฉด..? 

 

  1) Probabiity Function 

   : Sample space S์•ˆ์—์„œ outcome x์˜ ๊ฐ’๊ณผ ๋Œ€์‘๋˜๋Š” ํ™•๋ฅ  p

    0<=P(x) <=1, ∑P(x) = 1 

 

  2) Probability of an Event 

  : ์–ด๋–ค event๋ฅผ ๋งŒ์กฑํ•˜๋Š” outcome๋“ค์ด ๋‚˜์˜ฌ ํ™•๋ฅ ์˜ ํ•ฉ

 

* ์—ฌ์‚ฌ๊ฑด

 

  3) Mutually Exclusive Events : ๋ฐฐ๋ฐ˜์‚ฌ๊ฑด (๊ต์ง‘ํ•ฉ์ด ๊ณต์ง‘ํ•ฉ)

 

  4) Conditional Probability : ์กฐ๊ฑด๋ถ€ ํ™•๋ฅ 

  - Independent Events : ๋…๋ฆฝ์‚ฌ๊ฑด

     -> P(E|F) = P(E) : ์‚ฌ๊ฑด E๋Š” ์‚ฌ๊ฑด F๊ฐ€ ์ผ์–ด๋‚˜๋‚˜ ์ผ์–ด๋‚˜์ง€ ์•Š๋‚˜ ํ™•๋ฅ ์ด ๊ฐ™๋‹ค. ์ฆ‰ E๋Š” ์‚ฌ๊ฑด F์™€ ๋…๋ฆฝ์‚ฌ๊ฑด์ด๋‹ค.

     -> E์™€ F๊ฐ€ ๋…๋ฆฝ์‚ฌ๊ฑด์ด๋ฉด, P(E ∩ F) = P(E)P(F)

 

 

6. Pattern recognition 

  : items์„ ์—ฌ๋Ÿฌ๊ฐ€์ง€ ํŠน์ง•์„ ๊ธฐ๋ฐ˜์œผ๋กœ class๋ฅผ ๋‚˜๋ˆˆ๋‹ค. 

   - feature F์˜ ์ง‘ํ•ฉ์ด ์ฃผ์–ด์กŒ์„ ๋•Œ, F๋ฅผ ๊ฐ€์ง€๊ณ  ์žˆ์„ ๋•Œ class C์ผ ํ™•๋ฅ ์€ F: P(C|F) ๋กœ ๊ณ„์‚ฐํ•  ์ˆ˜ ์žˆ๋‹ค.

   - item์€ ๊ฐ€์žฅ probable ํ•œ class ์— ๋ฐฐ์ •ํ•œ๋‹ค. ์ฆ‰, P(C|F)๊ฐ€ ๊ฐ€์žฅ ํฐ class์— ํ• ๋‹นํ•œ๋‹ค.

 

 

7. Bayes' Theorem : ๋ฒ ์ด์ฆˆ ์ •๋ฆฌ

  : ๊ฐ๊ฐ pairwise disjoint classes C1, ... Cn์ด ์žˆ๊ณ , feature set F๊ฐ€ ์žˆ์„ ๋•Œ, 

 

8. The pigeonhole Principle

  : n๊ฐœ์˜ pigeons๊ฐ€ k๊ฐœ์˜ pigeonholes๋กœ ๋‚ ์•„๋“ค์–ด๊ฐˆ ๋•Œ (k<n), ์–ด๋–ค pigeonhole์€ ๋ฌด์กฐ๊ฑด ๋‘ ๊ฐœ ์ด์ƒ์˜ pigeons์„ ํฌํ•จํ•˜๊ณ  ์žˆ๋‹ค.

 

  1) Combinatorial Identities and Combinatorial Argument

    - Combinatorial Identity : ์–ด๋–ค counting process๋กœ๋ถ€ํ„ฐ ๋‚˜์˜ค๋Š” results

    - Combinatorial Argument : ๊ทธ๊ฒƒ์˜ formulation์ด ์ด๋Œ์–ด๋‚ด๋Š” argument