# Law of large numbers on a random number of samples

Let $$X_1,\dots,X_n$$ be $$n$$ iid random variables, each with expectation $$1$$. From the law of large numbers one has $$\lim_{n\to\infty}\frac{1}{n}\sum_{i=1}^n X_i = 1 \text{ a.s.}$$

Now let $$Y_n$$ be a random variable such that $$\lim_{n\to\infty}Y_n = y > 0 \text{ a.s.}$$

Let $$a_n\in\mathbb{R}$$ be an increasing sequence such that $$\lim_{n\to\infty}a_n=\infty$$ and let $$K_n = Y_n a_n$$

How may I prove that $$\lim_{n\to\infty}\frac{1}{K_n}\sum_{i=1}^{K_n} X_i = 1 \text{ a.s.}$$

## 2 Answers

For simplicity, assume that $$X_i$$ have expectation $$0$$. Then for all $$N$$, $$\tag{*} \left\lvert \frac 1{K_n}\sum_{i=1}^{K_n}X_i\right\rvert \leqslant \sup_{\ell\geqslant N}\frac 1{ \ell}\left\lvert\sum_{i=1}^{\ell}X_i\right\rvert +\mathbf 1\left\{K_n\leqslant N\right\}\left\lvert \frac 1{K_n}\sum_{i=1}^{K_n}X_i\right\rvert.$$ Take the $$\limsup_{n\to +\infty}$$ to see that the inequality $$\limsup_{n\to +\infty}\left\lvert \frac 1{K_n}\sum_{i=1}^{K_n}X_i\right\rvert \leqslant \sup_{\ell\geqslant N}\frac 1{ \ell}\left\lvert\sum_{i=1}^{\ell}X_i\right\rvert$$ holds almost surely (the term in the right hand side of (*) is zero for almost all $$\omega$$ and for $$n\geqslant N(\omega)$$)). Then conclude by the classical law of large numbers.

We claim that $$A:=(\frac{1}{n}\sum_{i=1}^n X_i\to 1)\cap (K_n\to\infty)\subseteq (\frac{1}{K_n} \sum_{i=1}^{K_n} X_i\to 1).$$ As the first set is a finite intersection of almost sure sets, it is almost sure, and thus, this would prove your statement.

Now, let $$\omega\in A$$ and let $$\varepsilon>0$$. Then, there exists $$N(\omega)$$ such that $$|\frac{1}{n}\sum_{i=1}^n X_i(\omega)-1|\leq \varepsilon$$ for all $$n\geq N(\omega)$$. Now, by assumption there exists some $$M(\omega)$$ such that $$K_n(\omega)\geq N(\omega)$$ for all $$n\geq M(\omega)$$. Adding these two statements, we get that for all $$n\geq M(\omega)$$,

$$\left|\frac{1}{K_n(\omega)}\sum_{i=1}^{K_n(\omega)} X_i(\omega) -1\right|\leq \varepsilon,$$ which was what we wanted.