Some times in engineering, it is important to find an optimum subspace in which projecting on it satisfies some properties.
Let known matrices $A$ and $B$ belong to $\mathbb{R}^{p\times n}$ and $\|\cdot\|_F$ be Frobenius norm. How can I find the best subspace in which projecting $A$ on it is as close as possible to $B$? In other words how can I find a solution to the following constrained optimization problem? \begin{eqnarray} &&\min_P \|PA-B\|_F^2 \\ &&\mathrm{s.t. \ }P^T=P, \, P^2=P \end{eqnarray}
Update:
I have incorporated the symmetry property ($P^T=T$) in objective function as follows. Since $P$ is symmetric, $P$ can decompose as $P=Y+Y^T$ where $Y\in \mathbb{R}^{n\times n}$. Now, the optimization problem reduces to \begin{eqnarray} &&\min_Y \|C(Y+Y^T)-D\|_F^2 \\ &&\mathrm{s.t. \ }\, (Y+Y^T)^2=Y+Y^T, \end{eqnarray} Where $C=A^T$ and $D=B^T$.
Further, using "vec" operator, we get vec$(Y^T)=$$K$vec$(Y)$, where $K\in \mathbb{R}^{n\times n}$ is a unique and known matrix. Using "Kronecker product", our optimization problem will be reduced to \begin{eqnarray} &&\min_y \|(I\otimes C)(I+K)y-d\|_2^2 \\ &&\mathrm{s.t. \ }\, (Y+Y^T)^2=Y+Y^T, \end{eqnarray} where $y=$ vec$(Y)$ and $d=$ vec$(D)$.