# 2x2 inverse of a complex matrix with complex determinant

Firstly, my question may be related to a similar question here: Are complex determinants for matrices possible and if so, how can they be interpreted?

I am using: $$\left(\begin{array}{cc} a&b\\ c&d \end{array}\right)^{-1} = {1 \over a d - b c} \left(\begin{array}{rr} d&-b\\ -c&a \end{array}\right)~,~~\text{ where } ad-bc \ne 0.$$ which is a very well known way to calculate the inverse of a 2x2 matrix. My problem interpreting what the significance of a complex determinant (i.e. the denominator on the right hand side of the '='). I've always assumed you'd take the magnitude of the complex dterminant in this case?

The reason why I am asking is I am writing a function in the C programming language which should be able to take real (imaginary part = 0) and complex values of $a, b, c$ and $d$.

If I was to take the magnitude of the complex number in the denominator this isn't a problem, but for cases where the real part of determinant turns out to be negative and the imaginary part is equal to zero, would it be correct to take the magnitude in this case as it would lead to a sign change in in the elements of the inverse matrix?

Eg. Determinant $= -2 +j0$, so: $abs(-2 + j0) = 2$, which would change the signs of the elements of my inverse matrix. However, if I was to work this out with a paper and pen, I simply treat my "complex" determinant as a real number and I don't bother taking the magnitude or the absolute value, thus maintaining the '-' in the real part (determinant $=-2$).

Many thanks

EDIT: Say determinant =$z$ So, $z^{-1} = r^{-1}(cos \theta + j sin \theta) ^{-1}$, where $r = |z|$ and $\theta = angle(z)$. If $z_{imag} = 0$, then: $$z^{-1} = r^{-1} cos\theta$$

$$z^{-1} =1/r = 1/|z|$$ The line above is obviously not correct and is the source of my confusion!

• I'm not really sure what you are asking. There is nothing special about a complex determinant. I have no idea why you would take the magnitude, though. Jul 10, 2014 at 21:41
• Ok I may have just seen what I've done wrong, I've assumed cos(theta) = 1 above, which is not the case for negative real part and 0 imaginary part! Jul 10, 2014 at 22:07
• I'm still not sure what it is you are trying to accomplish. C doesn't have complex numbers as a built-in type, so you must be modelling them using a struct or similar, and have a library for adding, dividing, etc. In any case, ${1 \over z} = {\bar{z} \over |z|^2}$. Jul 10, 2014 at 22:13
• Yes I am using a struct, so for real number the imaginary part = 0. The routine I am writing needs to accept real and complex numbers. Thanks for your help in any case. Jul 10, 2014 at 22:18
• So, you need routines to add, multiply, subtract and divide the complex numbers. Use these to compute the inverse as you would with a real matrix, except use the complex operations. Nothing different other than that. Jul 10, 2014 at 22:22

$$\left(\begin{array}{cc} i&0\\ 0&1 \end{array}\right)^{-1} = \frac{1}{i} \left(\begin{array}{rr} 1&0\\ 0&i \end{array}\right)$$ and so $$\left(\begin{array}{cc} i&0\\ 0&1 \end{array}\right)^{-1} \ne \left(\begin{array}{rr} 1&0\\ 0&i \end{array}\right)= \frac{1}{|i|} \left(\begin{array}{rr} 1&0\\ 0&i \end{array}\right)$$