Advertisement

counting...

Started by May 09, 2002 10:17 PM
5 comments, last by trub 22 years, 9 months ago
is this the right way to go about a problem such as this... suppose 6 people go to a movie theater, 3 men and 3 women. How many ways can these 6 people sit down in 6 consecutive seats such that no two mena are next to each other and no two women are next to each other. ------ so i figured... 6 ways to select first person (could be anyone) 3 ways to select second person (must choose opposite gender) 2 ways to select third person (opp gender and only 2 left) 2 ways to select forth person (opp gender and only 2 left) 1 way to select fifth person (opp gender and only 1 left) 1 way to select sixth person (opp gender and only 1 left) 6*3*2*2*1*1 = 72 ways to arrage Sorry if this is to simplistic for this forum. Just say so and i''ll try to find help elsewhere.
mang?
Statistics hurts my head

But if you want to try it, I can suggest this website:
http://www.quickmba.com/stats/probability/perm/

As for me, I forgot most of this stuff when I passed the class. Your equation seems correct, but can be summed up better in a combinations equation.

--edit

I did some detective work. I believe the equation is summed up like this:

Men can be seated in any combination of three seats (3!)
Women can be seated in any combination of three seats (3!)

The first seat can be either a man or woman so multiply by 2.

So you come up with (3!) * (3!) * 2 = 72

See why this stuff hurts my head now?

---------------------------------------------------------------------------------------
Before I couldn't spell engineer, now I are one.

[edited by - ShockBoy99 on May 9, 2002 11:30:28 PM]
---------------------------------------------------------------------------------------Before I couldn't spell engineer, now I are one.
Advertisement
Correct. Naturally you can work it out more than one way, but you get the same answer.

You''re not allowed to ask homework questions here, but you''ve answered your own question anyway.
sorry about that asking the homework question. (prob should read the forum rules). thanks anyways though!

mang?
trub,

While homework questions that ask for the answer are not permitted in this forum, those that show that you have attempted the work and are seeking understanding are welcome. Clearly in this case you have come up with an answer - a correct one at that - and want confirmation that you have done the right thing... and perhaps some understanding why it is correct... it's quite alright to post that here... and members of this forum should be happy to help. The only stipulation I will add to this is that it is preferred that the question has something to do with game development, so that readers of the forum actually gain something out of reading the thread.

Anyway, to help with your understanding of problems like this...

This problem is really asking you how many ways can you arrange elements of several sets given some constraints. It's called a constraint satisfaction problem and solving such problems does arise in programming and games (I know of at least one Game AI engine - Excalibur - that implements constraint satisfaction).

So, you have two sets, {M} and {F}, each having a size of 3. The constraints stipulate that you must alternate between sets {M} and {F} when ordering the elements into a new set of length 6. The question is really asking how many different sets of length 6 can you make from the two sets, {M} and {F}, while ensuring that no two elements from the same set are adjacent in the new set.

First, ask yourself how many ways can you order the two sets, {M} and {F}? Well, there's only two: {M} first, or {F} first. Now, because of the constraint of alternating elements from {M} and {F}, there are only 3 possible seats to place an {M} member in (1,3,5 OR 2,4,6} and 3 possible seats to place an {F} member in (2,4,6 OR 1,3,5) The OR is taken care of by the number of ways to order the sets.

How many ways can you arrange n elements in m positions (seats)? The answer is given by considering each of the m positions and looking at how many options are left to fill each successive position (you already know this as you've demonstrated it in your answer). Hence, there is n*(n-1)*...*(n-m+1) possible ways. In this question, its 3*2*1 since m=n, so the answer is 3!. In general, the answer is given by the formula for permutations :

The number of permutations of n different things taken m at a time without repetitions is
                         n!n(n-1)(n-2)...(n-m+1) = -----                        (n-m)!  

and you must remember that 0! = 1.

So, the set {F} can be ordered 3! ways and the set {M} can be ordered 3! ways. To consider both of these possibilities, we multiply (this comes about from how we deal with conjunctions of events and probabilities). So, we have 3!*3! ways to order the elements within both sets... and 2 ways to order the sets... so we obtain 2*3!*3! ways to order all of the elements in both sets, given the constraints.

This is the answer that you got and the result that ShockBoy99 presented; I hope I've given you a little more understanding though.

Try a few more problems out from your textbook using the above formula and see how things go.

Good luck,

Timkin

[edited by - Timkin on May 10, 2002 11:49:36 PM]
Timkin, thanks for explaining the homework issue. Yes, this question is acceptable since trub was not flatly asking for an answer (just a review of his answer), and because they showed their own thought process rather than saying "I can''t figure this for the life of me! Help!"

Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.
Graham Rhodes Moderator, Math & Physics forum @ gamedev.net
Advertisement
Just helping where I can!

Timkin

This topic is closed to new replies.

Advertisement