How many ways can the numbers 1, 2, 3, 4 and 5 be placed in a line so that neither 1 nor 5 occupy either the first or the last place in the sequence?
We can choose the 1st number 3 ways. That's 3.
We can choose the 5th number 2 ways. That's 3*2.
We can choose the 2nd number 3 ways (we've used two already). That's 3*2*3
We can choose the 3rd number 2 ways. That's 3*2*3*2
We can choose the 4th number 1 way. That's 3*2*3*2*1
Multiply that out and get 36. That's 36 ways. Here they all are:
1. 2, 1, 3, 5, 4
2. 2, 1, 4, 5, 3
3. 2, 1, 5, 3, 4
4. 2, 1, 5, 4, 3
5. 2, 3, 1, 5, 4
6. 2, 3, 5, 1, 4
7. 2, 4, 1, 5, 3
8. 2, 4, 5, 1, 3
9. 2, 5, 1, 3, 4
10. 2, 5, 1, 4, 3
11. 2, 5, 3, 1, 4
12. 2, 5, 4, 1, 3
13. 3, 1, 2, 5, 4
14. 3, 1, 4, 5, 2
15. 3, 1, 5, 2, 4
16. 3, 1, 5, 4, 2
17. 3, 2, 1, 5, 4
18. 3, 2, 5, 1, 4
19. 3, 4, 1, 5, 2
20. 3, 4, 5, 1, 2
21. 3, 5, 1, 2, 4
22. 3, 5, 1, 4, 2
23. 3, 5, 2, 1, 4
24. 3, 5, 4, 1, 2
25. 4, 1, 2, 5, 3
26. 4, 1, 3, 5, 2
27. 4, 1, 5, 2, 3
28. 4, 1, 5, 3, 2
29. 4, 2, 1, 5, 3
30. 4, 2, 5, 1, 3
31. 4, 3, 1, 5, 2
32. 4, 3, 5, 1, 2
33. 4, 5, 1, 2, 3
34. 4, 5, 1, 3, 2
35. 4, 5, 2, 1, 3
36. 4, 5, 3, 1, 2
Edwin