Relationship between X and its Projection Matrix Suppose $Q_{1}$ is an $n\times p $ matrix (derived from the $QR$ Decomposition of $X$) whose columns provide an orthonormal basis for the subspace ${\chi}$ of $\mathbb R^{n}$ spanned by the columns of an $n\times p$ matrix $X = (x_1,...,x_p)$. The hat matrix $H = Q_{1}Q_{1}^{T}$ projects vectors orthogonally onto $X$. 
Suppose the first two rows of $X$ are the same. Explain why the first two rows of $H$ are the same. 
 A: If the first two rows of $X$ are equal, then the first two rows of $Q_1$ are equal: the columns of $Q_1$ are obtained by applying Gram-Schmidt to the columns of $X$. So each row of $Q$ is obtained by doing the same operations to the corresponding row of $X$. 
As for $H$, its first row is obtained by doing "row times colum" with the first row of $Q_1$ and all the other rows (because of the transpose). If the second row of $Q_1$ is the same, the same numbers will appear. Thus the first two rows of $H$ will be equal. 
A: In the following, let $a = (\alpha_1,\alpha_2,\alpha_3)$ denote an element of $\mathbb{R}^3$ and $A =(a_1,a_2,a_3)$, where $a_i =\alpha_{1i},\dots,\alpha_{mi}) \in \mathbb{R}^m$, denote an $m\times 3$ matrix with elements in $\mathbb{R}$. Then the  set $ \mathcal{W} = \{(\nu_1,\nu_2,\dots ,\nu_n) \in \mathbb{R}^n:  \nu_1 = \nu_2\}$ is an $n-1$ dimensional vector 
subspace of $\mathbb{R}^n$. If the columns of the matrix $( x_1,\dots ,x_p) = X$ lie in $\mathcal{W}$ and if $y = (\eta_1,\dots ,\eta_p)$ lies in $\mathbb{R}^p$ then $ Xy = \sum_p x_i\eta_i$ also lies in $\mathcal{W}$ because, of course, linear cominations of vectors are vectors.  Indeed, for any matrix $Y$ whose columns lie in $\mathcal{W}^p$,
the columns of $Z = XY$ lie in $\mathcal{W}$ so all columns of $Z$ satisfy $\zeta_1 = \zeta_2$ and thus this condition holds
for $Q_1 = XR^{-1}$ as well as $H = Q_1Q_1^T = XR^{-1}Q_1^T$.
