Suppose we have a real matrix $K$ which is a gram matrix of $X$, $K = X^TX$, for some unknown $X$. In this case, would $X$ be unique so that we may have a function $$ f(K) = X? $$
Can we recover $X$ from $K = X^T X$?
2 Answers
$X$ cannot possibly be unique, because if I replace $X$ by $QX$ where $Q$ is orthogonal then I get another such factorization. However, you can choose $X$ upper triangular, in which case this is called the Cholesky factorization, and it is unique if $K$ is positive definite. (Simply knowing that there exists $X$ such that $K=X^T X$ only tells you that $K$ is positive semidefinite.)
Note that the uniqueness already fails for $n=1$: $$1=1^2=(-1)^2.$$
Besides multiplying $X$ by an orthogonal matrix on the left, you can multiply it on the right by any orthogonal matrix that commutes with $K$ (if there's any, other than the identity).
Also, if the size of $X$ is not fixed, you have things like $$ [1]=\begin{bmatrix}1/\sqrt2\\1/\sqrt2\end{bmatrix}^T\begin{bmatrix}1/\sqrt2\\1/\sqrt2\end{bmatrix} =\begin{bmatrix}1/\sqrt3\\1/\sqrt3\\1/\sqrt3\end{bmatrix}^T\begin{bmatrix}1/\sqrt3\\1/\sqrt3\\1/\sqrt3\end{bmatrix}=\cdots $$ and infinitely many other possible combinations.