Averaging eight salaries without revealing any
Question
Eight colleagues want to know the mean of their salaries, but nobody is willing to let anyone else learn their own pay. Design a procedure that gives them the average while keeping every individual salary private.
Short answer
Mask the running total with a secret random number. The first person adds a large random number to their salary and passes the sum privately to the second, who adds their salary and passes it on, and so on around all eight. The total comes back to the first person, who subtracts the random number and divides by . Each person only ever sees a masked partial sum.
Adapted from Zhou, A Practical Guide to Quantitative Finance Interviews, sec. 2.3 Thinking Out of the Box, 'Quant salary', p.14; question and answer rewritten by SelfMadeQuant.com.
See the hint and the full worked solution in the question bank (free account).
Open the worked solution