0
$\begingroup$

I'm trying to solve the following system of matrix equations: C-1.X1.C==B1, C-1.X2.C=B2 and C-1.X3.C=B3. The matrices involved are 9x9. I've been compiling for hours but still get no result. I was wondering why or even if the code is wrong.

Here is the code:

w1 = E^((2 \[Pi] I)/3);
w2 = E^((4 \[Pi] I)/3);

X1={{1,0,0,0,0,0,0,0,0},{0,-1,0,0,0,0,0,0,0},{0,0,-1,0,0,0,0,0,0},{0,0,0,-1,0,0,0,0,0},{0,0,0,0,1,0,0,0,0},{0,0,0,0,0,1,0,0,0},{0,0,0,0,0,0,-1,0,0},{0,0,0,0,0,0,0,1,0},{0,0,0,0,0,0,0,0,1}}

X2={{0,0,0,0,0,0,0,0,1},{0,0,0,0,0,0,1,0,0},{0,0,0,0,0,0,0,1,0},{0,0,1,0,0,0,0,0,0},{1,0,0,0,0,0,0,0,0},{0,1,0,0,0,0,0,0,0},{0,0,0,0,0,1,0,0,0},{0,0,0,1,0,0,0,0,0},{0,0,0,0,1,0,0,0,0}}

X3={{0,0,0,0,1,0,0,0,0},{0,0,0,0,0,1,0,0,0},{0,0,0,1,0,0,0,0,0},{0,0,0,0,0,0,0,1,0},{0,0,0,0,0,0,0,0,1},{0,0,0,0,0,0,1,0,0},{0,1,0,0,0,0,0,0,0},{0,0,1,0,0,0,0,0,0},{1,0,0,0,0,0,0,0,0}}

B1={{1,0,0,0,0,0,0,0,0},{0,1,0,0,0,0,0,0,0},{0,0,1,0,0,0,0,0,0},{0,0,0,1,0,0,0,0,0},{0,0,0,0,-1,0,0,0,0},{0,0,0,0,0,-1,0,0,0},{0,0,0,0,0,0,1,0,0},{0,0,0,0,0,0,0,-1,0},{0,0,0,0,0,0,0,0,-1}}

B2={{1,0,0,0,0,0,0,0,0},{0,w1,0,0,0,0,0,0,0},{0,0,w2,0,0,0,0,0,0},{0,0,0,0,0,1,0,0,0},{0,0,0,1,0,0,0,0,0},{0,0,0,0,1,0,0,0,0},{0,0,0,0,0,0,0,0,1},{0,0,0,0,0,0,1,0,0},{0,0,0,0,0,0,0,1,0}}

B3={{1,0,0,0,0,0,0,0,0},{0,w2,0,0,0,0,0,0,0},{0,0,w1,0,0,0,0,0,0},{0,0,0,0,1,0,0,0,0},{0,0,0,0,0,1,0,0,0},{0,0,0,1,0,0,0,0,0},{0,0,0,0,0,0,0,1,0},{0,0,0,0,0,0,0,0,1},{0,0,0,0,0,0,1,0,0}}

eqns={[email protected]==Ba2,[email protected]==Bb1,[email protected]==Bc1};

solution=Reduce[eqns,c\[Element]Matrices[{9,9}]]
$\endgroup$
1
  • 1
    $\begingroup$ I am confused. Your description uses B1,B2,B3 but your code uses Ba2,Bb2,Bc1. If I run cm=Partition[Array[c,81],9]; eqns={X1.cm==cm.B1,X2.cm==cm.B2,X3.cm==cm.B3}; cm/.ToRules[Reduce[eqns,Flatten[cm]]] then I get a solution in a couple of seconds. BUT that solution worries me. Please think VERY carefully about what I've done and try to make certain I haven't made any mistakes. $\endgroup$
    – Bill
    Commented Jun 19, 2023 at 3:44

2 Answers 2

1
$\begingroup$

Make it a linear system like so.

w1 = E^((2 \[Pi] I)/3);
w2 = E^((4 \[Pi] I)/3);

X1 = {{1, 0, 0, 0, 0, 0, 0, 0, 0}, {0, -1, 0, 0, 0, 0, 0, 0, 0}, {0, 
    0, -1, 0, 0, 0, 0, 0, 0}, {0, 0, 0, -1, 0, 0, 0, 0, 0}, {0, 0, 0, 
    0, 1, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 1, 0, 0, 0}, {0, 0, 0, 0, 0, 
    0, -1, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 1, 0}, {0, 0, 0, 0, 0, 0, 0, 
    0, 1}};

X2 = {{0, 0, 0, 0, 0, 0, 0, 0, 1}, {0, 0, 0, 0, 0, 0, 1, 0, 0}, {0, 0,
     0, 0, 0, 0, 0, 1, 0}, {0, 0, 1, 0, 0, 0, 0, 0, 0}, {1, 0, 0, 0, 
    0, 0, 0, 0, 0}, {0, 1, 0, 0, 0, 0, 0, 0, 0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, 0}, {0, 0, 0, 1, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0,
     0, 1, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 1}, {0, 0, 0, 0, 0, 0, 1, 0, 
    0}};

cmat = Array[c, Dimensions[X1]];
linpolys = 
  Flatten[Join[X1 . cmat - cmat . B1, X2 . cmat - cmat . B2, 
     X3 . cmat - cmat . B3]] /. 0 :> Nothing;
cmatsol = cmat /. (sol = First@Solve[linpolys == 0, Flatten[cmat]])

(* During evaluation of In[174]:= Solve::svars: Equations may not give solutions for all "solve" variables.

Out[176]= {{c[1, 1], c[1, 2], c[1, 3], 0, 0, 0, 0, 0, 0}, {0, 0, 0, 
   0, 0, c[2, 6], 0, 0, c[2, 9]}, {0, 0, 0, 0, c[3, 5], 0, 0, c[3, 8],
    0}, {0, 0, 0, 0, 0, c[3, 5], 0, 0, c[3, 8]}, {c[1, 1], 
   E^(-((2 I \[Pi])/3)) c[1, 2], E^((2 I \[Pi])/3) c[1, 3], 0, 0, 0, 
   0, 0, 0}, {0, 0, 0, c[2, 6], 0, 0, c[2, 9], 0, 0}, {0, 0, 0, 0, 
   c[2, 6], 0, 0, c[2, 9], 0}, {0, 0, 0, c[3, 5], 0, 0, c[3, 8], 0, 
   0}, {c[1, 1], E^((2 I \[Pi])/3) c[1, 2], 
   E^(-((2 I \[Pi])/3)) c[1, 3], 0, 0, 0, 0, 0, 0}} *)

Check:

In[177]:= linpolys /. sol

(* Out[177]= {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} *)
$\endgroup$
0
$\begingroup$

I take the first line as the definitions of the equations and neclect the code. I doubt that invertible solutions exist in general, because the direct equations produce mainly zeros

    eqns1 = { X1 . c == c . B1, X2 . c == c . B2, X3 . c == c . B3};
    solution = 
    c -> MatrixForm[Solve[eqns1, c \[Element] Matrices[{9, 9}]][[1, 1, 2]]]

$$c\to \left( \begin{array}{ccccccccc} c_{1\, 1} & c_{1\, 2} & c_{1\, 3} & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & c_{2\, 6} & 0 & 0 & c_{2\, 9} \\ 0 & 0 & 0 & 0 & c_{3\, 5} & 0 & 0 & c_{3\, 8} & 0 \\ 0 & 0 & 0 & 0 & 0 & c_{3\, 5} & 0 & 0 & c_{3\, 8} \\ c_{1\, 1} & e^{-\frac{1}{3} (2 i \pi )} c_{1\, 2} & e^{\frac{2 i \pi }{3}} c_{1\, 3} & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & c_{2\, 6} & 0 & 0 & c_{2\, 9} & 0 & 0 \\ 0 & 0 & 0 & 0 & c_{2\, 6} & 0 & 0 & c_{2\, 9} & 0 \\ 0 & 0 & 0 & c_{3\, 5} & 0 & 0 & c_{3\, 8} & 0 & 0 \\ c_{1\, 1} & e^{\frac{2 i \pi }{3}} c_{1\, 2} & e^{-\frac{1}{3} (2 i \pi )} c_{1\, 3} & 0 & 0 & 0 & 0 & 0 & 0 \\ \end{array} \right)$$

     Det[c /. Solve[eqns1, c \[Element] Matrices[{9, 9}]][[1]]]

$-1)^{2/3} \left(-3 (-1)^{2/3} c_{1\, 1} c_{1\, 2} c_{1\, 3} c_{2\, 9}{}^3 c_{3\, 5}{}^3+3 c_{1\, 1} c_{1\, 2} c_{1\, 3} c_{2\, 9}{}^3 c_{3\, 5}{}^3+9 (-1)^{2/3} c_{1\, 1} c_{1\, 2} c_{1\, 3} c_{2\, 6} c_{2\, 9}{}^2 c_{3\, 8} c_{3\, 5}{}^2-9 c_{1\, 1} c_{1\, 2} c_{1\, 3} c_{2\, 6} c_{2\, 9}{}^2 c_{3\, 8} c_{3\, 5}{}^2-9 (-1)^{2/3} c_{1\, 1} c_{1\, 2} c_{1\, 3} c_{2\, 6}{}^2 c_{2\, 9} c_{3\, 8}{}^2 c_{3\, 5}+9 c_{1\, 1} c_{1\, 2} c_{1\, 3} c_{2\, 6}{}^2 c_{2\, 9} c_{3\, 8}{}^2 c_{3\, 5}+3 (-1)^{2/3} c_{1\, 1} c_{1\, 2} c_{1\, 3} c_{2\, 6}{}^3 c_{3\, 8}{}^3-3 c_{1\, 1} c_{1\, 2} c_{1\, 3} c_{2\, 6}{}^3 c_{3\, 8}{}^3\right)$

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.