Expression for correlation in terms of hat matrix H

In a linear regression model $Y = Xβ +ε$ with $E(ε) = 0$ and $E(εε^ T ) = σ^ 2$ I, let $e_1,..., e_n$ be the residuals obtained from the least squares fit. Derive an expression for the correlation between $e_i$ and $e_j$ , for $i \not= j$, in terms of the elements of the hat matrix $H$.

So far, I have $H=X(X^TX)^{-1}X^T$

$e=(I-H)Y$

$var(e)=(I-H)var(Y)(I-H)^T=var(Y)(I-H)$

Is what I have done so far correct? I am a bit stuck with what to do next now...

I am thinking it is something like $corr(e_i,e_j)=\dfrac{\sigma^2(I-h_{ij})}{\sigma^2\sqrt{var(e_i)var(e_j)}}=\dfrac{(I-h_{ij})}{\sqrt(I-h_{ii})(I-h_{jj})}$

but I am unsure?

1. You are confusing matrices with scalars. You have correctly derived the variance of the residual $\textbf{vector}$, this is a matrix. The diagonal elements of $\sigma^2(I-H)$ are the variances and the off-diagonal elements are the covariances. Think about that for a minute.
2. The diagonal elements of $(I-H)$ are given by $1-h_{11}, \ldots, 1-h_{nn}$. Thus, the variances in the denominator are given by....
• so in the denominator, where I have put $I$ it should be 1? does that also mean in the numerator where I have put $I$ it should be 0?