Expected Self-Matches in a Random Team Gift Exchange

Last updated: November 29, 2026

Quick Overview

A Google team of n people draws names at random for a gift exchange. What is the expected number of people who draw their own name, and what is its variance?

Google
Statistics & Math
Data Scientist
Google
November 29, 2026
Data Scientist
Phone Screen
Statistics & Math
Easy

0

0

0 solved


A Google team of n people draws names at random for a gift exchange. What is the expected number of people who draw their own name, and what is its variance?

A classic Google phone screen warm-up that tests linearity of expectation. The interviewer wants to see indicator variables used instead of a brute-force count of permutations, and often follows with the variance or the probability nobody draws themselves.

What the Interviewer Expects
  • Define indicator variables per person
  • Apply linearity of expectation to get 1 regardless of n
  • Compute the variance using pairwise indicator products
  • Note the derangement probability tends to 1/e
  • Avoid assuming independence of indicators
Key Topics to Cover
linearity of expectation
indicator variables
random permutations
derangements
variance
How to Approach This
  1. Define your hypotheses (H0 and H1) clearly before performing any test.
  2. Calculate required sample size BEFORE running an experiment, using power analysis.
  3. Remember the Central Limit Theorem: sample means become approximately normal with large n.
  4. Watch for Simpson's paradox. Always segment data by key dimensions.
  5. Distinguish between statistical significance and practical significance.
Possible Follow-up Questions
  • What is the probability that nobody draws their own name?
  • Why does linearity of expectation work even though the indicators are dependent?
  • What is the expected number of 2-cycles (pairs who draw each other)?
  • How would you redraw so that no one gets themselves while staying uniform?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Browse Statistics Questions
Sample Answer
Clarify

The assignment is a uniformly random permutation of nn names, n≥2n \ge 2. A self-match (fixed point) is a person who draws their own name. We want E[X]E[X] and Var(X)\mathrm{Var}(X) where XX is the number ...

Approach

Write X=∑i=1nIiX = \sum_{i=1}^{n} I_i where Ii=1I_i = 1 if person ii draws themselves. Linearity of expectation does not need independence. For the variance, expand E[X2]E[X^2] into diagonal and off-diagonal ter...


Submit Your Answer
Markdown supported