Wednesday, June 11, 2008

Puzzle: How can three co-workers know the average of their salaries without disclosing their own salaries to each other?Solution: Let's say the three co-workers are A, B, and C and their individual salaries are Sa, Sb, and Sc respectively. For knowing the average of their salaries without disclosing their own salaries to each other, they follow these steps:-

A adds a random amount, say Ra to his own salary and gives that to B (B won't be able to know A's salary as he has added a random amount known to him only). In this case, B will receive the figure (Sa + Ra) from A.

B does the same and gives the final amount to C (without showing that to A). Now C will get the figure (Sa + Ra + Sb + Rb).

C does the same and gives the final figure to A (without showing it to B). Now, A will receive the figure (Sa + Ra + Sb + Rb + Sc + Rc).

Now A subtracts his random amount and gives the final figure to B (without showing that to C). B will now receive the figure (Sa + Sb + Rb + Sc + Rc).

B subtracts his random amount and gives the final figure to C (without showing it to A). C will receive the figure (Sa + Sb + Sc + Rc).

C subtracts his random amount and then the figure becomes (Sa + Sb + Sc). It's shown to everyone and by they get to know the average simply by dividing this figure by 3. Cool... isn't it?

It's important to note here that at every stage (except the very last where C subtracts his random amount), only two co-workers communicating each other should know the fugures and not the third one.

We can apply the same technique to know the average of more than 3 people as well. We just need to remember that at every stage only two people should share the figures and rest other should not be communicated that. What are you waiting for? Find the average salary of your team. No one needs to disclose his/her own salary, so it'll be good fun :-)