# Matrix form of complex numbers [closed]

Complex numbers have matrix form. But some 2x2 matrices while differ, represent the same complex number. To compare complex numbers one has to transform the matrices to the form

\begin{pmatrix} a & -b \\ b & \;\; a \end{pmatrix}.

How I transform an arbitrary 2x2 matrix representing a complex number to this form without changing its complex number value?

• c = a + I b; Refine[{{Re[c], -Im[c]}, {Im[c], Re[c]}}, Assumptions -> {a, b} [Element] Reals]? Dec 18, 2014 at 13:30
• @Algohi how to transform a matrix to this form? You show how to produce a matrix given a complex number, I am looking for the opposite. Dec 18, 2014 at 13:36
• Do you mean MatrixForm? Dec 18, 2014 at 13:38
• Related Demonstrations Project Dec 18, 2014 at 13:42
• What would be an example of two different matrices that represent the same complex number? Dec 18, 2014 at 19:23

## 1 Answer

The code below works for matrices representing ordinary complex numbers.

matrixToComplexNumber[{{a_, b_}, {c_, d_}}] := Module[{p, q, x},
p = (a - d)^2/4 + b c;
If[p >= 0, Return["N is not an ordinary complex number"]];
x = (a + d)/2;
Return[{x, Sqrt[-p]}];
]

• Thanks! But why it returns for {{0,-1,1,0}} and {{0,1,-1,0}} the same result? It should be i and -i. Dec 18, 2014 at 13:55
• I am also interested in how to adapt it for dual numbers. Dec 18, 2014 at 13:56