How to show that $\lim_{n\to\infty}\mathbb{P}\left(\bigg|\frac{1}{n}S_n-f(n)\bigg|>\varepsilon\right)=0$

Recall Chebyshev's inequality. If $\mathbb{E}X^2 < \infty$, then for all $\epsilon >0$

$$\mathbb{P}(|X-\mathbb{E}X| > \epsilon) \leq Var(X)/\epsilon^2$$ Now, note that $\mathbb{E}S_n:= \sum_{k=1}^n \mathbb{E}I_{X_k} = \sum_{k=1}^n\mathbb{P}(X_k)$ and thus $\mathbb{E}(S_n/n) = f(n)$. Applying Chebyshev's inequality, we get

$$\mathbb{P}(|S_n/n-f(n)| > \epsilon) = \mathbb{P}(|S_n/n-\mathbb{E}(S_n/n)| > \epsilon) $$$$\leq Var(S_n/n)/\epsilon^2 = Var(S_n)/(n^2\epsilon^2) = \frac{1}{n^2\epsilon^2}\sum_{k=1}^n Var(I_{X_k})$$

You can now use the answer of Michael Hardy to conclude what you want.

Or, you can do the following if we assume that $\mathbb{P}(X_k)$ is constant for all $k$. Then the last sum reduces to

$$\frac{1}{n}Var(I_{X_1}) \stackrel{n \to \infty}{\to} 0$$

Under this last assumption, the strong law of large numbers also implies almost sure convergence, which is stronger than what you need.


For $0\le p \le1,$ you have $p(1-p)\le 1/4.$

$$ \operatorname{var} (\mathbb I_i) = \Pr(\mathbb I_i=1)\Pr(\mathbb I_i = 0) \le \frac 1 4. $$ $$ \operatorname{var}\left( \frac {S_n} n \right) = \frac 1 {n^2} \sum_{i=1}^n \operatorname{var} (\mathbb I_i) \le \frac 1 {4n}. $$ Now proceed as when using Chebyshev's inequality to prove the weak law of large numbers.