Given tall matrices $A$ and $Y$ and the following overdetermined linear system in square matrix $X$


$$AX=Y$$


is there an explicit formula for the least-squares solution if $X$ is constrained to be symmetric?



Symmetric linear least-squares solution
I assume that $A$ is onto, so that $H:=A^TA$ is positive definite. Minimizing $\|AX-Y\|\_F^2$ in Frobenius norm (the least square) among symmetric matrices $X$ yields the optimality condition that
$$\langle AS,AX-Y\rangle=0$$
for every symmetric $S$. This amounts to saying that $A^T(AX-Y)$ is skew-symmetric. In other words, $X$ is the solution of the Lyapunov equation
$$HX+XH=A^TY+Y^TA=:K.$$
The explicit formula is
$$X=\int\_0^\infty e^{-tH}Ke^{-tH}dt.$$ 


