In how many ways we can rearrange n number of alphabets in a row while not keeping special 2 alphabets in front or end?
I have tried to do this math in following way:
There are $n$ number of alphabets. The special 2 alphabets must not be in front or end. If they can't be in front or end,they must be in middle and $n-2$ alphabets can be in front or end. If $n-2$ alphabets is in front,then in the end there must be $n-3$ alphabets, and I can arrange them in $(n-2)n-3(n-2)! \cdot 2!$ as there are $2$ special alphabets and they can be arranged in $2!$ ways.
But the answer in my book shows that $(n-2)n-3(n-2)!$. Could you please solve this?
There are $n$ positions for alphabets, of which $2$ are not allowed for the special ones. You can place the first special one in $n-2$ locations. You have used up one location, so the second special one can go in $n-3$ locations. Then there are $n-2$ locations left, so you can arrange the rest in $(n-2)!$ ways, for a total of $(n-2)(n-3)(n-2)!$ as the book says.
Your factor of $2!$ is overcounting as you have already placed the special alphabets in specific locations in the previous stage.