# Probability of getting particular preferences in a ballot

I'm allocating berths on a ship. There are five berths: 101, 102, 103, 104, 105.

I'm allocating these to seven people: A, B, C, D, E, F and G. There's a limit of one person per berth. There are too many people for the berths, in fact. Not everyone is going to get a berth.

Each person has preferences (in order):

• A: [101, 102]
• B: [101, 104]
• C: [103, 102]
• D: [103, 104]
• E: [103, 104]
• F: [105, 102]
• G: [105, 104]

I want to work out the odds that each person is allocated their first or second preference.

I know, from barely remembered high school probabilities, that there are 7! = 5040 combinations. I know, from brute forcing, that these are the probabilities:

• A: 101: 2520/5040 = 0.5; 102: 1266/5040 = 0.2511904761904762
• B: 101: 2520/5040 = 0.5; 104: 858/5040 = 0.17023809523809524
• C: 103: 1680/5040 = 1/3; 102: 2088/5040 = 0.4142857142857143
• D: 103: 1680/5040 = 1/3; 104: 1662/5040 = 0.32976190476190476
• E: 103: 1680/5040 = 1/3; 104: 1662/5040 = 0.32976190476190476
• F: 105: 2520/5040 = 0.5; 102: 1266/5040 = 0.2511904761904762
• G: 105: 2520/5040 = 0.5; 104: 858/5040 = 0.17023809523809524

The first preferences seem pretty straight-forward: in half the combos A comes out first and in half B comes out first. (It helps that there's no overlap between the berths that are people's first preferences, and the berths that are people's second preference; bonus points for anyone who can handle the general case where there might be overlap.)

How can I work out the probabilities for the second preferences without brute forcing? If anyone can explain it to me like I'm someone that's forgotten almost all the probability they ever know, I'd be extremely grateful.

I've also noticed, but cannot explain, that the total probability of 102 getting allocated is (1266 + 2088 + 1266) / 5040 = 0.9166666667 (the sum of the second preferences of A, C, and F) which also equals (1-(2520/5040)(1680/5040)(2520/5040)) = 0.9166666667 (1 minus the product of the first preferences of A, C, and F.) Why is this so? And, why does this pattern not hold true for B, D, E, and G?

• How many people can share a berth? May 4, 2021 at 12:01
• Just one - they are single person berths. May 4, 2021 at 21:05
• Then I would have thought you cannot allocate seven people to five berths. You are going to have some very unhappy people May 4, 2021 at 21:15
• Correct, some people are going to be unhappy. May 4, 2021 at 23:57