PHYS 115: Electrodynamics II Notes on Complex Numbers √ −1 = i has no representation as a regular (or ‘real’) number. Thus, we create a new type of number – complex – which includes both a ‘real’ and ‘imaginary’ component: z̃ = a + bi ⇒Re [z̃] = a (1) Im [z̃] = b Where here a and b are just regular numbers that give the size of the real and imaginary parts. Note that sometimes I will use put a ‘tilde’ over variables to indicate when they are complex (e.g. z̃), although I will usually only do this when it is ambiguous. For clarity, in this document I will always do it, but note that it is not as important to indicate as it is with vectors. This is because it is perfectly ok to add/multiply/divide regular (real) numbers to complex numbers, and vice-versa. Indeed, you can represent a regular number with a complex number whose imaginary part is zero (i.e. b = 0 in the definition above). If you add two complex numbers, you just add the complex parts, and multiplication is straightforward as well: (a + bi) + (c + di) = (a + c) + (b + d)i (2) 2 (a + bi)(c + di) = ac + (cb + ad)i + bdi (3) = (ac − bd) + (cb + ad)i (4) Note also that: i2 = −1 (5) 3 i = −i (6) 4 (7) i =1 i 1 = 2 = −i i i (8) We will also define a ‘conjugate’ operation – indicated with a ‘star’ – which flips the sign of the imaginary part, i.e.: (a + bi)∗ = a − bi (9) Note that in all cases, taking the conjugate is equivalent to the operation i → −i. Using the conjugate, you can also write the real and imaginary parts in another way: (here again, we assume z̃ = a + bi) z̃ + z̃ ∗ = (a + bi) + (a − bi) = 2a z̃ + z̃ ∗ ⇒ Re [z̃] = 2 z̃ − z̃ ∗ = (a + bi) − (a − bi) = 2bi z̃ − z̃ ∗ ⇒ Im [z̃] = 2i 1 (10) (11) (12) (13) Moreover, the magnitude (or modulus) of a complex number is defined as: p |z̃| = z̃(z̃)∗ p = (a + bi)(a − bi) p = a2 + (ab − ab)i − bi2 p = a2 + b2 (14) (15) (16) (17) Note that the magnitude is always a regular (real) number! In many ways, complex numbers are analogous to 2D vectors, where you can think of the real part like the x̂ component, and the imaginary part like the ŷ component: z̃ = a + bi → ~v = ax̂ + bŷ p p |z̃| = a2 + b2 → |~v| = a2 + b2 (18) (19) You can take this analogy even further, and consider numbers in cylindrical coordinates: ~v = |v| (x̂ cos φ + ŷ sin φ) (20) z̃ = |z̃| (cos φ + i sin φ) (21) = |z̃|e iφ (22) Here φ is referred to as the complex phase or the complex angle. We can also define an operation to retrieve it: arg |z̃|eiφ = φ (23) π π Im [z̃] = tan−1 if: − < φ <= . (24) Re [z̃] 2 2 3π For example, if a = −1 and b = −1, we should find that φ = − 4 (think about this as ~v = (−1)x̂ + (−1)ŷ −1 = tan−1 1 = π4 . In other words, the tan− 1 formulation is and you will see why). However: tan−1 −1 off by π whenever the real part is negative. To circumvent this problem, many programming languages define a ‘arctan2’ or ‘atan2’ function [usage: arctan2(Im [z̃] , Re [z̃])]. In addition, programming languages with built-in support for complex number (Mathematica, Python, Matlab, etc.) will often define an ‘angle’ function, which is equivalent to the ‘arg’ function above. Rarely, you could also take a logarithm for a similar effect: h i ln z̃ = ln |z̃|ei arg[z] (25) = ln |z̃| + i arg [z] (26) In other words, when we take the complex logarithm, the real part is the logarithm of the magnitude, and the imaginary part is the complex angle. You can express a complex number either in terms of the real and imaginary parts (a and b above), or in terms of the magnitude and complex phase: z̃ = Re [z̃] + i Im [z̃] (27) i arg[z] (28) or: z̃ = |z̃|e p √ −1 π for example: 2 − 2i = 22 + (−2)2 ei tan (−1) = 2 2 e−i 4 √ π π π also: 2 ei 3 = 2 cos + i sin = 1 + 3i 3 3 2 (29) (30) This is analogous to using different coordinate systems for vectors – there are different ways to write the same vector. By the way, above I made use of Euler’s identity (eiφ = cos φ + i sin φ); if you’ve never seen this it may look strange. However, it’s actually pretty easy to prove using a Taylor Expansion: ex = ∞ X xn n=0 (31) n! x3 x4 x5 x2 + + + + ··· 2! 3! 4! 5! φ2 iφ3 φ4 iφ5 ⇒ eiφ = 1 + iφ − − + + + ··· 2! 3! 4! 5! 4 2 φ φ + + ··· ⇒ Re eiφ = 1 − 2! 4! =1+x+ ! = cos φ (33) (34) (35) φ3 φ5 Im eiφ = φ − + + ··· 3! 5! (36) ! = sin φ (37) Expotentials with complex numbers work the same way, i.e.: Aeiα Beiβ = ABei(α+β) γ Aeiα = Aγ eiαγ e (32) i(a+bi) =e −b ia e (38) (39) (40) ei(a+bi) = e−b (41) (eiφ )∗ = e−iφ ∗ e(a+bi) = ea−bi (42) Note also that: (43) (44) The vector analogy would be to mirror over the x̂ axis, which is equivalent to inverting φ. Very often we will ‘phase shift’ a complex number by multiplying by another complex number with magnitude 1, i.e.: define: p̃ = eiα (45) 2 2 note: |p̃| = | cos α + sin α| = 1 iφ ⇒ (Ae )p̃ = Ae i(φ+α) In the analogy with vectors, this is equivalent to rotating the vector around the ẑ axis by an angle α. 3 (46) (47) For example if α = π2 : p̃ = cos π π + i sin 2 2 (48) =i (49) ⇒ z̃ p̃ = (a + bi)i (50) = −b + ai (51) If you think about the real part as an x̂ component, and the imaginary part as a ŷ component, you will realize that this is a rotation by 90◦ ! One more thing that is useful to know: |ỹz̃| = |ỹ||z̃| however: |ỹ + z̃| = 6 |ỹ| + |z̃| (52) (53) The reason for the second should be clear if you think about adding 2D vectors: if the vectors aren’t pointing in the same direction, their magnitudes don’t add! Moreover: Re [ỹ + z̃] = Re [ỹ] + Re [z̃] however: Re [ỹz̃] 6= Re [ỹ] Re [z̃] (54) (55) This also works for taking the imaginary part (i.e. Im [ỹ + z̃] = Im [ỹ] + Im [z̃]). Again, the first should be clear by analogy with vectors: taking the real part is equivalent to taking the x̂ component of a vector. Multiplying complex numbers doesn’t really have simple vector analogy. In cylindrical coordinates it is equivalent to multiplying the magnitudes and adding the angles: ỹz̃ = |ỹ||z̃|ei(arg[ỹ]+arg[z̃]) You can easily prove this by noting that we can always write ỹ = |ỹ|eiarg[ỹ] , and so on for z̃. 4 (56)