錯排【數學】【排列】【容斥原理】

來源:互聯網
上載者:User

標籤:數學   錯排   排列   

今天整理數論的模板發現了錯排的公式,推導有點忘記了,查了資料搞明白了。

已知錯排的公式為:

 D(n) =  n ! ( 1 -   1 / 1 !   +   1 / 2 !   -   1 / 3 !   +   ...  +  ( - 1 ) ^ n / n ! )

          =  ( n - 1 ) ( D ( n - 2 )   -   D ( n - 1 ) )  

下面是根據容斥得到答案的過程:

設1,2,...,n的全排列t1,t2,...,tn的集合為I,而使ti=i的全排列的集合記為Ai(1<=i<=n)。

Ai=(n - 1)! 

則Dn=| I | - | A1 ∪ A2 ∪ ... ∪ An |.

        所以Dn = n! - | A1 ∪ A2 ∪ .. . ∪ An |.  注意到 | Ai | = ( n - 1 ) !   ,    | Ai ∩ Aj | = ( n - 2 ) !  ,   ...   ,   | A1 ∩ A2 ∩ ... ∩ An | = 0 ! = 1.  由容斥原理:        
        

則: | A1 ∪ A2 ∪ ... ∪ An | =  C ( n , 1 ) ( n - 1 ) ! - C ( n , 2 ) ( n - 2 ) ! + C ( n , 3 ) ( n - 3 ) ! - . . . - ( - 1 ) ^ n C ( n , n ) * 0 ! 
  Dn = n ! - | A1 ∪ A2 ∪ ... ∪ An | = n ! - C ( n , 1 ) ( n - 1 ) ! + C ( n , 2 ) ( n - 2 ) ! - C ( n , 3 ) ( n - 3 ) ! + . . . + ( - 1 ) ^ n C ( n , n ) * 0 !    = n ! ( 1 - 1 / 1 ! + 1 / 2 ! - 1 / 3 ! + . . . + ( - 1 ) ^ n * 1 / n ! )    = ( n - 1 ) ( D ( n - 2 ) - D ( n - 1 ) )證明完畢。下面給出前面幾組錯排的數值:

D(1) = 0       

D(2) = 1     

D(3) = 2

D(4) = 9       

D(5)= 44       

D(6) = 265

D(7) = 1854     

D(8)= 14833    

D(9) = 133496

D(10) = 1334961



錯排【數學】【排列】【容斥原理】

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.