topspin360 wrote:thanks forthe clarification tutorphd.
to answer your new question: would it be (n-1)! * (n-2)!
if the scenario looks like this: A B C D E F, there are 5 ways for B to be behind A, if A was in the second spot there would be 4 ways for B to be behind A. Similar logic can be applied to C behind B. Hence we come out with 5! for B and 4! for C, so it's 5! * 4!?
is this the most optimal way to do this?
Hi topspin360:
Unfortunately, it won't be 5!*4!.
The reason is that When A is in first place, there are only 4 places where B can be, since C has to be after B. So we need to count only the cases where A>B>C order is maintained.
The one way which can always be used is fundamental principal of counting (the so-called slot method). Fix A, Then Fix B at various places and count the cases. If I am not sure of doing a problem, I tend to default to that one.
Fortunately, for the problem at hand, there is an easier (read "formulaic") way of doing these kind of order maintenance problems. It is specific; however it is pretty fast. When there are n objects and you need r objects to be in a certain relative order, the number of ways of doing so is :
n!/r!.
For example, for the first one you did, it was 6!/2!. For this new problem where A > B > C, 3 objects A, B and C are in a fixed order. Hence number of ways for the favorable cases among the 6! arrangements = 6!/3!.
Try to test it for A>B>C>D>E case.
Now for the more important idea of how did I come up with this idea. Let's start with an example.
Let's say there were 4 items A,B, and C, D and we needed to have the cases where A was always in front of B, and B in front of C. Now we can arrange A,B,C among themselves in 3! ways. We can arrange A,B,C,D in 4! ways. Of these 4! ways, A,B,C among themselves maintain 3! different orders. Hence 4!/3! are the ways that 3 items out of 4 maintain a certain order. (If you need to convince yourself, write out the 24 cases, and highlight the cases in which A > B > C order is maintained).
So the overall formula is for:
Q: If out of n objects, r maintain a certain relative order, what is the number of ways of in which these n objects can be arranged?
A: n!/r!.
Let me know if this helps
