8

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$?

Shaun
  • 44,997
Andrew H
  • 205
  • A comment about an application for this. One can use the results of X to map a point on one ellipsoid to another. If Y is a matrix of a known ellipsoid and A is the matrix representing the desired ellipsoid, multiplying a data point by X will move from Y to A. This is useful for example when calibrating a three axis magnetometer. The ideal output from the magnetometer is a vector that lies on a sphere (magnitude is uniform). Real magnetometers have errors that make it elliptical. X is the calibration matrix for the magnetometer output. – Andrew H Jan 02 '14 at 04:16

4 Answers4

6

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.

  • This works great. Thank you very much! – Andrew H Jan 02 '14 at 04:07
  • I must be confused here because I think I have a counter example to your claim "the solution exists if and only if $Y$ and $A$ have the same inertia". Let $J$ be the matrix of all ones. Consider $Y = 0$ and $A = I - \frac{1}{n} J$. These do not have the same inertia, as $Y$ has all zero eigenvalues and $A$ has only one zero eigenvalue; however, I can compute a solution which is $X =J$. Am I missing something subtle here or is there a calculation in the error in my solution? – Chris Harshaw Jun 03 '20 at 19:49
  • Indeed, I'm not sure why I wrote it like this. I had probably that $X$ must be nonsingular somewhere in my head. – Algebraic Pavel Jun 08 '20 at 00:46
4

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.

rschwieb
  • 153,510
2

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.

Doubt
  • 1,719
0

Suppose $Y$ is of full rank, but $A$ is not. You can't do what you want then.

Disintegrating By Parts
  • 87,459
  • 5
  • 65
  • 149