Expected number of ones

57 Views Asked by At

What is the expected number of bit $1$'s when writing a random integer from $1$ to $1024$ in binary?

I noticed that $1024 = 2^{10}$, so maybe linearity of expectation could help here?

1

There are 1 best solutions below

0
On

If the binary number were selected uniformly from the range $\{000000000_2, 111111111_2\}$, the number of 1's would have a binomial distribution ${\cal Bin}(9, \tfrac 1 2)$, and an expected number of $4.5$.

Can you adjust this for a selection from the range of $\{0000000001_2, 1000000000_2\}$?