History: Two special cases of the "error envelope problem" called "a wonderful problem of combinatorial number theory" by the famous mathematician Euler (1707- 1783).
The problem of "misplaced envelopes" was raised by Daniel Bernoulli, the son of the most famous mathematician at that time (1700-1782). The main ideas are as follows:
A person wrote n different letters, corresponding to n different envelopes. He put all these n letters in the wrong envelope. How many ways can you put them in the wrong envelope?
Formula:
Recursive formula: Let the arrangement of N substances be s(n).
When n= 1, s(n)=0.
When n=2, s(n)= 1.
Otherwise s (n) = (n-1) * (s (n-1)+s (n-2))
Factorial formula: n! -C( 1 n)*(n- 1)! +C(2 n)! -…+(- 1)^kC(k n)*(n-k)! +…+(- 1)^n*C(n n)*0!
The above formula is equivalent to n! ( 1- 1/ 1! + 1/2! - 1/3! +...+(- 1)^n* 1/n! )
________________________
For this question:
S( 1)=0,S(2)= 1
S(3)=2(0+ 1)=2
S(4)=3(2+ 1)=9
If the number of questions is small, it can also be listed directly: suppose the order of the four students is (A, B, C, D),
(B,A,D,C) (B,C,D,A) (B,D,A,C)
(C,A,D,B) (C,D,A,B) (C,D,B,A)
(D,A,B,C) (D,C,A,B) (D,C,B,A)
The above 9 kinds.