cipher.ink Write a message

Learn · Practical guides

Secret Santa when couples are in the group

How to stop partners and housemates drawing each other, how many draws are left, and when the rules make a draw impossible.

To keep couples from drawing each other in a Secret Santa, list each pair as an exclusion before the draw, and make sure the group is big enough that those rules still leave everyone somebody to buy for. By hand that means redrawing a lot. In software it's one line per couple. Either way there's a point where adding rules makes the party easier to guess, and one where it stops working at all.

Doing it with a hat

The hat can handle couples, but it'll make you pay. Everyone has to avoid their own name and their partner's, so the number of valid draws drops fast. With ten people and five couples, the hat works about 12% of the time, so expect to throw the whole thing back in and start over about eight times. With six people and three couples it's one in nine.

That's why people start patching. Somebody gets their partner, so they swap with the person next to them, and the swap quietly makes some outcomes far likelier than others (the numbers are in the mathematics of Secret Santa). If you're using a hat, the honest rule is the dull one: when anyone breaks a rule, every slip goes back and the draw starts again from nothing.

Who counts as a couple

The rule is wider than marriage. The exclusions people add most often are partners, housemates, a parent and the child who lives at home, siblings who already swap gifts every year, and last year's pairings when a group wants fresh matches. On the Secret Santa generator, each line in the exclusion box is one group, with the names separated by commas. A line with three names means none of those three draws any other. And every rule runs both ways: if Ana can't draw Bob, Bob can't draw Ana.

Be stingy with them. Every rule costs a bit of unpredictability, and a pair who'd be happy to draw each other isn't a problem you need to solve. Exclude the people who would buy for each other anyway, or for whom the match would be awkward, and leave the rest to chance. A group where nearly everyone is excluded from nearly everyone ends up in the impossible case described further down.

One alternative skips the rule entirely. Enter a couple as a single entry, "Ana and Bob," and let them give and receive one gift together. It's less work and nobody needs to be excluded. The downside is that they get one present between them and buy only one, which some couples love and others don't.

How many draws are left

These come from the site's own counting code, run on groups of different sizes with every possible couple rule applied (scripts/examples/santa-guides.mjs):

PeopleCouplesValid draws leftValid with no couples
4149
4249
521644
6380265
844,75214,833
105440,1921,334,961

The calculator on the math page takes a head count and a number of couples and prints the same figures for your own group.

Look at the first two rows. With four people, one couple already cuts the nine possible draws to four, and a second couple removes nothing more, because the draws that survived the first rule happen to satisfy the second. It's a small group where the rules decide almost everything.

A rough way to think about it: each person with a partner has one fewer person to draw, so in a group of six, each of them has four choices. That's enough to keep the party interesting, but it's also why a game of "I bet you have me" gets easy in small groups. We wouldn't put more than one or two couples in a group of five or fewer, and from about eight people up the rules stop mattering much. Even five couples among ten people leave 440,192 draws, a third of the unrestricted number.

When the rules make a draw impossible

Stack up enough exclusions and no valid draw exists. Take five people where four of them live together and can't draw each other. Those four have exactly one person left to give to, the fifth. Four givers, one receiver: no assignment can work, however many times you shuffle. This is Hall's marriage theorem at work. A draw is possible only if every set of givers has at least as many allowed recipients as there are givers in the set, and when that fails, the set that fails is the one to fix.

The generator finds that set and names it, something like "Ana, Bob, Chloe and Dev can only give to Ed between them: 4 people for 1 recipient." You'll see that instead of a spinner. Remove one of the exclusions that involves them, or add a person from outside, and try again.

One big loop with couples

The one big loop option makes everyone part of a single chain, so nobody swaps gifts with the person buying for them. It works with exclusions too, but the search is harder, because "is there any single loop that obeys these rules" is a known hard problem in general. For groups up to the site's limit of 60 people and a sensible number of couples, random tries find a loop almost at once. When they don't, the code searches more thoroughly within a time budget. If the rules are tight enough that even that runs out, it tells you to drop an exclusion rather than hand over a draw it can't vouch for.

Ask for the loop when you want the reveal to go round the room in a circle, or when a swapped pair at the party would spoil the guessing. Skip it in a group of five or fewer with couples in it. There are so few draws left that the loop option leaves almost nothing to choose from.

What to do next

List the couples before you type a single name into anything, count how many people you have, and compare it with the table above. If the group is small and the rules are many, drop the least important exclusion first, or enter a couple as one entry. Then run the draw. If you'd rather not give a sign-up site your list of names at all, Secret Santa without email compares the ways to do it, and a group that's spread out has its own planning problems, covered in running a remote Secret Santa.

Further reading

  1. Hall: On Representatives of Subsets (1935)
  2. OEIS A000166: subfactorials (derangements)