What's the difference between “real” and “imaginary” parts of a complex numer?

1.3k Views Asked by At

I was reading Go's documentation for the complex128 and complex64 data types when I came across something odd:

"complex128 is the set of all complex numbers with float64 real and imaginary parts."

And:

"complex64 is the set of all complex numbers with float32 real and imaginary parts."

More specifically:

"real and imaginary parts."

What's meant by this? How can a number be "real" or "imaginary"?

3

There are 3 best solutions below

0
On BEST ANSWER

Practically, on your computer in Go or on paper in theory, a complex number is just a tuple of two real numbers, that is, floats as you know them. The first is called the 'real part' (not number), the second is called the 'imaginary part'.

Just as with the floats that you already know, you can add, multiply and divide complex numbers. These operations useful and meaningful in quite a few situations, but if you haven't heard of them just wait until you do.


If you are interested, here is how the term 'imaginary' came around and how the multiplication of complex numbers was defined they way it is:

Everyone knows that there is no real number such that $x^2=-1$. In other words, $x^2=-1$ is a polynomial equation that you cannot solve. You run into the same kind of problems when you try to solve other quadratic equations, for example $x^2+x=-1$. You can now wonder in how many ways can you fail to solve quadratic equations. To start this analysis, you can just pretend $x^2=-1$ does have a solution, and call it $i$, because this solution is just a product of your imagination.

You may then notice that you can do calculations with $i$ in an obvious way. You can multiply $i$ by real numbers, $b$, and just write the result as $bi$. You can add a real number, $a$, to this and get $a+bi$. You can add two such expressions, $a_1+b_1i$ and $a_2+b_2i$, and get $$ a_1+b_1i+a_2+b_2i=(a_1+a_2)+(b_1+b_2)i, $$ simply using the rules of distributivity, associativity, and commutativity that you already know. You can multiply two such expressions and get $$ (a_1+b_1i)(a_2+b_2i)=a_1a_2+a_1b_2i+b_1a_2i + b_1b_2i^2=(a_1a_2-b_1b_2)+(a_1b_2+b_1a_2)i, $$ again just using the rules that you already know and the fact that $i^2=-1$.

Finally, you can also take inverses. Indeed, $$ (a+bi)(a-bi)=a^2-b^2i^2=a^2+b^2 $$ and therefore $$ (a+bi)^{-1}=\frac{a-bi}{a^2+b^2}. $$

As you can see, no matter what calculations you do with your imaginary numbers, you always end up with expressions of the form $a+bi$. To save ink, you may then decide to write $(a,b)$ for $a+bi$. The addition, multiplication and divison rules you discovered above can then be written as $$ (a_1,b_1)+(a_2,b_2)=(a_1+a_2,b_1+b_2)\\ (a_1,b_1)\times(a_2,b_2)=(a_1a_2-b_1b_2,a_1b_2+b_1a_2)\\ (a,b)^{-1}=(\frac{a}{a^2+b^2},\frac{-b}{a^2+b^2}). $$

Thus, the complex numbers were born.

It should now be obvious what the terms real part and imaginary part mean. The real part of $(a,b)=a+bi$ is the $a$. The imaginary part is the part with the $i$, namely $bi$.

To get back to your study of quadratic equations, you may notice that you can solve all such equations with your newly found expressions. Moreover, you can use the quadratic formula that you already know, $$ x_{1,2}=\frac{-b}{2a}\pm \frac{\sqrt{b^2-4ac}}{2a}, $$ even if $b^2-4ac<0$. Indeed, since $(\pm \sqrt{-y}i)^2=-yi^2=y$ for any negative number $y$, you can justify saying that $\sqrt{b^2-4ac}=\pm \sqrt{-(b^2-4ac)}i$, which makes everything in the quadratic formula well defined.

If you are really interested, you can go on and study higher degree polynomial equations. You can show that any such equation can be solved using your complex numbers (a lot of smart men tried hard to prove this, the first satisfactory proof was established a few hundred years after complex numbers were first to solve quadratic and cubic polynomials).

After all this work, you might wonder what the point of it all is. For that you have to think a bit like a mathematician. For example, you may notice that quadratic equations got much easier, even if you are just interested in real solutions. They always have a solution and you have a formula that is always valid. You just have to check whether the complex solution is in fact a real solution.

0
On

I suggest that you read the Complex number wikipedia article. There is a lot to learn before you will probably truly understand it. However, to put it in few words, for the creation of complex numbers we introduce an "imaginary" (that's simply terminology) number $i$, that satisfies

$$i^2 =-1. $$

A complex number, then, is any number $z$ that can be written on the form $$z = a + ib $$ where $a$ and $b$ are real numbers. Here $a$ is the "real part" (i.e. not coefficient of $i$) and $b$ is the "imaginary part" (i.e. coefficient of $i$). It should be noted that the real numbers are then a subset of the complex numbers, because all real numbers can be written on the form $z = a +ib$ with $b = 0$ and $a\in \mathbb R$.

2
On

This is the most basic of basics as one learns about complex numbers.

Complex numbers are polynomials in one variable. Almost exactly the way you already know them. We usually use the variable name $i$, although some physicists and programming languages use $j$ instead.

So $1$ is a complex number. As are $i, 3-5i$ and $1+\sqrt2i-\pi i^2$. We can add, subtract and multiply polynomials exactly the way you learned in school.

However, $i$ comes with a special property. Namely that $i^2$ is $-1$. That means that the last example above, $1+\sqrt2i-\pi i^2$, we may rewrite into $$ 1+\sqrt2i - \pi\cdot(-1) = 1+\pi + \sqrt2i $$ This way, any polynomial may be reduced to (at most) first degree, in a unique way. This also has the side effect that you can divide two complex numbers by one another, and get a complex number back (usually, you can't divide two polynomials by one another and expect to get a polynomial back, but with the complex numbers, because of $i^2 = -1$, this is possible).

So, in general, one writes a complex number as a first-degree polunomial: $a + bi$, where $a$ and $b$ are real numbers. As with regular first-degree polynomials, $a$ and $b$ have special names. In the context of complex numbers, however, they aren't called constant term and slope, but rather real part and imaginary part. $a$ is the real part, and $b$ is the imaginary part.

We also often visulaize complex numbers in a plane. Not as lines, but as points. The complex number $a + bi$ is represented by the point $(a, b)$. This way, addition of complex numbers correspond to regular vector addition (ditto subtraction), and multiplication has a nice geometric interpretation as well.

In this interpretation, the $x$-axis is the real number line, exactly the way you learned in school. The $y$-axis is called the imaginary axis. The complex number $a+bi$, which in the plane is the point at $(a, b)$, has $x$-coordinate (real part, the component along the real axis) $a$ and $y$-coordinate (imaginary part, the component along the imaginary axis) $b$.

As for why one uses the word "imaginary", you'd have to ask 16th century mathematicians.