I tried using Bill's code for obtaining the parameters $\theta, \phi$ and $\lambda$ for the unitary

$$Z=\begin{pmatrix}\frac{1}{\sqrt 2} & \frac{i}{\sqrt 2} \\ \frac{i}{\sqrt 2} & \frac{1}{\sqrt 2} \end{pmatrix}$$.

Here's my code:

Z = {{1/Sqrt[2], I/Sqrt[2]}, {I/Sqrt[2], 1/Sqrt[2]}};
U = {{Cos[\[Theta]/
      2], -E^(I \[Lambda]) Sin[\[Theta]/
       2]}, {E^(I \[CurlyPhi]) Sin[\[Theta]/2], 
    E^(I (\[Lambda] + \[CurlyPhi])) Cos[\[Theta]/2]}};
N[Reduce[Z == U && 0 <= \[CurlyPhi] < 2 Pi && 0 <= \[Theta] <= Pi && 
   0 <= \[Lambda] < 2 Pi, {\[Theta], \[CurlyPhi], \[Lambda]}, Reals]]

But it says:

"The system {1/Sqrt[2],I/Sqrt[2]}=={Cos[\[Theta]/2],-E^(I\\[Lambda])\ \
Sin[\[Theta]/2]}&&{I/Sqrt[2],1/Sqrt[2]}=={E^(I\\[CurlyPhi])\ Sin[\
\[Theta]/2],E^(I\(\[Lambda]+\[CurlyPhi]))\ Cos[\[Theta]/2]}&&0<=\
\[CurlyPhi]<2\ \[Pi]&&0<=\[Theta]<=\[Pi]&&0<=\[Lambda]<2\ \[Pi] \
contains a nonreal constant I/Sqrt[2]. With the domain Reals \
specified, all constants should be real. "

I don't quite understand this error. By inspection, one simple solution for the given $Z$ is $$(\theta, \phi,\lambda) = (\pi/2,\pi/2,3\pi/2)$$ and clearly $ZZ^{\dagger}=I$.

So why is Mathematica returning me complex values for the angle parameters instead of the simple real solution? Am I missing something?

  • 1
    $\begingroup$ If I try to carefully understand that error message it doesn't seem that it is returning a complex value as a solution. It seems what it is saying is when you have restricted the solution space to real numbers that the algorithm which was chosen refuses to accept any input equation which contains a complex constant, whether the solution might turn out to be real valued or not. $\endgroup$
    – Bill
    May 26, 2019 at 18:24

1 Answer 1


Try this

Z = {{1/Sqrt[2], I/Sqrt[2]}, {I/Sqrt[2], 1/Sqrt[2]}};
U = {{Cos[θ/2], -E^(I λ) Sin[θ/2]}, {E^(I ϕ) Sin[θ/2],E^(I (λ + ϕ)) Cos[θ/2]}};
FullSimplify[Reduce[Z == U && 0<=ϕ<2 Pi && 0<=θ<=Pi && 0<=λ<2 Pi, {θ, ϕ, λ}]]

which quickly returns

2*θ == Pi && 2*ϕ == Pi && 2*λ == 3*Pi

There are a vast number of algorithms hiding inside of Reduce and it is often difficult to diagnose exactly what is happening behind the curtain. But it is still very impressive what it is able to accomplish with the tap of a key.


Your Answer

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