Suppose there is a deck of $n$ cards, each card is numbered from $1$ to $n$. Suppose a card numbered $m$ is in the correct position of it is the $m$th card in the deck. How many ways can the cards be shuffled with at least 1 card being in the correct position?
So I know there are $n!$ ways of organizing a deck of cards with $n$ cards. What I can't figure out is how to get the number of ways were at least 1 card is correct.
$n!$ is the number of ways where there are no restrictions
$(n-1)!$ is the number of ways where we assume that 1 card is in a fixed position
so $n! - (n-1)!$ would be the number of ways of ordering $n$ cards where 1 card isn't in the correct position?
If someone could explain how to solve this I would be very grateful.
There are $n!$ possible ways without restriction.
Derangement is a permutation of the elements of a set, such that no element appears in its original position.
Hence we just have to remove the derangement.
The number of derangement is denoted by $!n$, hence the answer would be $n!-!n$.
It is known that $$!n = \lfloor \frac{n!}{e}+\frac12 \rfloor$$
Hence the answer is $$n! - \lfloor \frac{n!}{e}+\frac12 \rfloor.$$