Unbiasedness of OLS when using averages instead of full data? So my professor used the following so show that using averages instead of the full data set in OLS Regression will not cause any bias in our estimator. I understand everything up to the penultimate equality, as that would imply that Cov(X_id, X_d_bar) = Var(X_bar), which is either wrong or I'm really missing something. I tried for more than an hour to understand this and I'm sure that there must be some obvious thing that im just no seeing.

 A: We want to show $Cov(X_{id},\bar{X}_d)  = Var(\bar{X}_d)$.
Writing things out explicitly (make sure you follow each step and understand what properties of iid data, covariances, and variances we are using in each step):
$$Cov(X_{id},\bar{X}_d) = Cov\bigg(X_{id}, \frac{1}{n}\sum_{j=1}^n X_{jd}\bigg).$$
We know that $Cov(X,aY) = aCov(X,Y)$ so
$$Cov\bigg(X_{id}, \frac{1}{n}\sum_{j=1}^n X_{jd}\bigg) = \frac{1}{n}Cov\bigg(X_{id},\sum_{j=1}^n X_{jd}\bigg).$$
We also know that $Cov(X,Y+W) = Cov(X,Y) + Cov(X,W)$ so that
$$\frac{1}{n}Cov\bigg(X_{id},\sum_{i=1}^n X_{id}\bigg) = \frac{1}{n}\sum_{j=1}^n Cov(X_{id},X_{jd}).$$
Finally, since data is i.i.d., $Cov(X_{id},X_{jd}) = 0$ for $i\neq j$, so that
$$\frac{1}{n}\sum_{j=1}^n Cov(X_{id},X_{jd}) = \frac{1}{n}Cov(X_{id},X_{id}).$$
By definition, $Cov(X,X) = Var(X)$, so we showed that $Cov\bigg(X_{id}, \frac{1}{n}\sum_{j=1}^n X_{jd}\bigg) = \frac{1}{n}Var(X_{id})$. So it remains to show that $\frac{1}{n}Var(X_{id}) = Var(\bar{X}_d)$, which follows from
$$Var(\bar{X}_d)= Var\bigg(\frac{1}{n}\sum_{i=1}^n X_{id}\bigg) = \frac{1}{n^2}Var\bigg(\sum_{i=1}^n X_{id}\bigg) = \frac{1}{n^2} \sum_{i=1}^n Var(X_{id}) = \frac{1}{n}Var(X_{id}),$$
where the third equality follows because $X_{id}$ are independent and the last equality follows because all $X_{id}$ are identically distributed so that $\sum_{i=1}^n Var(X_{id}) = n Var(X_{id})$.
