Let X is nxp (design) matrix and $H=X({X^\top}X)^{-1}{X^\top}$. We define $h_{ij}$ is an i-th row and j-th column entry of H and $x_i^\top$ is i-th row of $X$ , then show $$h_{ii}={x_i^\top}({X^\top}X)^{-1}x_i$$ and $$h_{ji}={x_j^\top}({X^\top}X)^{-1}x_i$$
I tried with definition of matrix multiplication of each entry, but was not straight forward. Anyone who has better idea or can solve with my approach?
Thanks in advance!
For any matrix $A$, its $ij$-th entry is given by
$ a_{ij} = e_i^T A e_j $
where $e_k$ is $k$-th column of the identity matrix. Hence,
$ h_{ij} = e_i^T X (X^T X)^{-1} X^T e_j $
Recognizing that $e_i^T X = ( X^T e_i )^T $ and $X^T e_i $ is the $i$-th column of $X^T$ which is the $i$-th row of $X$, which is $x_i$, hence
$h_{ij} = x_i^T(X^T X)^{-1} x_j $
And letting $j = i$ then
$h_{ii} = x_i^T (X^T X)^{-1} x_i $