So this question was asked in a recent online test of an HFT.
There are 5 red balls and 7 blue balls arranged in a line. Find the expected number of blue balls that are immediately followed by red balls.
Can someone suggest how to use linearity of expectation here:
I came up with the following relation
$E_{n,r}=\frac{r*(r-1)}{n*(n-1)}E_{n-2,r-2}+\frac{r*(n-r)}{n*(n-1)}E_{n-1,r-1}+\frac{(n-r)*(n-r+1)}{n*(n-1)}E_{n-2,r}$.
where n: is the total number of balls and r is the total number of red balls. Is there any flaw in my approach?
PS:
Do ask if more clarifications are required.
2026-04-18 07:46:59.1776498419
Expected number of red balls after blue balls
99 Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail At
1
You can check if your formulation gives the same answer as mine. As asked by you, I shall use linearity of expectation to greatly simplify the computations.
P(a blue ball is in any position) $=\frac7{12}$
P(a red ball is in any position) $= \frac5{12}$
Also, for P( a blue ball is immediately followed by a red one), the probability of a blue-red pair occupying any two adjacent positions will be the same by symmetry, hence the same as a blue-red pair occupying positions $1$ and $2$
Let $X_i$ be an indicator variable that $=1$ if a blue-red pair starts at $i$, and $0$ otherwise, then
$P[X_i]=\frac7{12}\frac5{11}=\frac{35}{132}$
Now the expectation of an indicator variable is just the probability of the event it indicates,
thus $\mathbb E[X_i]= \frac{35}{132}$
Such blue-red pairs can start at any of the first $11$ positions, thus by linearity of expectation, which operates even when the random variables are not independent,
$\mathbb E[X]=11\cdot\frac{35}{132}=\frac{35}{12}$