# Projection of a matrix on to unit ball

The projection of a vector on a unit ball has a closed form solution, given by $$\frac{x}{max(1,\|x\|)}$$.

Is there a similar formula for the projection of a matrix over a unit ball of matrices (matrix of values containing between -1 and 1) ?. Is there a closed form solution ?

• can you define the notion of unit ball of matrices more precisely? Unit ball among vectors has a clear definition that the norm should be equal to 1 (along with the geometric intuition). What is the notion of unit-ball of matrices in a similar fashion?. While restricting the individual matrix entries to {-1,1} does fix the frobenius norm to a constant, is this what you intended? May 19, 2017 at 5:40
• Yes. instead of fixing matrix entries to {-1,1}, the values are in [-1,1]. I think it correspond to the settings, where the maximum of the frobenius norm is a constant.
– Shew
May 19, 2017 at 6:21
• That might be impossible then. Note that the largest frobenius norm possible in that case would when each entry is in $\{-1,1\}$. Thus, whenever you need to "project" that matrix on the set you want by normalizing with frobenius norm (similar to vector case), the entries won't be anymore in $[-1,1]$. That being said, if your true intention is actually to project a given matrix on to that of the set of matrices such that entries are between $[-1,1]$, then that's possible. Note that the set of matrices you said is a convex set. Thus, finding the closest point is a convex problem. May 19, 2017 at 8:40
• If you are interested about that approach, I will write it down as an answer. May 19, 2017 at 8:40
• Yes, I want to project the matrix on to the set of matrices such that entries are between [-1,1]. Can you please provide the answer and explain it ?.
– Shew
May 19, 2017 at 10:32

Based on the comments from OP, the problem is to find the closest projection of a given matrix $A$ to the set of the matrices $\mathcal{C}$. Set of matrices $\mathcal{C}$ is defined as the set of all matrices whose entries lie in the interval $[-1,1]$. Thus OP's problem can be written as $$X^{*}=\arg\min_{X\in\mathcal{C}}||X-A||^2_F$$ First observation is that this is a convex problem. In fact, this is a straightforward problem to solve. Note that the objective can be written as $$||X-A||^2_F=\sum_{i,j}(X_{ij}-A_{ij})^2$$ It is easy to see that solution for one entry is independent of other. Thus, it is enough to find solutions for $X_{ij}$ individually. Since $X_{ij}$ is bound to lie in $[-1,1]$, its enough to find closest point of $A_{ij}$ in $[-1,1]$. This can be easily seen to be $$X_{ij}=\begin{cases}A_{ij}, & \mbox{if}~-1<A_{ij}<1\\-1, & \mbox{if}~-\infty<A_{ij}<-1 \\1, & \mbox{if}~~1<A_{ij}<\infty\end{cases}$$