If B is adjacent to A we can make them as 1 letter, so 4!=24
If B is one away from A, we have 4 cases.
If B is two away from A we get:
there are 5 numbers not 4
This has a really nice method.
B will be left of A 50% of the time, right of A 50% of the time.
5*4*3*2*1 total ways to be in a line, 50% of which are where B is on the left of A.
5*4*3*2*1/2 = 60
Lets have a look at your method mathisopandcool
XXXXB 4! = 24
XXXBX 3*3! =18
XXBXX 3*2! *2 =12
XBXXX 3! =6
total = 24+18+12+6 = 60 ways
If you want me to explain any of these just ask.
A X X X X Four ways for B to be to the right
X A X X X Three ways
X X A X X Two ways
X X X A X One way total of 10 ways
the other three slots can be filled in 3 * 2 *1 ways = 6 ways for EACH of the 10 possibles
10 * 6 = 60 ways
That is a nice easy way too EP Thanks for showing us.
Your way is better than doing them all individually like in my demo.
Personally, I like catmgs way best but it is really good to see lots of alternative methods.