Expected number of unpecked chicks - NYT article
Solution 1:
For any individual chick, there is a $0.5$ chance that the one on its right won't peck it, and a $0.5$ chance that the one on its left won't peck it. So overall, it has a $0.25$ chance of not being pecked.
Since this is true for every chick, we can add up $0.25(100)=25$ to get the number of unpecked chicks.
"But wait," you might say, "the probabilities that chicks are unpecked aren't independent! If chick $n$ is unpecked, then chicks $n-2$ and $n+2$ will be pecked. Surely we have to take this into account!"
Fortunately, there's a very useful theorem called linearity of expectation. This tells us that for any random variables $X$ and $Y$, independent or not, $E[X+Y]=E[X]+E[Y]$, where $E$ is the expected value. What we're formally doing above is assigning a random variable $X_i$ to the $i$th chick that is equal to $0$ if the chick is pecked and $1$ if it's unpecked. Then the total number of unpecked chickens is $\sum X_i$, so the expected number of unpecked chickens is $$E\left[\sum X_i\right]=\sum E[X_i]$$ by linearity of expectation. But $E[X_i]$ is just the probability that the $i$th chicken is unpecked, thus justifying our reasoning above.
Solution 2:
This is a simple problem. Look, ma, no equations!
Consider YOU are the only chicken that matters, and construct a table to say whether YOU get pecked. Your chance of being pecked comes down to only 4 outcomes. (1) YES - pecked twice. (2) YES - pecked from left wing only. (3) YES - pecked from right wing only. (4) NO - unpecked.
The table has 4 elements, all of equal probability, 1 of which is unpecked. YOU are therefore pecked 3:1 ratio or 3:4 opportunities or 75% of the time. For convenience, this needs to be conducted for 100 trials of YOU, and the answer is that 25 times YOU will NOT be pecked. The circular nature of the 100 chicks says that YOU are not unique, and your experience is the same as the others, so we extrapolate your experience of 100 trials to a single trial of 100 chicks just like YOU.
25 unpecked chicks, 50 get pecked once, 25 get double pecks.
This is the same table constructed for 100 women having two children and asking how many have no girls.
Solution 3:
It is overkill for this, but you can write a simulation to estimate the expected number. Such a simulation doesn't prove anything per se, but sometimes it is useful to write a quick simulation to confirm that a probability calculation is correct. Here is one in R:
count.unpecked <- function(n){
chicks <- 0:(n-1)
pecks <- sample(c(-1,1),n,replace = TRUE)
pecked <- (chicks + pecks) %% n
n - length(unique(pecked))
}
print(mean(replicate(100000,count.unpecked(100))))
This simulates the experiment 100,000 times. Output from my last run: 25.00679
Solution 4:
It is possible to have a state with $50$ unpecked chicks. It's also possible to have $0$ unpecked chicks and any integer between $0$ and $50$ is possible. $51$ unpecked chicks is impossible because then there would be no way to have $100$ pecks totally. If we can show that having $x$ unpecked chicks is equally likely as having $50-x$ unpecked chicks, then the average of both scenarios gives you $25$ unpecked chicks. So you number the chicks $1$ to $100$ such that consecutive numbers are adjacent to each other and $1$ is next to $100$. Change the directions of each chick that is divisible by $4$ and each chick that is congruent to $1 \mod 4$. I believe this involution gives us a one to one correspondence between states with $x$ unpecked chicks and states with $50-x$ unpecked chicks. Each state is equally likely and this means that $25$ has to be the expected number of unpecked chicks.
My explanation only works when the total number of chicks is positive and divisible by $4$. Luckily, $100$ is divisible by $4$.