$ \newcommand{\<}{\left \langle} \newcommand{\>}{\right \rangle} $
I have fought 2 vectors(?!) in basis which are
$M_1 = \begin{bmatrix} 1 & 0\\ 0 & -1\\ \end{bmatrix}$ and $M_2 = \begin{bmatrix} 0 & 1\\ 1 & 0\\ \end{bmatrix}$
However, I do not know how to do the orthogonal projection of a matrix onto the subspace. Can anyone please help me to solve this problem number 2?
Consider the inner product space $\mathit M_{22}$ with the standard inner product $\<A,B\> = tr(AB^T)$
(1) Find an orthogonal basis for the subspace $\mathit W = \{A \in M_{22}|A^T = A$ and $\mathit trA=0\}$ and explain the reason.
(2) For $\mathit A = \begin{bmatrix} 0 & 1\\ 1 & 1\\ \end{bmatrix} in \space M_{22}$, find $\mathit B \in W$ such that $\|\mathit A - B\|$ ≤ $\|\mathit A - C\|$ for any $\mathit C \in W$.
Since you have an orthogonal basis $\{M_1, M_2\}$ for $W$, the orthogonal projection of $A$ onto the subspace $W$ is simply $$B= \left\langle A,\frac{M_1}{\|M_1\|}\right\rangle \frac{M_1}{\|M_1\|} + \left\langle A,\frac{M_2}{\|M_2\|}\right\rangle \frac{M_2}{\|M_2\|}.$$
Do you know how to prove that this orthogonal projection indeed minimizes the distance from $A$ to $W$?