Solve for $X$ in $Y = X^TAX$. 
Suppose $$
Y = X^TAX,
$$ where $Y$ and $A$ are both known $n\times n$, real, symmetric matrices.  The unknown matrix $X$ is restricted to $n\times n$.

I think there should be at least one real valued solution for $X$.  How do I solve for $X$?      
 A: The solution of the problem exists if and only if the (symmetric) matrices $Y$ and $A$ have the same inertia, that is, they have the same number of positive, zero, and negative eigenvalues.
Every symmetric matrix $S$ can be transformed by a (nonsingular) congruent transformation to a diagonal matrix $D$ with $+1$, $-1$, and/or $0$ on the diagonal (consider them ordered, e.g., $1$'s first, then $0$'s, then $-1$'s). How? Let $S=U\Lambda U^T$ be the eigen-decomposition of $S$ such that $\Lambda=\mathrm{diag}(\lambda_1,\ldots,\lambda_n)$, $\lambda_1\geq\cdots\geq\lambda_n$. Then $S=(UC)\mathrm{sgn}(\Lambda)(CU^T)=(UC)\mathrm{sgn}(\Lambda)(UC)^T$, where $C$ is a diagonal matrix such that $(C)_{ii}=|\lambda_i|^{1/2}$ if $\lambda_i\neq 0$ and $(C)_{ii}=1$ (or whatever nonzero) otherwise. With $P=UC$ and $D=\mathrm{sgn}(\Lambda)$, we get the desired transformation $S=PDP^T$ introduced above.
Now, since both $Y$ and $A$ must have the same inertia (see the Sylvester's law of inertia), both $Y$ and $A$ can be congruently transformed to the same diagonal matrix $D$ with $1$'s, $-1$'s, and/or $0$'s on the diagonal. That is, there are nonsingular matrices $P_Y$ and $P_A$ such that
$$
Y=P_YDP_Y^T \quad\text{and}\quad A=P_ADP_A^T.
$$
Therefore,
$$
P_Y^{-1}YP_Y^{-T}=P_A^{-1}AP_A^{-T}
$$
and hence
$$
Y=P_YP_A^{-1}AP_A^{-T}P_Y^T=(P_YP_A^{-1})A(P_YP_A^{-1})^T.
$$
A matrix $X$ you look for is then $X=(P_YP_A^{-1})^T$. Saying "a matrix", because $X$ (same as the congruent transformations defined above) are not unique.
A: A solution is not possible for all $Y$ and $A$.
For example, suppose $\operatorname{rank}(Y)>\operatorname{rank}(A)$. Then $\operatorname{rank}X^\top AX\leq\operatorname{rank}(A)<\operatorname{rank}(Y)$, so we can't hope for equality.
Another restriction is that $\det(Y)=\det(X)^2\det(A)$. So for example, if the determinant of $Y$ and determinant of $A$ have opposite signs, no $X$ can exist.
The most natural case where such an equation makes sense is in the context of symmetric bilinear forms. In that case, it's known that if $Y$ and $A$ have the same signatures, then there exists a nonsingular $X$ satisfying the equation, and the proof of Sylvester's law of inertia provides a method to calculate it.
A: Consider the $2\times2$ case with
\begin{align}
X =
\begin{bmatrix}
x_1 & x_3\\ x_2 & x_4
\end{bmatrix},\quad A=
\begin{bmatrix}
a_1 & a_3\\ a_2 & a_4
\end{bmatrix},\quad Y=
\begin{bmatrix}
y_1 & y_3\\ y_2 & y_4
\end{bmatrix}.
\end{align}
Then
\begin{align}
\begin{bmatrix}
y_1 & y_3\\ y_2 & y_4
\end{bmatrix}=
\begin{bmatrix}
x_1(a_1x_1+a_3x_2)+x_2(a_2x_1+a_4x_2) & x_1(a_1x_3+a_3x_4)+x_2(a_2x_3+a_4x_4)\\ x_3(a_1x_1+a_3x_2)+x_4(a_2x_1+a_4x_2) & x_3(a_1x_3+a_3x_4)+x_4(a_2x_3+a_4x_4)
\end{bmatrix}
\end{align}
This may be generalized to the $n\times n$ case, but if $n$ is small and this is a practical application, perhaps entering these nonlinear equations into a computer algebra system will suffice.
A: Suppose $Y$ is of full rank, but $A$ is not. You can't do what you want then.
