Skip to content

Expected value of a random number of ones and nines

Question

An 88-digit number XX is generated in two steps. First draw kk uniformly from {0,1,…,8}\{0,1,\dots,8\}. Then choose uniformly among all 88-digit strings containing exactly kk ones, with every other digit a nine. What is E[X]\mathbb{E}[X]?

Short answer

55555555. Swapping every 11 with a 99 maps strings with kk ones to strings with 8−k8-k ones, and kk and 8−k8-k are equally likely, so each digit is 11 or 99 with probability 12\tfrac12. Each digit therefore averages 55, and by linearity E[X]=5×11111111\mathbb{E}[X]=5\times11111111.

Adapted from QuantQuestions.io; 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

Lessons behind this question

Start with a free lesson: Expectation, Variance and Covariance is part of a free topic. Create a free account, no card needed, to read it in full with worked solutions.

Read it free