# Solve 2x2 complex unitary matrix with constains using Solve does not work

I have a 2x2 complex-valued matrix, $$U=\pmatrix{U_{1,1}e^{i\theta_{1,1}}&U_{1,2}e^{i\theta_{1,2}}\\ U_{2,1}e^{i\theta_{2,1}}&U_{2,2}e^{i\theta_{2,2}}}$$ which I must impose two conditions: 1) it is unitary $$UU^\dagger=\mathcal{I}$$ and 2) the product with its transpose is a fixed value $$UU^{T}=M$$, where this matrix has zero at his diagonal. This gives me a set of equations:

From condition 1:

$$U_{1,1}^2+U_{1,2}^2=1$$

$$U_{2,1}^2+U_{2,2}^2=1$$

$$e^{i(\theta_{1,1}-\theta_{2,1})}U_{1,1}U_{2,1}+e^{i(\theta_{1,2}-\theta_{2,2})}U_{1,2}U_{2,2}=0$$

$$e^{-i(\theta_{1,1}-\theta_{2,1})}U_{1,1}U_{2,1}+e^{-i(\theta_{1,2}-\theta_{2,2})}U_{1,2}U_{2,2}=0$$

From condition 2:

$$e^{2i\theta_{1,1}}U^{2}_{1,1}+e^{2i\theta_{1,2}}U^{2}_{1,2}=0$$

$$e^{2i\theta_{2,1}}U^{2}_{2,1}+e^{2i\theta_{2,2}}U^{2}_{2,2}=0$$

$$e^{i(\theta_{1,1}+\theta_{2,1})}U_{1,1}U_{2,1}+e^{i(\theta_{1,2}+\theta_{2,2})}U_{1,2}U_{2,2}=1$$

So we have 8 variables and 7 equations of motion, so we get one free parameter.

From the first equation of both conditions, we can already see what a solution looks like,

$$U_{\rm sol}=\frac{1}{\sqrt{2}}\pmatrix{1&-i\\ 1&i}$$ and this fulfils the conditions I need. The problem is that I cannot rely on 'observations' like this because I have to scale it up to more dimensions like 3x3, which is much more involved. I tried to get the same solution using Mathematica, but it just doesn't work and I cannot figure out why. Here is my code:

ClearAll["Global*"]
$Assumptions = {{u11, u12, u21, u22, \[Theta]11, \[Theta]21, \[Theta]12, \[Theta]22, m} \[Element] Reals}; U = ({ {u11*Exp[I*\[Theta]11], u12*Exp[I*\[Theta]12]}, {u21*Exp[I*\[Theta]21], u22*Exp[I*\[Theta]22]} }); UIden = U.U\[ConjugateTranspose] // FullSimplify; UTrans = U.U\[Transpose] // FullSimplify; EqIm1 = UIden[[1, 1]] == 1; EqIm2 = UIden[[2, 2]] == 1; EqIm12 = UIden[[1, 2]] == 0; EqIm21 = UIden[[2, 1]] == 0; Eqm1 = UTrans[[1, 1]] == 0; Eqm2 = UTrans[[2, 2]] == 0; Eqm12 = UTrans[[1, 2]] == 1; Solve[{EqIm1, EqIm2, EqIm12, Eqm1, Eqm2, Eqm12}, {u11, u12, u21, u22, \[Theta]11, \[Theta]21, \[Theta]12, \[Theta]22}]  Where the equation list is just the 7 equations I have just described and I don't get any result, just $$\{\}$$. Does anybody know what I should do? EDIT: In general, the matrix $$M$$ has 0 in all the diagonal, but it has non-zero elements in the off-diagonal terms. In this example, I choose $$m_{1,2}=m_{2,1}=1$$. EDIT 2: I have written the code I use. • To clarify:$M$is all$0$in its diagonal, and$1$everywhere else? Jun 20, 2022 at 15:32 • The matrix M is 0 in the diagonal, but the off-diagonal terms are generally$m_{i,j}\$. The case m=1 gives the solution I gave. I question I ask myself is if it is the one solution possible or if there are other matrices U for different m's. Jun 20, 2022 at 15:43
• Please include complete code that we can run. It may be a simple syntax issue -- for example, EqIm1=u_{1,1}^{2}+u_{1,2}^{2}==0 is not legal Mathematica code (you cannot use underscore in this way). Also, you need to tell Solve to use your assumptions. Jun 20, 2022 at 18:32
• @bills I have written my code. Question: By defining the Assumption at the beginning of the code, do I need to define them again when using Solve? Jun 20, 2022 at 19:39
• The only solutions are for M=={{0,p},{p,0}} with p!=0. There are 32 solutions, 2 each for the signs of u11,u12,u21,u22 and 2 for a sign associated with t11 which then determines the values of t12,t21,t22 This gives you the 32 solutions: ClearAll["Global*"]; Assuming[Element[{u11,u12,u21,u22,t11,t21,t12,t22},Reals], U={{u11*Exp[I*t11],u12*Exp[I*t12]},{u21*Exp[I*t21],u22*Exp[I*t22]}}; LogicalExpand[Simplify[Reduce[Simplify[{U.ConjugateTranspose[U]=={{1,0},{0,1}},U.Transpose[U]=={{0,p},{p,0}}}],{u11,u12,u21,u22,t11,t21,t12,t22}]]]]
– Bill
Jun 21, 2022 at 14:24