# Hypergeometric distribution and indicator functions

An urn contains $w$ white and $b$ black balls. $n$ extractions without replacement are made.. Let $I_i$ be a random variable such that $$I_i = \begin{cases} 0 & \text{if the ith ball drawn is black,}\\ 1 & \text{if the ith ball drawn is white.} \end{cases}$$ and $X_i$ is a random variable that rappresents the total number of white balls extracted during the entire time we are extracting the first $i$ balls $$X_i = \sum_{k=1}^i I_k$$

I know that $$\Pr(X_i=s)=\frac{\dbinom{w}{s}\dbinom{b}{i-s}}{\dbinom{w+b}{i}}$$

but I wondered if it was possible to calculate the same probability via the indicator function defined before.

The single probability is $\Pr(I_i)=\frac{w}{w+b}$.

Consider a simple case: \begin{align}\mathsf P(I_1+I_2=x) =&~ \sum_{k\in \{0, 1\}} \mathsf P(I_1=k, I_2=x-k) \\[1ex] = &~\mathsf P(I_1=0)\mathsf P(I_2=x\mid I_1=0)+\mathsf P(I_1=0)\mathsf P(I_2=x-1\mid I_1=1) \\[2ex] =&~ \begin{cases}\frac{b}{w+b}\frac{b-1}{w+b-1}+\frac{w}{w+b}\frac{0}{w+b-1} & : x=0 \\ \frac{b}{w+b}\frac{w}{w+b-1}+\frac{w}{w+b}\frac{b}{w+b-1} & : x=1 \\ \frac{b}{w+b}\frac{0}{w+b-1}+\frac{w}{w+b}\frac{w-1}{w+b-1} & : x=2 \\ 0 & : \text{otherwise} \end{cases} \\[1ex] =&~ \dfrac{\binom{w}{x}\binom{b}{2-x}}{\binom{b+w}{2}}\quad\big[x\in \{0,1,2\}\big] \end{align}
Then you can use proof by induction to show $$\mathsf P(\sum_{i=1}^n I_i = x) = \dfrac{\binom{w}{x}\binom{b}{n-x}}{\binom{b+w}{2}}\quad\big[x\in \{\max(0,n-b), .., \min(n,w)\}\big]$$