DSP Algorithms for RF Systems

Buy the Book!

DSP for Beginners: Simple Explanations for Complex Numbers! The second edition includes a new chapter on complex sinusoids.

How Euler’s Formula Relates Triangles, the Unit Circle and Complex Sinusoids
September 16, 2021

Table of Contents

Introduction

Sines and cosines are the foundation for representing signals and the affects of filters and therefore understanding their mathematics is one of the foundational tools for signal processing. Euler’s formula is a mathematically compact and useful representation used for representing complex sinusoids.

More posts on complex sinusoids:

Sine and Cosine

Sine and cosine refer to the opposite and adjacent lengths of a triangle with angle \phi as shown in Figure 1.

Figure 1: Sine and cosine refer to the opposite and adjacent lengths of a triangle with angle phi. Euler's formula is used to relate the sine and cosine within a triangle.
Figure 1: Sine and cosine refer to the opposite and adjacent lengths of a triangle with angle phi. Euler's formula is used to relate the sine and cosine within a triangle.

Sine, referenced as \sin(x), is a perfectly periodic function in x where

(1)   \begin{equation*}\text{sin}(x) = \text{sin}(x + 2\pi)\end{equation*}

for any x. The lengths of the triangle in Figure 1 will continually repeat as \phi cycles from 0 to 2\pi, then 2\pi to 4\pi, and so on.

Sine and cosine are just phase shifts of one another, such that

(2)   \begin{equation*}\text{sin}\left(x + \frac{\pi}{2}\right) = \text{cos}(x),\end{equation*}

(3)   \begin{equation*}\text{sin}(x) = \text{cos}\left(x - \frac{\pi}{2}\right).\end{equation*}

Figure 2 gives an example of \sin(\phi) and \cos(\phi). Notice that sine and cosine are linked together as \phi travels around the unit circle, the only difference being that cosine lags sine by \pi/2.

Figure 2: Sine and cosine are perfectly periodic with cosine lagging sine by pi/2.
Figure 2: Sine and cosine are perfectly periodic with cosine lagging sine by pi/2.

Sine Wave

Where the terms sine and cosine refer to a single angle, a sine wave or sinusoid refers to \sin(x) and \cos(x) which vary over multiple values of x. To be useful as a mathematical tool a sine wave will have three parameters which describe it completely: amplitude A, frequency \omega and phase \theta,

(4)   \begin{equation*}A ~ \text{sin}( \omega t + \theta)\end{equation*}

where t is time. Figure 3 gives examples of how a sine wave is effected by different values of A, \omega and \theta.

Figure 3: Sine waves have three parameters: amplitude, frequency and phase.
Figure 3: Sine waves have three parameters: amplitude, frequency and phase.

The amplitude A changes the vertical scale of the sinusoid and is related to the energy of the sine wave.

The phase \theta relates to the position the sinusoid starts. For example, \theta = 0 refers to the angle of the triangle as if it was a clock hand pointing at 3 o’clock. The phase \theta also can appear as a time delay as larger values seem to time-shift the sinusoid.

The frequency \omega refers to the speed and direction at which the triangle’s angle is rotating from 0 to 2\pi. A positive frequency means the angle will cycle through the unit circle in a counter-clockwise direction where as a negative frequency will have the angle cycle through the unit circle in a clockwise direction. A larger frequency means the angle will cycle through the unit circle faster than a small frequency in the same measure of time.

Euler's Formula

Leonhard Euler (pronounced oiler) created the formula which relates sine and cosine through a complex exponential e^{j\phi} according to

(5)   \begin{equation*}e^{j\phi} = \text{cos}(\phi) + j\cdot\text{sin}(\phi)\end{equation*}

where j = \sqrt{-1}. The complex sinusoid can be described more generically as of the form in (4) by

(6)   \begin{equation*}Ae^{j\left(\omega t + \theta\right)} = A\text{cos}(\omega t + \theta) + j\cdot\text{sin}(\omega t + \theta),\end{equation*}

with amplitude A, frequency \omega and phase \theta.

Euler’s formula is a mathematically compact tool for representing sinusoids. A complex sinusoid simultaneously represents both the real cos() and imaginary sin() portion. The real portion can be obtained by using the real \text{RE}\{\cdot\} operator and the imaginary portion can be selected by using the imaginary \text{IM}\{\cdot\} operator such that

(7)   \begin{equation*}\text{RE}\left\{ Ae^{j\left( \omega t + \theta \right)} \right\} = A cos ( \omega t + \theta),\end{equation*}

(8)   \begin{equation*}\text{IM}\left\{ Ae^{j\left( \omega t + \theta \right)} \right\} = A sin ( \omega t + \theta).\end{equation*}

Additional Relationships

Two other mathematical properties are useful which relate \cos() and \sin() individually to complex exponentials are

(9)   \begin{equation*}cos(x) = \frac{1}{2} \left( e^{jx} + e^{-jx} \right),\end{equation*}

(10)   \begin{equation*}sin(x) = \frac{1}{2j} \left( e^{jx} - e^{-jx} \right).\end{equation*}

Equation (9) can be derived from (5) by adding e^{-j\phi},

(11)   \begin{equation*}\begin{split}e^{j\phi} + e^{-j\phi} & = \left( \text{cos}(\phi) + j\cdot\text{sin}(\phi)\right) + \left( \text{cos}(\phi) - j\cdot\text{sin}(\phi)\right) \\& = 2 \text{cos}(\phi).\end{split}\end{equation*}

Dividing both sides of (11) by 2 gives the final relationship,

(12)   \begin{equation*}\frac{1}{2} \left( e^{j\phi} + e^{-j\phi} \right) = \text{cos}(\phi).\end{equation*}

Similarly (10) can be derived from (5) by subtracting e^{-j\phi},

(13)   \begin{equation*}\begin{split}e^{j\phi} - e^{-j\phi} & = \left( \text{cos}(\phi) + j\cdot\text{sin}(\phi)\right) - \left( \text{cos}(\phi) - j\cdot\text{sin}(\phi)\right) \\& = 2j \cdot \text{sin}(\phi).\end{split}\end{equation*}

Dividing both sides of (13) by 2j gives the final relationship,

(14)   \begin{equation*}\frac{1}{2j} \left( e^{j\phi} - e^{-j\phi} \right) = \text{sin}(\phi).\end{equation*}

 

Conclusion

Sines and cosines are a foundational tool in DSP. Understanding the phase relationships between sine and cosine, as well as Euler’s formula (5) and its representations (9) and (10) are foundational to understanding before building more sophisticated DSP algorithms.

Don’t forget to check out these blogs on complex sinusoids:

For everything there is a season, and a time for every matter under heaven. A time to cast away stones, and a time to gather stones together. A time to embrace, and a time to refrain from embracing. Ecclesiastes 3:1,5
The earth was without form and void, and darkness was over the face of the deep. And the Spirit of God was hovering over the face of the waters. Genesis 1:2
Behold, I am toward God as you are; I too was pinched off from a piece of clay. Job 33:6
Enter His gates with thanksgiving, and His courts with praise! Give thanks to Him; bless His name! Psalm 100:4
Lift up your hands to the holy place and bless the Lord! Psalm 134:2
Blessed is the man who trusts in the Lord, whose trust is the Lord. He is like a tree planted by water, that sends out its roots by the stream, and does not fear when heat comes, for its leaves remain green, and is not anxious in the year of drought, for it does not cease to bear fruit. Jeremiah 17:7-8
He said to him, “You shall love the Lord your God with all your heart and with all your soul and with all your mind. This is the great and first commandment. And a second is like it: You shall love your neighbor as yourself. On these two commandments depend all the Law and the Prophets.” Matthew 22:37-39
Then He said to me, “Prophesy over these bones, and say to them, O dry bones, hear the word of the Lord. Thus says the Lord God to these bones: Behold, I will cause breath to enter you, and you shall live." Ezekiel 37:4-5
Riches do not profit in the day of wrath, but righteousness delivers from death. Proverbs 11:4
The angel of the Lord appeared to him in a flame of fire out of the midst of a bush. He looked, and behold, the bush was burning, yet it was not consumed. And Moses said, “I will turn aside to see this great sight, why the bush is not burned.” When the Lord saw that he turned aside to see, God called to him out of the bush, “Moses, Moses!” And he said, “Here I am.” Exodus 3:2-3
Daniel answered and said: “Blessed be the name of God forever and ever, to whom belong wisdom and might. He changes times and seasons; He removes kings and sets up kings; He gives wisdom to the wise and knowledge to those who have understanding." Daniel 2:20-21
Now the Lord is the Spirit, and where the Spirit of the Lord is, there is freedom. 2 Corinthians 3:17
Previous slide
Next slide

This website participates in the Amazon Associates program. As an Amazon Associate I earn from qualifying purchases.

© 2021-2024 Wave Walker DSP