I'm looking the snippet below from ESL. I'm a hard time deriving the variance term (last term in Eq. 7.12).
I started with \begin{align} \frac{1}{N}\sum_i ||h(x_i)||^2\sigma^2 \\ = \frac{1}{N}\sigma^2\sum_i ||h(x_i)||^2 \\ = \frac{1}{N} \sigma^2 \sum_i x_i^T(X^TX)^{-1}x_i\\ \end{align}
If I compare my last expression and their's it would seem the summation is equal to $p$. Assuming my above steps are correct, I can't see how this simplifies to $p$.