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?

  • $\begingroup$ c = a + I b; Refine[{{Re[c], -Im[c]}, {Im[c], Re[c]}}, Assumptions -> {a, b} [Element] Reals]? $\endgroup$ – Algohi Dec 18 '14 at 13:30
  • $\begingroup$ @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. $\endgroup$ – Anixx Dec 18 '14 at 13:36
  • $\begingroup$ Do you mean MatrixForm? $\endgroup$ – Algohi Dec 18 '14 at 13:38
  • $\begingroup$ @Algohi it only changes appearance, it does not change the matrix. $\endgroup$ – Anixx Dec 18 '14 at 13:39
  • 2
    $\begingroup$ What would be an example of two different matrices that represent the same complex number? $\endgroup$ – Daniel Lichtblau Dec 18 '14 at 19:23

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]}];

See: 2x2 Real Matrices

| improve this answer | |
  • $\begingroup$ Thanks! But why it returns for {{0,-1,1,0}} and {{0,1,-1,0}} the same result? It should be i and -i. $\endgroup$ – Anixx Dec 18 '14 at 13:55
  • $\begingroup$ I am also interested in how to adapt it for dual numbers. $\endgroup$ – Anixx Dec 18 '14 at 13:56

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