In practical situations a sample is always of finite size. Let that size be \( n \). The expectation value of a sample, the sample mean, is then defined as follows:
$$ \bar{x}_n \equiv \frac{1}{n}\sum_{k=1}^n x_k $$The sample variance is:
$$ \mathrm{var}(x) \equiv \frac{1}{n}\sum_{k=1}^n (x_k - \bar{x}_n)^2 $$its square root being the standard deviation of the sample. The sample covariance is:
$$ \mathrm{cov}(x)\equiv\frac{1}{n}\sum_{kl}(x_k - \bar{x}_n)(x_l - \bar{x}_n) $$