1
$\begingroup$

I'm not sure if I'm doing it right.

So stick one in its original place, we can have:

$(3^3-3*2^3+3*1^3) * 3 = 18$ arrangements

  • 0
    They are they permutations which are not derangements, so there are in fact $4! - !4 = 15$2017-02-13

2 Answers 2

1

Just find the amount of derangements we have. Or you can just brute-force casework:

If exactly one is in the correct position ($4$ ways to assign) there are $2$ ways to assign the last three so that they're all in the wrong places so that $8.$

If two are in the right position there are $\binom{4}{2}=6$ ways to pick those then there's only one way to "derange" the remaining two. That's $6.$

And there's no ways to have exactly three right, and of course the case where everything is in the right place ($1234$). So the answer is $8+6+1=\boxed{15}.$


Alternatively we can count the derangements as mentioned before:

For any permutation let $f(n)$ be the position of the said number. So for $4231$ $f(4)=1, f(2)=2,$ etc.

If we form a "4-cycle" (as in $f(a)=b, f(b)=c, f(c)=d,$ and $f(d)=a$) there are 3 ways to do it.

If there's two "2-cycles" (as in $f(a)=b$ and $f(b)=a$) there are $\binom{4}{2}=6$ ways to pick the first group of $2$ and $1$ way to pick the second group. And there's only one way to have everything messed up in this case. So the answer is $24-(3+6)=\boxed{15}$, which was our answer with the first method.

Edit: If you want a general solution the other answer pretty much has it.

3

The easiest way to calculate $!n$ is through the recursion $!n=(n-1)(!(n-1)+!(n-2))$.

This gives $!1=0,!2=1,!3=2,!4=9$.

What you want is $4!-!4=24-9=15$.

  • 0
    I have been trying to find a name for $!n$, but no success so far. What is this called? Or where can I find more information about it?2017-02-13
  • 0
    @EnricoBorba it's sometimes called subfactorial2017-02-13
  • 0
    Thank you, found it as [Dearrangement](https://en.wikipedia.org/wiki/Derangement) on wikipedia.2017-02-13