complex numbers

complexnumbers

Complex numbers were hard for me to understand - I could see that they were “two dimensional” in a sense, but it wasn’t until I learned they were isomorphic (the same, structurally) to certain 2x2 matrices that they started to make sense.

I saw this post on Hacker News about them and wanted to write about my own aha moment. https://vankessel.io/visualizing-complex-functions

Numbers are entities that can play the role both of a noun ( 3 x 2 = 6 ) and a verb ( 2(3)=6) ). Or data and functions instead of nouns and verbs, if you like. Matrices are objects and they are like both verbs and nouns too. A complex number is very similar in a formal sense to a 2x2 matrix, but there are certain rules that 2x2 matrix must follow. Any 2x2 matrix can have four “parameters” which are just the entries of the matrix.

[[ 2, 5], [ 100, -500]] is a 2x2 matrix but it requires 4 parameters to define: 2,5,100,-500

[[ 5, -8], [ 8, 5]] is also a 2x2 matrix but it only requires 2 parameters to define if I add the constraint, the requirement, that it behaves like a complex number: (5 + 8i)

You might be wondering why it is not three parameters: 5, 8 and -8. This is because all complex numbers follow the same pattern:

[[a, -b], [b a]]

so in the example, the -8 is implied since 8 = b.

In general, not all 2x2 matrices are commutative, but all complex numbers are. This is why complex numbers are so useful, because they are commutative. What that means is that they can act as both nouns and verbs, data and function, and the result will not change.

(5 + 8i)(4 - 6i) = (4 - 6i)(5 + 8i)

but crucially,

x = [[ 5, -2], [ 4333, 1000000000000]] y = [[ -3, 7], [ 100, 10001]]

np.matmul(x,y)

array([[ -215, -19967], [ 99999999987001, 10001000000030331]])

not equal to…

np.matmul(y,x)

array([[ 30316, 7000000000006], [ 43334833, 10000999999999800]])