permutation and combination
definition
Formula P refers to arrangement, and R elements are selected from N elements for arrangement (i.e. sorting). P is an old usage, and now a is often used in textbooks.
Formula C refers to combination, in which R elements are taken from N elements without arrangement (that is, without sorting).
sign
C combination number
P permutation number
Total number of n elements
R- the number of elements participating in the selection
! -factorial, like 5! =5*4*3*2* 1= 120
C combination
P permutation
history
In 1772, Vandermonde uses [n]p to represent the arrangement number of n different elements at a time. Euler used 177 1 and 1778 to represent the number of combinations of p elements extracted from n different elements. In 1872, Etienne Shawson introduced the meaning of "expressing the same", and the symbol of combination has been used to this day.
In 1830, Peacock introduced the symbol Cr to indicate the number of combinations of R elements taken from N elements at a time; 1869 or earlier, Goodwin of Cambridge used the symbol nPr to indicate the arrangement number of R elements taken out of N elements at a time, and this usage has continued to this day. According to this method, nPn is equivalent to the current n! .
In 1880, Potts expresses the number of combinations and permutations of R from n elements by nCr and nPr respectively. Six years later, whitworth expressed the same idea, and he also expressed the number of repeatable combinations. At 1899, Crystal uses nPr and nCr to represent the permutation and combination number of R non-repeating elements extracted from N different elements at one time, and nHr to represent the repeatable permutation number in the same sense. These three symbols are still widely used today.
1904, Neto wrote a phrase for an encyclopedia dictionary to express the above nPr and nCr, which was also adopted. These symbols are also used in modern times.
Parity check of combination number
For the combination number c (n, k) (n >; =k): Convert n and k into binary respectively. If n corresponding to a binary bit is 0 and k is 1, then c (n, k) is an even number; Otherwise, it's strange.
The method for judging the parity of combination numbers is as follows:
Conclusion:
For C(n, k), if n &;; If k == k, then c(n, k) is odd, otherwise it is even.
Prove:
Use mathematical induction:
C (n,k) = c (n,k- 1)+c (n- 1,k- 1);
Corresponding to Yang Hui Triangle:
1
1 2 1
1 3 3 1
1 4 6 4 1
………………
It can be verified that the previous layer and k = 0 satisfy the conclusion. It is proved that if the conclusion is satisfied in C (n- 1, k) and C(n- 1, k- 1) (k >: 0),
C(n, k) satisfies the conclusion.
1). Let C(n- 1, k) and C(n- 1, k- 1) be odd numbers:
Have: (n-1)&; k = = k
(n- 1); (k- 1)= = k- 1;
Since the last bit of k and k- 1 (where the bit refers to a binary bit, the same below) must be different, the last bit of n- 1 must be 1.
Now suppose n &;; k == k .
Then the last bit of k is 1, because the last bit of n- 1 is different.
Because the last bit of n- 1 is 1, the last bit of n& is 0; k! = k, which contradicts the hypothesis.
So get w-; k! = k .
2). Suppose that C(n- 1, k) and C(n- 1, k- 1) are even numbers:
Have: (n-1)&; k! = k;
(n- 1); (k- 1)! = k- 1;
Now suppose n &;; k == k。
Then for the case that the last bit of k is 1:
At this time, the last bit of n is also 1, so there is (n-1)&; (k- 1) == k- 1, which contradicts the hypothesis.
And for the case where the last bit of k is 0:
Then there must be a part at the end of k: 10; Represents any 0.
Accordingly, the corresponding part of n is:1{*} *; * stands for 0 or 1.
And if only one of the {*} * corresponding to n is 1, then (n-1)&; K == k holds, then the corresponding part of n should also be 10.
Then correspondingly, the last parts of k- 1 and n- 1 are both 0 1, so (n-1)&; (k- 1) == k- 1 holds, which contradicts the hypothesis.
So get w-; k! = k .
From 1) and 2), when C(n, k) is even, n &;; k! = k .
3). Suppose that C(n- 1, k) is odd and C(n- 1, k- 1) is even:
Have: (n-1)&; k = = k
(n- 1); (k- 1)! = k- 1;
Obviously, the last digit of k can only be 0, otherwise it is (n-1)&; (n- 1) can be expressed by k = = k &;; (k- 1) == k- 1 .
So there must be a part at the end of k: 10;
Accordingly, the corresponding part of n- 1 is:1{*} *;
Accordingly, the corresponding part of k- 1 is 01;
Make (n-1)&; (k- 1)! = k- 1 requires at least one of the corresponding {*} * of n- 1 to be 0.
So the corresponding part of n is:1{*} *; (Will not change 1 to 0 due to carry)
So w-; k = k .
4). Suppose that C(n- 1, k) is even and C(n- 1, k- 1) is odd:
Have: (n-1)&; k! = k;
(n- 1); (k- 1)= = k- 1;
There are two situations:
When the last bit of k- 1 is 0:
Then there must be a part at the end of k- 1: 10;
Accordingly, the corresponding part of k is:11;
Accordingly, the corresponding part of n- 1 is:1{*} 0; (If 1{*} 1, (n-1)&; k == k)
Accordingly, the corresponding part of n is1{*}1;
So w-; k = k .
When the last bit of k- 1 is 1:
Then there must be a part at the end of k- 1: 0 1; (A leading 0 can be appended)
Correspondingly, the corresponding part of k is:10;
Accordingly, the corresponding part of n- 1 is 01; (If it is 1 1, then (n-1)&; k == k)
Correspondingly, the corresponding part of n is:10;
So w-; k = k .
3) and 4) show that when C(n, k) is odd, n &;; k = k .
To sum up, the conclusion proves!