# Matrix of orthogonal projection endomorphism

I can't understand this fact about orthogonal projections.

Considering the projection endomorphism $p_W:V\rightarrow V$ which is the projection endomorphism on a vector subspace $W\subset V$.

If an orthonormal basis $\mathscr{B}$ of $W$ is considered, the matrix of the endomorphism with respect to the standard basis $\mathscr{C}$ in $V$ is $AA^{T}$ where $A$ has on the columns the vectors of $\mathscr{B}$.

Is this right?

If so then I can't understand how can that be possible since the basis is orthonormal and $A$ must be an orthogonal matrix and therefore, for definition, $AA^{T}=I$. Is the matrix always $I$?

Am I missing something?

$A$ must be square to be orthogonal, in which case $W=V$ and the projection matrix is indeed the identity. If $\dim W<\dim V$, then $A$ will not be a square matrix.
The matrix of a projection is surely not satisfying $AA^T=I$ in general as it is not invertible: the projection of vectors orthogonal to $W$ has $0$ for images. Hence the kernel of the orthogonal projection is not $0$.