For $a.1$, there are $$\frac {11*10}{2}=55$$ ways to pick the first permutation. If you just prohibit inverses(the inverse is the same as the swap), there are then $$\frac {55*54*53*52}{24}$$ ways to pick four permutations. But this ignores the fact that you may move the same letter twice. If you want eight letters to move in four swaps, you have $$\frac {55*36*21*10}{24}$$
Oh my, such confusion! Let's try to simplify this, yet keep its essence.
Instead of statistics, let's use stats. There are 30 unique
arrangements, of which 3 have s at each end:
$$ \frac{5!}{2!\,2!} = 30\; \; \text{and} \; \; 3!/2! = 3.$$
So we can get the second number by removing s from each end
and dealing with what remains.
This means that in a random permutation. the probability of
getting an s at each end, should to 0.1.
In the simulation program below, I have avoided the messiness
of dealing with character strings in R, by substituting numbers
for letters in stats
(1 represents s). A million random
permutations ought to give 2-place accuracy, so the answer
substantially matches the theoretical value.
stats = c(1,1,2,2,3)
n = length(stats)
m = 10^6; x = numeric(m)
for (i in 1:m) {
perm = sample(stats,n)
x[i] = (perm[1]==1 & perm[n]==1) }
mean(x)
## 0.099806
Now let's use mamam
instead of mathematicsman
. Again here, we can
use the standard method find $\frac{5!}{3!\cdot 2!} =10$ as the number of unrestricted, distinguishable permutations. If we ignore two of the (indistingusihable) m
's, then we
have the 3 arrangements of ama
. So the probability
a random permutation has m's at both ends should be $3/10 = 0.3.$ The simulation below
confirms this.
mamam = c(1,1,1,2,2)
n = length(mamam)
m = 10^6; x = numeric(m)
for (i in 1:m) {
perm = sample(mamam,n)
x[i] = (perm[1]==1 & perm[n]==1) }
mean(x)
## 0.300217
Best Answer
There are $\binom4 2$ ways = $6$ ways in which the two $A's$ are out of position.
The remaining $4$ distinct letters with $2$ of them (call them $X$ and $Y$) "in position"
We now apply inclusion-exclusion, to find total permutations minus those with at least $X$ still in position minus at least $Y$ still in position plus both $X$ and $Y$ still in position (because we subtracted such cases twice), thus
$4!-3!-3!+2! = 14$ and multiply by $6$