Solving the matrix equation $X^tA+A^tX=0$ for $X$ in terms of $A$












8












$begingroup$


Suppose that I know $A$. And all matrices in the equation are square matrices. I want to solve for $X$ given that



$$X^tA + A^tX = 0$$



I'm not really good at matrix calculus. Is it possible to solve this problem in the sense that we find a closed form solution for $X$ in terms of $A$ and possibly some other vector B (as a free parameter, if necessary)? For example, when $A = I$, we see that $X=B$ for any anti-symmetric matrix $B$.



The motivation for this question comes from computer vision. We know that a homography $H$ between two photos is induced by a plane in space if and only if $H^tF$ is anti-symmetric where $F$ is the fundamental matrix. I also know that $F$ can be parametrized as $F=[e]_{times}M$ where $M$ is invertible. Now I want to find a general form for $H$. Hence, this question.



Edit: Since the general case might be too broad and challenging, let's narrow down our attention to the simpler case where $A$ and $X$ are $3 times 3$ matrices and $A$ is not invertible. The general case seems very interesting too.










share|cite|improve this question











$endgroup$

















    8












    $begingroup$


    Suppose that I know $A$. And all matrices in the equation are square matrices. I want to solve for $X$ given that



    $$X^tA + A^tX = 0$$



    I'm not really good at matrix calculus. Is it possible to solve this problem in the sense that we find a closed form solution for $X$ in terms of $A$ and possibly some other vector B (as a free parameter, if necessary)? For example, when $A = I$, we see that $X=B$ for any anti-symmetric matrix $B$.



    The motivation for this question comes from computer vision. We know that a homography $H$ between two photos is induced by a plane in space if and only if $H^tF$ is anti-symmetric where $F$ is the fundamental matrix. I also know that $F$ can be parametrized as $F=[e]_{times}M$ where $M$ is invertible. Now I want to find a general form for $H$. Hence, this question.



    Edit: Since the general case might be too broad and challenging, let's narrow down our attention to the simpler case where $A$ and $X$ are $3 times 3$ matrices and $A$ is not invertible. The general case seems very interesting too.










    share|cite|improve this question











    $endgroup$















      8












      8








      8





      $begingroup$


      Suppose that I know $A$. And all matrices in the equation are square matrices. I want to solve for $X$ given that



      $$X^tA + A^tX = 0$$



      I'm not really good at matrix calculus. Is it possible to solve this problem in the sense that we find a closed form solution for $X$ in terms of $A$ and possibly some other vector B (as a free parameter, if necessary)? For example, when $A = I$, we see that $X=B$ for any anti-symmetric matrix $B$.



      The motivation for this question comes from computer vision. We know that a homography $H$ between two photos is induced by a plane in space if and only if $H^tF$ is anti-symmetric where $F$ is the fundamental matrix. I also know that $F$ can be parametrized as $F=[e]_{times}M$ where $M$ is invertible. Now I want to find a general form for $H$. Hence, this question.



      Edit: Since the general case might be too broad and challenging, let's narrow down our attention to the simpler case where $A$ and $X$ are $3 times 3$ matrices and $A$ is not invertible. The general case seems very interesting too.










      share|cite|improve this question











      $endgroup$




      Suppose that I know $A$. And all matrices in the equation are square matrices. I want to solve for $X$ given that



      $$X^tA + A^tX = 0$$



      I'm not really good at matrix calculus. Is it possible to solve this problem in the sense that we find a closed form solution for $X$ in terms of $A$ and possibly some other vector B (as a free parameter, if necessary)? For example, when $A = I$, we see that $X=B$ for any anti-symmetric matrix $B$.



      The motivation for this question comes from computer vision. We know that a homography $H$ between two photos is induced by a plane in space if and only if $H^tF$ is anti-symmetric where $F$ is the fundamental matrix. I also know that $F$ can be parametrized as $F=[e]_{times}M$ where $M$ is invertible. Now I want to find a general form for $H$. Hence, this question.



      Edit: Since the general case might be too broad and challenging, let's narrow down our attention to the simpler case where $A$ and $X$ are $3 times 3$ matrices and $A$ is not invertible. The general case seems very interesting too.







      linear-algebra matrix-equations matrix-calculus matrix-decomposition computer-vision






      share|cite|improve this question















      share|cite|improve this question













      share|cite|improve this question




      share|cite|improve this question








      edited Dec 27 '18 at 20:26







      stressed out

















      asked Dec 27 '18 at 19:46









      stressed outstressed out

      6,4931939




      6,4931939






















          1 Answer
          1






          active

          oldest

          votes


















          3












          $begingroup$

          Edit: you might look into methods for solving Sylvester Equations which are of the form $AX+XB=C$.



          General Case



          I doubt this is the best way to solve the equation, but it is at least one way to solve it.



          Write,
          $$
          X =
          begin{bmatrix}
          | & | & & | \
          x_1 & x_2 & & x_n \
          | & | & & | \
          end{bmatrix}
          , ~~
          A =
          begin{bmatrix}
          | & | & & | \
          a_1 & a_2 & & a_n \
          | & | & & | \
          end{bmatrix}
          $$



          Then the $i,j$ entry of $X^TA+A^TX = 0$ gives,
          $$
          x_i^Ta_j + a_i^Tx_j = a_j^Tx_i + a_i^Tx_j = 0
          $$



          We can rewrite this as a matrix vector equation $tilde{A}x = 0$
          $$
          begin{bmatrix}
          a_1^T & & & & \
          a_2^T & a_1^T & & & \
          a_3^T & & a_1^T & & \
          vdots & & &ddots & \
          a_n^T & & & & a_1^T \ hline
          a_2^T & a_1^T & & cdots & \
          & a_2^T \
          & a_3^T & a_2^T & & \
          & vdots & & ddots \
          & a_n^T & & & a_2^T \hline
          &&vdots
          end{bmatrix}
          begin{bmatrix}
          x_1 \
          x_2 \
          vdots \
          x_n
          end{bmatrix}
          = 0
          $$

          where the matrix $tilde{A}$ is size $n^2times n^2$ and the vector $x$ is size $n^2times 1$.



          Note that a lot of the rows are identical. In particular, there are at most $n(n-1)/2$ unique rows. This tells us that the null space of $tilde{A}$ is at least dimension $n^2-n(n-1)/2 = n(n+1)/2$. Each element of the null space of $tilde{A}$ gives a solution to the original equation, so there are at least this many solutions.



          So finding solutions to the original equation amounts to finding vectors in the null space of this new matrix (there are many existing libraries to do this).



          3 by 3 case



          I used mathematica and the above method to find all solutions $X$. We define entries of $A$ by
          $$
          A = begin{bmatrix}
          A1 & B1 & C1 \
          A2 & B2 & C2 \
          A3 & B3 & C3 \
          end{bmatrix}
          $$



          We input this to mathematica, compute the null space of $tilde{A}$ as defined above, and then reshape vectors from the null space.



          AA = {{A1, A2, A3}}[Transpose];
          BB = {{B1, B2, B3}}[Transpose];
          CC = {{C1, C2, C3}}[Transpose];

          A = ArrayFlatten[{{AA[Transpose], 0, 0}, {BB[Transpose],
          AA[Transpose], 0}, {CC[Transpose], 0,
          AA[Transpose]}, {BB[Transpose], AA[Transpose], 0}, {0,
          BB[Transpose], 0}, {0, BB[Transpose],
          CC[Transpose]}, {CC[Transpose], 0, AA[Transpose]}, {0,
          CC[Transpose], BB[Transpose]}, {0, 0, CC[Transpose]}}];

          NA = NullSpace[A]


          Then the solutions are linear combinations of the following:
          $$
          X1=
          left(
          begin{array}{ccc}
          -frac{text{A3} text{B2} text{C1}-text{A2} text{B1} text{C3}}{text{C1} (text{B2} text{C1}-text{B1} text{C2})} & -frac{text{B2} (text{B3} text{C1}-text{B1} text{C3})}{text{C1} (text{B2} text{C1}-text{B1} text{C2})} & -frac{text{C3}}{text{C1}} \
          -frac{text{A1} text{B1} text{C3}-text{A3} text{B1} text{C1}}{text{C1} (text{B2} text{C1}-text{B1} text{C2})} & frac{text{B1} text{B3} text{C1}-text{B1}^2 text{C3}}{text{C1} (text{B2} text{C1}-text{B1} text{C2})} & 0 \
          -frac{text{A1} text{B2}-text{A2} text{B1}}{text{B1} text{C2}-text{B2} text{C1}} & 0 & 1 \
          end{array}
          right)
          $$



          $$
          X2=
          left(
          begin{array}{ccc}
          -frac{text{A2}}{text{C1}} & -frac{text{B2}}{text{C1}} & -frac{text{C2}}{text{C1}} \
          frac{text{A1}}{text{C1}} & frac{text{B1}}{text{C1}} & 1 \
          0 & 0 & 0 \
          end{array}
          right)
          $$



          $$
          X3=
          left(
          begin{array}{ccc}
          -frac{text{A3} text{C2}-text{A2} text{C3}}{text{B1} text{C2}-text{B2} text{C1}} & -frac{text{B3} text{C2}-text{B2} text{C3}}{text{B1} text{C2}-text{B2} text{C1}} & 0 \
          -frac{text{A1} text{C3}-text{A3} text{C1}}{text{B1} text{C2}-text{B2} text{C1}} & -frac{text{B3} text{C1}-text{B1} text{C3}}{text{B2} text{C1}-text{B1} text{C2}} & 0 \
          -frac{text{A2} text{C1}-text{A1} text{C2}}{text{B1} text{C2}-text{B2} text{C1}} & 1 & 0 \
          end{array}
          right)
          $$






          share|cite|improve this answer











          $endgroup$













          • $begingroup$
            This is an interesting answer. I need some more time to digest your calculations. One thing I learned from this is that mathematica can do algebraic manipulations with symbols. That's great. At one point you say that there are at least $n(n+1)/2$. What do you mean by that? Shouldn't there be infinitely many solutions always?
            $endgroup$
            – stressed out
            Dec 27 '18 at 21:33








          • 1




            $begingroup$
            Mathematica is great for symbolic manipulations! You're right that there are infinitely many solutions. I should have said linearly independent solutions.
            $endgroup$
            – tch
            Dec 27 '18 at 21:37











          Your Answer





          StackExchange.ifUsing("editor", function () {
          return StackExchange.using("mathjaxEditing", function () {
          StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
          StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
          });
          });
          }, "mathjax-editing");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "69"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          noCode: true, onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3054299%2fsolving-the-matrix-equation-xtaatx-0-for-x-in-terms-of-a%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          3












          $begingroup$

          Edit: you might look into methods for solving Sylvester Equations which are of the form $AX+XB=C$.



          General Case



          I doubt this is the best way to solve the equation, but it is at least one way to solve it.



          Write,
          $$
          X =
          begin{bmatrix}
          | & | & & | \
          x_1 & x_2 & & x_n \
          | & | & & | \
          end{bmatrix}
          , ~~
          A =
          begin{bmatrix}
          | & | & & | \
          a_1 & a_2 & & a_n \
          | & | & & | \
          end{bmatrix}
          $$



          Then the $i,j$ entry of $X^TA+A^TX = 0$ gives,
          $$
          x_i^Ta_j + a_i^Tx_j = a_j^Tx_i + a_i^Tx_j = 0
          $$



          We can rewrite this as a matrix vector equation $tilde{A}x = 0$
          $$
          begin{bmatrix}
          a_1^T & & & & \
          a_2^T & a_1^T & & & \
          a_3^T & & a_1^T & & \
          vdots & & &ddots & \
          a_n^T & & & & a_1^T \ hline
          a_2^T & a_1^T & & cdots & \
          & a_2^T \
          & a_3^T & a_2^T & & \
          & vdots & & ddots \
          & a_n^T & & & a_2^T \hline
          &&vdots
          end{bmatrix}
          begin{bmatrix}
          x_1 \
          x_2 \
          vdots \
          x_n
          end{bmatrix}
          = 0
          $$

          where the matrix $tilde{A}$ is size $n^2times n^2$ and the vector $x$ is size $n^2times 1$.



          Note that a lot of the rows are identical. In particular, there are at most $n(n-1)/2$ unique rows. This tells us that the null space of $tilde{A}$ is at least dimension $n^2-n(n-1)/2 = n(n+1)/2$. Each element of the null space of $tilde{A}$ gives a solution to the original equation, so there are at least this many solutions.



          So finding solutions to the original equation amounts to finding vectors in the null space of this new matrix (there are many existing libraries to do this).



          3 by 3 case



          I used mathematica and the above method to find all solutions $X$. We define entries of $A$ by
          $$
          A = begin{bmatrix}
          A1 & B1 & C1 \
          A2 & B2 & C2 \
          A3 & B3 & C3 \
          end{bmatrix}
          $$



          We input this to mathematica, compute the null space of $tilde{A}$ as defined above, and then reshape vectors from the null space.



          AA = {{A1, A2, A3}}[Transpose];
          BB = {{B1, B2, B3}}[Transpose];
          CC = {{C1, C2, C3}}[Transpose];

          A = ArrayFlatten[{{AA[Transpose], 0, 0}, {BB[Transpose],
          AA[Transpose], 0}, {CC[Transpose], 0,
          AA[Transpose]}, {BB[Transpose], AA[Transpose], 0}, {0,
          BB[Transpose], 0}, {0, BB[Transpose],
          CC[Transpose]}, {CC[Transpose], 0, AA[Transpose]}, {0,
          CC[Transpose], BB[Transpose]}, {0, 0, CC[Transpose]}}];

          NA = NullSpace[A]


          Then the solutions are linear combinations of the following:
          $$
          X1=
          left(
          begin{array}{ccc}
          -frac{text{A3} text{B2} text{C1}-text{A2} text{B1} text{C3}}{text{C1} (text{B2} text{C1}-text{B1} text{C2})} & -frac{text{B2} (text{B3} text{C1}-text{B1} text{C3})}{text{C1} (text{B2} text{C1}-text{B1} text{C2})} & -frac{text{C3}}{text{C1}} \
          -frac{text{A1} text{B1} text{C3}-text{A3} text{B1} text{C1}}{text{C1} (text{B2} text{C1}-text{B1} text{C2})} & frac{text{B1} text{B3} text{C1}-text{B1}^2 text{C3}}{text{C1} (text{B2} text{C1}-text{B1} text{C2})} & 0 \
          -frac{text{A1} text{B2}-text{A2} text{B1}}{text{B1} text{C2}-text{B2} text{C1}} & 0 & 1 \
          end{array}
          right)
          $$



          $$
          X2=
          left(
          begin{array}{ccc}
          -frac{text{A2}}{text{C1}} & -frac{text{B2}}{text{C1}} & -frac{text{C2}}{text{C1}} \
          frac{text{A1}}{text{C1}} & frac{text{B1}}{text{C1}} & 1 \
          0 & 0 & 0 \
          end{array}
          right)
          $$



          $$
          X3=
          left(
          begin{array}{ccc}
          -frac{text{A3} text{C2}-text{A2} text{C3}}{text{B1} text{C2}-text{B2} text{C1}} & -frac{text{B3} text{C2}-text{B2} text{C3}}{text{B1} text{C2}-text{B2} text{C1}} & 0 \
          -frac{text{A1} text{C3}-text{A3} text{C1}}{text{B1} text{C2}-text{B2} text{C1}} & -frac{text{B3} text{C1}-text{B1} text{C3}}{text{B2} text{C1}-text{B1} text{C2}} & 0 \
          -frac{text{A2} text{C1}-text{A1} text{C2}}{text{B1} text{C2}-text{B2} text{C1}} & 1 & 0 \
          end{array}
          right)
          $$






          share|cite|improve this answer











          $endgroup$













          • $begingroup$
            This is an interesting answer. I need some more time to digest your calculations. One thing I learned from this is that mathematica can do algebraic manipulations with symbols. That's great. At one point you say that there are at least $n(n+1)/2$. What do you mean by that? Shouldn't there be infinitely many solutions always?
            $endgroup$
            – stressed out
            Dec 27 '18 at 21:33








          • 1




            $begingroup$
            Mathematica is great for symbolic manipulations! You're right that there are infinitely many solutions. I should have said linearly independent solutions.
            $endgroup$
            – tch
            Dec 27 '18 at 21:37
















          3












          $begingroup$

          Edit: you might look into methods for solving Sylvester Equations which are of the form $AX+XB=C$.



          General Case



          I doubt this is the best way to solve the equation, but it is at least one way to solve it.



          Write,
          $$
          X =
          begin{bmatrix}
          | & | & & | \
          x_1 & x_2 & & x_n \
          | & | & & | \
          end{bmatrix}
          , ~~
          A =
          begin{bmatrix}
          | & | & & | \
          a_1 & a_2 & & a_n \
          | & | & & | \
          end{bmatrix}
          $$



          Then the $i,j$ entry of $X^TA+A^TX = 0$ gives,
          $$
          x_i^Ta_j + a_i^Tx_j = a_j^Tx_i + a_i^Tx_j = 0
          $$



          We can rewrite this as a matrix vector equation $tilde{A}x = 0$
          $$
          begin{bmatrix}
          a_1^T & & & & \
          a_2^T & a_1^T & & & \
          a_3^T & & a_1^T & & \
          vdots & & &ddots & \
          a_n^T & & & & a_1^T \ hline
          a_2^T & a_1^T & & cdots & \
          & a_2^T \
          & a_3^T & a_2^T & & \
          & vdots & & ddots \
          & a_n^T & & & a_2^T \hline
          &&vdots
          end{bmatrix}
          begin{bmatrix}
          x_1 \
          x_2 \
          vdots \
          x_n
          end{bmatrix}
          = 0
          $$

          where the matrix $tilde{A}$ is size $n^2times n^2$ and the vector $x$ is size $n^2times 1$.



          Note that a lot of the rows are identical. In particular, there are at most $n(n-1)/2$ unique rows. This tells us that the null space of $tilde{A}$ is at least dimension $n^2-n(n-1)/2 = n(n+1)/2$. Each element of the null space of $tilde{A}$ gives a solution to the original equation, so there are at least this many solutions.



          So finding solutions to the original equation amounts to finding vectors in the null space of this new matrix (there are many existing libraries to do this).



          3 by 3 case



          I used mathematica and the above method to find all solutions $X$. We define entries of $A$ by
          $$
          A = begin{bmatrix}
          A1 & B1 & C1 \
          A2 & B2 & C2 \
          A3 & B3 & C3 \
          end{bmatrix}
          $$



          We input this to mathematica, compute the null space of $tilde{A}$ as defined above, and then reshape vectors from the null space.



          AA = {{A1, A2, A3}}[Transpose];
          BB = {{B1, B2, B3}}[Transpose];
          CC = {{C1, C2, C3}}[Transpose];

          A = ArrayFlatten[{{AA[Transpose], 0, 0}, {BB[Transpose],
          AA[Transpose], 0}, {CC[Transpose], 0,
          AA[Transpose]}, {BB[Transpose], AA[Transpose], 0}, {0,
          BB[Transpose], 0}, {0, BB[Transpose],
          CC[Transpose]}, {CC[Transpose], 0, AA[Transpose]}, {0,
          CC[Transpose], BB[Transpose]}, {0, 0, CC[Transpose]}}];

          NA = NullSpace[A]


          Then the solutions are linear combinations of the following:
          $$
          X1=
          left(
          begin{array}{ccc}
          -frac{text{A3} text{B2} text{C1}-text{A2} text{B1} text{C3}}{text{C1} (text{B2} text{C1}-text{B1} text{C2})} & -frac{text{B2} (text{B3} text{C1}-text{B1} text{C3})}{text{C1} (text{B2} text{C1}-text{B1} text{C2})} & -frac{text{C3}}{text{C1}} \
          -frac{text{A1} text{B1} text{C3}-text{A3} text{B1} text{C1}}{text{C1} (text{B2} text{C1}-text{B1} text{C2})} & frac{text{B1} text{B3} text{C1}-text{B1}^2 text{C3}}{text{C1} (text{B2} text{C1}-text{B1} text{C2})} & 0 \
          -frac{text{A1} text{B2}-text{A2} text{B1}}{text{B1} text{C2}-text{B2} text{C1}} & 0 & 1 \
          end{array}
          right)
          $$



          $$
          X2=
          left(
          begin{array}{ccc}
          -frac{text{A2}}{text{C1}} & -frac{text{B2}}{text{C1}} & -frac{text{C2}}{text{C1}} \
          frac{text{A1}}{text{C1}} & frac{text{B1}}{text{C1}} & 1 \
          0 & 0 & 0 \
          end{array}
          right)
          $$



          $$
          X3=
          left(
          begin{array}{ccc}
          -frac{text{A3} text{C2}-text{A2} text{C3}}{text{B1} text{C2}-text{B2} text{C1}} & -frac{text{B3} text{C2}-text{B2} text{C3}}{text{B1} text{C2}-text{B2} text{C1}} & 0 \
          -frac{text{A1} text{C3}-text{A3} text{C1}}{text{B1} text{C2}-text{B2} text{C1}} & -frac{text{B3} text{C1}-text{B1} text{C3}}{text{B2} text{C1}-text{B1} text{C2}} & 0 \
          -frac{text{A2} text{C1}-text{A1} text{C2}}{text{B1} text{C2}-text{B2} text{C1}} & 1 & 0 \
          end{array}
          right)
          $$






          share|cite|improve this answer











          $endgroup$













          • $begingroup$
            This is an interesting answer. I need some more time to digest your calculations. One thing I learned from this is that mathematica can do algebraic manipulations with symbols. That's great. At one point you say that there are at least $n(n+1)/2$. What do you mean by that? Shouldn't there be infinitely many solutions always?
            $endgroup$
            – stressed out
            Dec 27 '18 at 21:33








          • 1




            $begingroup$
            Mathematica is great for symbolic manipulations! You're right that there are infinitely many solutions. I should have said linearly independent solutions.
            $endgroup$
            – tch
            Dec 27 '18 at 21:37














          3












          3








          3





          $begingroup$

          Edit: you might look into methods for solving Sylvester Equations which are of the form $AX+XB=C$.



          General Case



          I doubt this is the best way to solve the equation, but it is at least one way to solve it.



          Write,
          $$
          X =
          begin{bmatrix}
          | & | & & | \
          x_1 & x_2 & & x_n \
          | & | & & | \
          end{bmatrix}
          , ~~
          A =
          begin{bmatrix}
          | & | & & | \
          a_1 & a_2 & & a_n \
          | & | & & | \
          end{bmatrix}
          $$



          Then the $i,j$ entry of $X^TA+A^TX = 0$ gives,
          $$
          x_i^Ta_j + a_i^Tx_j = a_j^Tx_i + a_i^Tx_j = 0
          $$



          We can rewrite this as a matrix vector equation $tilde{A}x = 0$
          $$
          begin{bmatrix}
          a_1^T & & & & \
          a_2^T & a_1^T & & & \
          a_3^T & & a_1^T & & \
          vdots & & &ddots & \
          a_n^T & & & & a_1^T \ hline
          a_2^T & a_1^T & & cdots & \
          & a_2^T \
          & a_3^T & a_2^T & & \
          & vdots & & ddots \
          & a_n^T & & & a_2^T \hline
          &&vdots
          end{bmatrix}
          begin{bmatrix}
          x_1 \
          x_2 \
          vdots \
          x_n
          end{bmatrix}
          = 0
          $$

          where the matrix $tilde{A}$ is size $n^2times n^2$ and the vector $x$ is size $n^2times 1$.



          Note that a lot of the rows are identical. In particular, there are at most $n(n-1)/2$ unique rows. This tells us that the null space of $tilde{A}$ is at least dimension $n^2-n(n-1)/2 = n(n+1)/2$. Each element of the null space of $tilde{A}$ gives a solution to the original equation, so there are at least this many solutions.



          So finding solutions to the original equation amounts to finding vectors in the null space of this new matrix (there are many existing libraries to do this).



          3 by 3 case



          I used mathematica and the above method to find all solutions $X$. We define entries of $A$ by
          $$
          A = begin{bmatrix}
          A1 & B1 & C1 \
          A2 & B2 & C2 \
          A3 & B3 & C3 \
          end{bmatrix}
          $$



          We input this to mathematica, compute the null space of $tilde{A}$ as defined above, and then reshape vectors from the null space.



          AA = {{A1, A2, A3}}[Transpose];
          BB = {{B1, B2, B3}}[Transpose];
          CC = {{C1, C2, C3}}[Transpose];

          A = ArrayFlatten[{{AA[Transpose], 0, 0}, {BB[Transpose],
          AA[Transpose], 0}, {CC[Transpose], 0,
          AA[Transpose]}, {BB[Transpose], AA[Transpose], 0}, {0,
          BB[Transpose], 0}, {0, BB[Transpose],
          CC[Transpose]}, {CC[Transpose], 0, AA[Transpose]}, {0,
          CC[Transpose], BB[Transpose]}, {0, 0, CC[Transpose]}}];

          NA = NullSpace[A]


          Then the solutions are linear combinations of the following:
          $$
          X1=
          left(
          begin{array}{ccc}
          -frac{text{A3} text{B2} text{C1}-text{A2} text{B1} text{C3}}{text{C1} (text{B2} text{C1}-text{B1} text{C2})} & -frac{text{B2} (text{B3} text{C1}-text{B1} text{C3})}{text{C1} (text{B2} text{C1}-text{B1} text{C2})} & -frac{text{C3}}{text{C1}} \
          -frac{text{A1} text{B1} text{C3}-text{A3} text{B1} text{C1}}{text{C1} (text{B2} text{C1}-text{B1} text{C2})} & frac{text{B1} text{B3} text{C1}-text{B1}^2 text{C3}}{text{C1} (text{B2} text{C1}-text{B1} text{C2})} & 0 \
          -frac{text{A1} text{B2}-text{A2} text{B1}}{text{B1} text{C2}-text{B2} text{C1}} & 0 & 1 \
          end{array}
          right)
          $$



          $$
          X2=
          left(
          begin{array}{ccc}
          -frac{text{A2}}{text{C1}} & -frac{text{B2}}{text{C1}} & -frac{text{C2}}{text{C1}} \
          frac{text{A1}}{text{C1}} & frac{text{B1}}{text{C1}} & 1 \
          0 & 0 & 0 \
          end{array}
          right)
          $$



          $$
          X3=
          left(
          begin{array}{ccc}
          -frac{text{A3} text{C2}-text{A2} text{C3}}{text{B1} text{C2}-text{B2} text{C1}} & -frac{text{B3} text{C2}-text{B2} text{C3}}{text{B1} text{C2}-text{B2} text{C1}} & 0 \
          -frac{text{A1} text{C3}-text{A3} text{C1}}{text{B1} text{C2}-text{B2} text{C1}} & -frac{text{B3} text{C1}-text{B1} text{C3}}{text{B2} text{C1}-text{B1} text{C2}} & 0 \
          -frac{text{A2} text{C1}-text{A1} text{C2}}{text{B1} text{C2}-text{B2} text{C1}} & 1 & 0 \
          end{array}
          right)
          $$






          share|cite|improve this answer











          $endgroup$



          Edit: you might look into methods for solving Sylvester Equations which are of the form $AX+XB=C$.



          General Case



          I doubt this is the best way to solve the equation, but it is at least one way to solve it.



          Write,
          $$
          X =
          begin{bmatrix}
          | & | & & | \
          x_1 & x_2 & & x_n \
          | & | & & | \
          end{bmatrix}
          , ~~
          A =
          begin{bmatrix}
          | & | & & | \
          a_1 & a_2 & & a_n \
          | & | & & | \
          end{bmatrix}
          $$



          Then the $i,j$ entry of $X^TA+A^TX = 0$ gives,
          $$
          x_i^Ta_j + a_i^Tx_j = a_j^Tx_i + a_i^Tx_j = 0
          $$



          We can rewrite this as a matrix vector equation $tilde{A}x = 0$
          $$
          begin{bmatrix}
          a_1^T & & & & \
          a_2^T & a_1^T & & & \
          a_3^T & & a_1^T & & \
          vdots & & &ddots & \
          a_n^T & & & & a_1^T \ hline
          a_2^T & a_1^T & & cdots & \
          & a_2^T \
          & a_3^T & a_2^T & & \
          & vdots & & ddots \
          & a_n^T & & & a_2^T \hline
          &&vdots
          end{bmatrix}
          begin{bmatrix}
          x_1 \
          x_2 \
          vdots \
          x_n
          end{bmatrix}
          = 0
          $$

          where the matrix $tilde{A}$ is size $n^2times n^2$ and the vector $x$ is size $n^2times 1$.



          Note that a lot of the rows are identical. In particular, there are at most $n(n-1)/2$ unique rows. This tells us that the null space of $tilde{A}$ is at least dimension $n^2-n(n-1)/2 = n(n+1)/2$. Each element of the null space of $tilde{A}$ gives a solution to the original equation, so there are at least this many solutions.



          So finding solutions to the original equation amounts to finding vectors in the null space of this new matrix (there are many existing libraries to do this).



          3 by 3 case



          I used mathematica and the above method to find all solutions $X$. We define entries of $A$ by
          $$
          A = begin{bmatrix}
          A1 & B1 & C1 \
          A2 & B2 & C2 \
          A3 & B3 & C3 \
          end{bmatrix}
          $$



          We input this to mathematica, compute the null space of $tilde{A}$ as defined above, and then reshape vectors from the null space.



          AA = {{A1, A2, A3}}[Transpose];
          BB = {{B1, B2, B3}}[Transpose];
          CC = {{C1, C2, C3}}[Transpose];

          A = ArrayFlatten[{{AA[Transpose], 0, 0}, {BB[Transpose],
          AA[Transpose], 0}, {CC[Transpose], 0,
          AA[Transpose]}, {BB[Transpose], AA[Transpose], 0}, {0,
          BB[Transpose], 0}, {0, BB[Transpose],
          CC[Transpose]}, {CC[Transpose], 0, AA[Transpose]}, {0,
          CC[Transpose], BB[Transpose]}, {0, 0, CC[Transpose]}}];

          NA = NullSpace[A]


          Then the solutions are linear combinations of the following:
          $$
          X1=
          left(
          begin{array}{ccc}
          -frac{text{A3} text{B2} text{C1}-text{A2} text{B1} text{C3}}{text{C1} (text{B2} text{C1}-text{B1} text{C2})} & -frac{text{B2} (text{B3} text{C1}-text{B1} text{C3})}{text{C1} (text{B2} text{C1}-text{B1} text{C2})} & -frac{text{C3}}{text{C1}} \
          -frac{text{A1} text{B1} text{C3}-text{A3} text{B1} text{C1}}{text{C1} (text{B2} text{C1}-text{B1} text{C2})} & frac{text{B1} text{B3} text{C1}-text{B1}^2 text{C3}}{text{C1} (text{B2} text{C1}-text{B1} text{C2})} & 0 \
          -frac{text{A1} text{B2}-text{A2} text{B1}}{text{B1} text{C2}-text{B2} text{C1}} & 0 & 1 \
          end{array}
          right)
          $$



          $$
          X2=
          left(
          begin{array}{ccc}
          -frac{text{A2}}{text{C1}} & -frac{text{B2}}{text{C1}} & -frac{text{C2}}{text{C1}} \
          frac{text{A1}}{text{C1}} & frac{text{B1}}{text{C1}} & 1 \
          0 & 0 & 0 \
          end{array}
          right)
          $$



          $$
          X3=
          left(
          begin{array}{ccc}
          -frac{text{A3} text{C2}-text{A2} text{C3}}{text{B1} text{C2}-text{B2} text{C1}} & -frac{text{B3} text{C2}-text{B2} text{C3}}{text{B1} text{C2}-text{B2} text{C1}} & 0 \
          -frac{text{A1} text{C3}-text{A3} text{C1}}{text{B1} text{C2}-text{B2} text{C1}} & -frac{text{B3} text{C1}-text{B1} text{C3}}{text{B2} text{C1}-text{B1} text{C2}} & 0 \
          -frac{text{A2} text{C1}-text{A1} text{C2}}{text{B1} text{C2}-text{B2} text{C1}} & 1 & 0 \
          end{array}
          right)
          $$







          share|cite|improve this answer














          share|cite|improve this answer



          share|cite|improve this answer








          edited Dec 27 '18 at 21:07

























          answered Dec 27 '18 at 20:09









          tchtch

          803310




          803310












          • $begingroup$
            This is an interesting answer. I need some more time to digest your calculations. One thing I learned from this is that mathematica can do algebraic manipulations with symbols. That's great. At one point you say that there are at least $n(n+1)/2$. What do you mean by that? Shouldn't there be infinitely many solutions always?
            $endgroup$
            – stressed out
            Dec 27 '18 at 21:33








          • 1




            $begingroup$
            Mathematica is great for symbolic manipulations! You're right that there are infinitely many solutions. I should have said linearly independent solutions.
            $endgroup$
            – tch
            Dec 27 '18 at 21:37


















          • $begingroup$
            This is an interesting answer. I need some more time to digest your calculations. One thing I learned from this is that mathematica can do algebraic manipulations with symbols. That's great. At one point you say that there are at least $n(n+1)/2$. What do you mean by that? Shouldn't there be infinitely many solutions always?
            $endgroup$
            – stressed out
            Dec 27 '18 at 21:33








          • 1




            $begingroup$
            Mathematica is great for symbolic manipulations! You're right that there are infinitely many solutions. I should have said linearly independent solutions.
            $endgroup$
            – tch
            Dec 27 '18 at 21:37
















          $begingroup$
          This is an interesting answer. I need some more time to digest your calculations. One thing I learned from this is that mathematica can do algebraic manipulations with symbols. That's great. At one point you say that there are at least $n(n+1)/2$. What do you mean by that? Shouldn't there be infinitely many solutions always?
          $endgroup$
          – stressed out
          Dec 27 '18 at 21:33






          $begingroup$
          This is an interesting answer. I need some more time to digest your calculations. One thing I learned from this is that mathematica can do algebraic manipulations with symbols. That's great. At one point you say that there are at least $n(n+1)/2$. What do you mean by that? Shouldn't there be infinitely many solutions always?
          $endgroup$
          – stressed out
          Dec 27 '18 at 21:33






          1




          1




          $begingroup$
          Mathematica is great for symbolic manipulations! You're right that there are infinitely many solutions. I should have said linearly independent solutions.
          $endgroup$
          – tch
          Dec 27 '18 at 21:37




          $begingroup$
          Mathematica is great for symbolic manipulations! You're right that there are infinitely many solutions. I should have said linearly independent solutions.
          $endgroup$
          – tch
          Dec 27 '18 at 21:37


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Mathematics Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          Use MathJax to format equations. MathJax reference.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3054299%2fsolving-the-matrix-equation-xtaatx-0-for-x-in-terms-of-a%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          To store a contact into the json file from server.js file using a class in NodeJS

          Redirect URL with Chrome Remote Debugging Android Devices

          Dieringhausen