Alice and Bob are planning a long car trip and need to come up with a playlist for it. For any given song, they have one of four opinions on it: "That's, like, my favorite song ever" (love), "I like that song" (like), "I'll listen to this, but you owe me" (tolerate), or "I'd rather poke my eardrums out" (hate). To best respect each other's preferences, here's the rules they agreed on for which songs make it onto the playlist:

Alice \ Bob Love Like Tolerate Hate
Love Yes Yes Yes No
Like Yes Yes No No
Tolerate Yes No No No
Hate No No No No

But here's their dilemma: they're both very self-conscious of their tastes in music. In particular, Alice is worried that Bob will judge her if he finds out that she loves a song he hates, and vice versa. Thus, neither person should learn any more than necessary about the other's opinion of songs that don't get added to the playlist. (For songs that do get added to the playlist, it doesn't matter whether or not they learn each other's exact opinions.) Given a certain song, how can they figure out whether to put it on their playlist, without needing a trusted third party or computer?

Clarifying what can and can't be revealed:

  • If Alice hates a song, she must not learn anything at all about Bob's opinion of it.
  • If Alice tolerates a song and Bob doesn't love it, she'll learn that he doesn't love it, but she must not learn anything about his opinion of it beyond that.
  • If Alice likes a song and Bob either tolerates or hates it, she'll learn that his opinion is one of those two, but she must not learn which.

And ditto swapping Alice and Bob's places. If I didn't say something can't be revealed above, then it can be revealed.

Another clarification: Alice and Bob will both cheat if they can, as long as doing so doesn't prevent the other person from ending up with the correct answer at the end of the protocol.


3 Answers 3


I've tried to anticipate some nitpicks at the process I present below. Nitpicks are in parentheses and set off from the main method. The core of the method can be found outside the parentheses.

Set-up step:

Alice and Bob should construct some sort of balance. The actual form this balance takes doesn't matter, as long as it's fair and can have a container attached to either end. They'll also need to procure two identical, opaque containers, for that matter. One container (Container A) has a 7g weight placed in it.

(If it's impractical to assume that they have perfect weights, then I hope it's practical to assume that people have objects of identical weight. The method really only needs a mass of 7X - could be 7 batteries, 7 candies, 7 refrigerator magnets, etc.)

Then, they should follow these steps for each potential song:

  1. Alice drops a number of 1g weights into the other container (Container B) corresponding to how much she enjoys the song. Hate = 0g, Tolerate = 2g, Like = 4g, Love = 6g. Bob follows suit. Neither looks inside the container when doing so, and let's say the containers have padded bottoms so you can't hear how many weights there are bopping around in it.

    (If "don't look in the container" is a rule that they can't be expected to follow, say the containers have only a small hole at the top that's just big enough to put in a weight. And the inside is dark enough that you can't see what's inside. This isn't actually that hard to construct; take a smaller cardboard-shipping-box, cover the bottom with cheap foam or a pillow, and cut a little hole in the top. But I digress)

  2. Now, one of them (Alice, say) holds the balance in place so that it can't tip either way. Bob attaches Container A to one side and Container B to the other. Alice releases the balance. If Container A is heavier, then the song doesn't go on the playlist. If Container B is heavier, then the song goes on the playlist.

    (If Bob might be able to guess the weight of Container B when he's transporting it, then let's say we stick an extra 1kg weight in both containers. Telling, say, 1.002kg apart from 1.006kg is much harder than telling 2g apart from 6g. But perhaps the weight of the containers themselves is enough to block this.)

    (To address the comment-nitpick that you can tell the relative masses by watching the balance: Alice and Bob should get a big box. Or create a big box by cutting up smaller boxes and duct-taping the parts together. Or get four pole-supports and a blanket. Then they can block the balance from sight, by placing the box over it or using the supports to cover it with a blanket. They'll do this after the containers are attached. Instead of Alice holding the balance, they rejigger it so it can be held in place with a stick poked in the appropriate area - I can draw a picture, or you can just imagine it. It's possible. Anyhow, they jigger the balance steady with a stick, place the containers on either side, fit the box/blankets over (perhaps they have a small hole for the stick to poke through), and remove the stick. Now they wait a minute or so to make sure the side that would tip has tipped completely, before removing the box/blankets.)

    (Yes this is overkill. But they wanted secrecy!)

  3. Now they repeat. Either they get a fresh Container B, or one dumps the weights out without looking into it or counting the weights as they tumble out.

    (For an actual procedure to prevent peeking, say that my proposed cardboard-shipping-box with foam on the bottom and a small hole on top is used. Say the hole on top has about double the radius of the weights. Simply have Alice watch Bob to ensure no cheaty-looking, and then Bob upturns the box over a container with many, many other weights already. Then the weights will tumble out properly without anyone being able to look or count)

Why does this work?

Let's look at a table of how much mass would be added to Container B for each possibility

| Alice \ Bob |       Love       |       Like       |     Tolerate    |       Hate      |
| ----------- | ---------------- | ---------------- | --------------- | --------------- |
| Love | 12 (> 7 → tip B) | 10 (> 7 → tip B) | 8 (> 7 → tip B) | 6 (< 7 → tip A) |
| Like | 10 (> 7 → tip B) | 8 (> 7 → tip B) | 6 (< 7 → tip A) | 4 (< 7 → tip A) |
| Tolerate | 8 (> 7 → tip B) | 6 (< 7 → tip A) | 4 (< 7 → tip A) | 2 (< 7 → tip A) |
| Hate | 6 (< 7 → tip A) | 4 (< 7 → tip A) | 2 (< 7 → tip A) | 0 (< 7 → tip A) |

Or, in a wordier form:

This method provides no information to either Alice or Bob besides tip A or tip B. Seeing as "tip B" equals "song on playlist" in all cases, and visa versa for A, what they learn is perfectly equivalent to what they would learn from the song being on the playlist, and nothing more.

  • $\begingroup$ rot13(N jnl gb trg nebhaq "qba'g ybbx ng pbagnvare" vf gb hfr gjb bcndhr pbagnvaref, bar sbe rnpu crefba, naq chg gurz ba gur fnzr fvqr. Jrvtu guvf ntnvafg nabgure gjb vqragvpny pbagnvaref ba gur bgure fvqr gbtrgure jvgu 7t jrvtug.) $\endgroup$ Commented Apr 10, 2021 at 8:01
  • $\begingroup$ This leaks some information: rot13(n onynapr fpnyr jvgu 7 tenzf ba bar fvqr naq 0 ba gur bgure jvyy gvc zber dhvpxyl guna bar jvgu 7 tenzf ba bar fvqr naq 6 ba gur bgure). $\endgroup$ Commented Apr 10, 2021 at 14:22
  • $\begingroup$ @JosephSible-ReinstateMonica does the edit address your concern? $\endgroup$
    – bobble
    Commented Apr 10, 2021 at 15:14
  • $\begingroup$ Yes, it seems to work now. $\endgroup$ Commented Apr 10, 2021 at 17:25

I have a proposed process, which has the downside of allowing for cheating, but works if both sides want to keep the information transfer within the outlined parameters:

For each song, Alice gets 4 index cards, each with a different one of "Love", "Like", "Tolerate", and "Hate" on them. On the other side of each card, she writes (without Bob looking over her shoulder) whether the song would be included if that card's front side is Bob's opinion (eg if Alice tolerates a song, she'd write "No" on all the cards except "Love"). Alice then leaves the room. Bob looks at the card for each song corresponding to how he feels about the song, and adds the song to the list if it says "Yes" on the back. Bob doesn't look at any card that doesn't match his opinion of the song. Once Bob is done, one of them disposes of the cards without letting him see anything else on them.

This works because:

Alice learns nothing until she sees the final playlist, so she clearly isn't learning extra. Bob, assuming he doesn't cheat, only learns if a song should be on the playlist or not, which is unavoidable anyway.

We can modify this to enforce the secrecy better:

Alice instead places cards/paper with Yes or No inside 4 envelopes per song, with each envelope labelled on one side as above. Instead of leaving when Bob comes to select, Alice simply closes her eyes while Bob shuffles the envelopes and selects the appropriate one (while Alice listens to make sure Bob isn't opening any). Once he's selected it, he holds it such that Alice cannot see the label, then opens it, notes whether it says yes or no, then the process repeats. At the end, Bob disposes of the envelopes while Alice listens to make sure he doesn't open any. This has all the same results of the method above, but Bob can't learn any additional information without Alice catching him cheating.

  • 1
    $\begingroup$ As I prefaced my answer, this only works if both abide by rules that aren't enforced. From the premise of the question, it seems like they're both primarily concerned with making sure they don't know too much, rather than making sure they don't reveal too much $\endgroup$
    – StephenTG
    Commented Apr 9, 2021 at 12:46
  • $\begingroup$ Two things: 1. Rot13(Gur "Ungr" pneq vf haarprffnel, fvapr Obo xabjf vg jbhyq nyjnlf fnl "ab" ba gur onpx). 2. I'd prefer a solution where cheating isn't as easy. Alice and Bob would love to judge each other; they just don't want to be on the receiving end of it. I think this could be modified to be cheat-resistant relatively easy though. $\endgroup$ Commented Apr 9, 2021 at 13:57
  • $\begingroup$ Even your modified version lets Bob cheat: if he hates a song, he can open one of the other envelopes instead, thus gaining information he shouldn't have. And you can't fix this by making him show Alice the paper, since then she could learn extra information instead, by subtly marking them somehow. $\endgroup$ Commented Apr 12, 2021 at 19:44

Water, an overflowing container, a dry cloth, and a protocol that removes songs from the playlist rather than adds them.

Alice and Bob have buckets that take a maximum of 4 units. They have a container that can hold a maximum of 4 units. They decide if each song will stay on the playlist by adding water from the buckets to the container. A hate vote is 4 units. Tolerate is 3. Like is 2. And love is 1.

A bigger container prevents Alice and Bob from inferring the other's preferences based on water volume.

Alice and Bob fill their buckets according to their tastes, then in separate rooms, dump them into funnels that lead to the overflow container. If there is any overflow, the song is removed from the playlist.

A dry cloth is placed under the container as the indicator.

In numbers:

They are doing a simple weighted vote. A hate vote is 4 and a love vote is 1, 5 total. This will overflow the container and remove the song. A tolerate vote is 3, and with a love vote of 1, it totals 4 and the song remains on the list.

Shared like and love votes become known exactly, but combinations of hate, tolerate, and like votes are always obscured. If you want to also obscure like and love combination votes

then you can make the container opaque and have a drain plug that can be pulled without looking in.

If Alice and Bob were more honest

they could use syringes and a much smaller overflow container, and then simply look away at the moment they vote. They could also use a small bit of tissue paper instead of a cloth.

Instead of a dry cloth, you can add obscurity by using a scale.

All water overflow is captured by another opaque container which sits on a scale that simply lights up when there's any weight added. Light on means remove from list, light off means it stays. They pull the plugs to drain the containers then start again.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.