I know this question has already been asked before but I'm not quite sure I've understood them well enough.
I want to find the projection $\vec{v}_{proj}$ of $\vec{v}\in V$ on the span of the vectors $\vec{a_i}\in V$, which is a subspace of $V$.
What is the matrix that represent this projection in an arbitrary basis $\mathscr{B}$, and if it isn't entirely intuitive, why?
Choose an orthonormal basis of that subspace and extend to an orthonormal basis of the whole space. Then the projection matrix with respect to this basis will of the form $P=\left({I\mid Z\over Z\mid Z}\right)$ where $I$ is the identity matrix of size = dimension of the subspace, and $Z$ represent zero matrices of appr0priate sizes to make the whole matrix $n\times n$.
Now for an arbitrary basis assuimg $Q$ is the change-of-basis matrix the projection matrix would be $Q^{-1}PQ$.