## Yoak: Average Salary

Finding yourself chatting around the water cooler one afternoon, you and two co-workers agree that you would all like to know the average of your three salaries but none of you want your individual salary to be known to either of the other two. Without need of involving any external person or machine as some sort of secret keeper, how can you achieve this end?

## Andy said,

October 28, 2009 at 3:05 pm

You have to assume that none of the three of you will lie, of course.

Here is one way:

You get a random integer in some range like [0.2*salary, 5*salary], add it to your salary, and then write that number down on a piece of paper and pass it to person #2. Person #2 adds their salary to the number, writes this new number down on a new piece of paper and passes it to person #3. Person #3 adds their salary to the number, writes the new sum on a new piece of paper and passes it back to you. You subtract off the random number, and announce the result, which is the sum of the three salaries.

## Andrew said,

October 28, 2009 at 4:03 pm

A solution:

[spoiler]Each coworker i knows their salary Si. Furthermore, coworker 1 makes a random number R from a range large enough that R+Si gives acceptably little information about Si, and doesn’t tell it to anyone else.

1 Computes S1 + R and gives it to 2

2 Computes S1 + S2 + R and gives it to 3

3 Computes S1 + S2 + S3 + R and gives it to 1

1 Computes S1 + S2 + S3 and tells everyone the result.

In the end, 1 knows S2+S3, 2 knows S1+R and S1+S3, and 3 knows S1+S2+R and S1+S2, and can deduce R. None of this is enough for any of them to deduce the others’ individual salaries.[/spoiler]

## Blaine said,

October 28, 2009 at 4:53 pm

I think this would work…[spoiler]Have the first person think of a suitably large random number. To that, he adds his salary. This sum is told to the second person. The second person adds his salary and tells the sum to the third person. The third person adds his salary and tells the sum to the first person. The first person subtracts the initial random number and divides by 3. I think this prevents any one person from being able to calculate the salary of another.[/spoiler]

## laciermaths said,

October 28, 2009 at 10:22 pm

Each person splits his income into two parts, say a1 + a2, b1 + b2, and c1 + c2. Now B whispers b1 to A, who computes and remembers a2 + b1. Similarly C whispers c1 to B, and A whispers a1 to C. Now A openly declares a2+b1, B declares b2+c1, and C declares c2+a1, and they can all compute the average.

At the end, C knows the sum of the salaries, his own salary and the manner in which it was partitioned, a1 (since he was told it), b2 (since he knows what he told B), and a2+b1 (since it was declared out loud). But there’s no way for him to separate a2+b1, so he doesn’t know the salaries of the other two.

## strauss said,

November 4, 2009 at 9:14 am

We did this one on the radio once, with lots of hijinks about the high salaries at the public radio station. Great puzzle!

## RFig said,

November 9, 2009 at 12:04 pm

I came up with the same solution however it is very unsatisfying because the third employee is able to see the maximum salary of the other two. Is there another solution where no one can tell the upper end of the others salaries?