 When thinking about sound signals, especially when used in music, we tend to think only of frequency, or pitch, and amplitude, or how loud it is. However, there is a third property of a sine wave that can be changed, and that is its phase. To demonstrate what phase is, let's take a sine wave. We've already seen how we can change its frequency and its amplitude. We can also pause a little before playing the last note. We've delayed the last note in the scale, shifted it a little in time, or to put it another way, we've changed its phase. Now, we can obviously hear the difference when we started to play the note. But once the note is playing, it sounds exactly the same as it did when I played the scale before without the delay. This is because our ears are much less sensitive to changes in phase than they are to changes in amplitude or frequency. So why is phase important? Let's take a sine wave with a frequency of 440 Hz. That's to note A above middle C on the piano. Now I'm going to take another sine wave with a frequency of 660 Hz. That's roughly the note E above the A we had before. But instead of playing the A and the E together, I'm going to play the E a little after the A, shifted in time slightly. Now I'm going to add them together. This is the way that I get. You can hear the two frequencies playing. However, if I start to change the phase of the second wave, look what happens to the shape of the wave when we add them together. They still sound the same, but the shape of the signal has changed. Therefore, if we are to accurately represent this signal as a series of sine waves like a Fourier series does, then the phase information of each wave is important too as it has an effect on the overall shape of the signal. So how do we present this shift in phase mathematically? Let's take two sine waves. We'll draw our first wave in blue and it has a phase of zero. The other will draw in red, but shift it by 30 degrees. Now hang on a second. We've just been talking about changing the phase of a signal by shifting it in time. How comes we're suddenly talking about angles? Well, a memo of Fourier said about signals in general. He said any function of a variable can be expanded in a series of sines of multiples of the variable. Our variable, or in other words, the thing that goes on the x-axis, is time, as we are talking about sound signals. However, when Fourier came up with his theory, he was measuring heat flow, so his variable may well have been distance. Therefore, we need some common variable that can apply to all types of signals. When talking about sine waves, angles are the common variable. This variable can then be scaled to apply to whatever signal we are dealing with. So in our example, if we have a sound wave with a frequency of 660 hertz, it means that the air around our ears is being compressed and expanded again at a rate of 660 times per second. This means that the time it takes for one compression expansion cycle is one 660th of a second. It takes 360 degrees to complete one cycle of a sine wave. That's one complete rotation of the line within the circle. Therefore, we can map the time it takes for one cycle of our sound signal onto the 360 degrees of a circle. So if we want to phase shift our signal by 30 degrees, 30 degrees is a 12th of 360 degrees, one cycle of the sine wave. So for our 660 hertz signal, which takes one 660th of a second to complete one cycle, a 12th of one 660th of a second is 0.00126 seconds. So to convert from the angular variable of a sine wave to the time variable of our signal, we divide the angle by the 360 degrees in a circle and multiply by the period of our signal. In this case, one 660th of a second. But remember that multiplying by the period of a signal is the same as dividing by its frequency. After all, what is frequency? It's the number of signal cycles per second. 660 hertz means 660 complete sine wave cycles per second. What if we wanted to go the other way and convert from the time variable of our signal to the angular variable of a sine wave? In this case, we divide by the period of our signal and multiply by 360 degrees. Alternatively, because this time we divided by the period, we could just simply multiply by the frequency instead. So to convert from time to angle, we multiply by the frequency and then by 360 degrees. So back to our question. How do we represent a phase shift of 30 degrees mathematically? Well, the key to answering our question is to notice that the second sine wave is lagging the first by 30 degrees. If at an angle of 30 degrees, the amplitude of the blue sine wave is 0.5. The red sine wave won't reach 0.5 for another 30 degrees when its angle is 60 degrees. Therefore, the equation for the red sine wave is sine of the angle, let's call it x, minus 30 degrees. Or to put it another way, the amplitude of the red sine wave's current angle is the same as what the amplitude of the blue sine wave's angle was 30 degrees ago. What about if we shift the red wave the other way so that the red wave now leads the blue by 30 degrees? Well, not surprisingly, the red wave's equation now becomes sine x plus 30 degrees. Now it just so happens that if we shift the sine wave by 90 degrees, we get a wave that can be described by another trigonometric function, the cosine function. So sine x plus 90 degrees is equal to cosine of x. The sine and cosine functions come in very useful when dealing with right angle triangles. If we take the sine of this angle and multiply it by the length of the hypotenuse, we can calculate the height of the triangle. If we take the cosine of this angle and multiply it by the length of the hypotenuse, we can calculate the width of the triangle. But we've just seen how a cosine function is simply a sine function shifted by 90 degrees. And that the sine of the angle allows us to calculate the height of the triangle. Look what happens if we rotate the triangle through 90 degrees. What used to be the width of the triangle has now become its height. So the sine of any angle, let's call it x plus 90 degrees gives us the cosine of that angle. So now we have two ways of looking at a sine and cosine function. Either as a wave whose phase we can change or as a triangle whose angle we can change. But why is this important? Why bother with the cosine function at all if all it is is a sine function shifted along the x-axis by 90 degrees? To answer this, we need a map. I'm standing at point A on my map and I want to get to point B which is behind me over there. Now there are two possible routes I could take. I could take the shortest route and go straight there or I could go the scenic route and take two different roads to get to the same point. Now if we look at our map in a more schematic form we can see that the roads form a right angle triangle. I could describe the direct route by the distance I walked along the hypotenuse and the heading or angle I set off in to get there. Alternatively, we could get to the same point on our triangle via the scenic route by first walking along the side adjacent to the angle and then walking up the triangle on the side opposite the angle. So even if we don't know the heading or angle we need to set off in so long as we know how far across and how far up the triangle to go we can still reach our destination. When we looked at the rotating triangle before we saw that this angle corresponded to the amount by which we had shifted the phase of our sine wave. It may not surprise you to learn therefore that just as we can describe any heading by combination of a cosine and sine function we can also describe any phase shift by adding together two different waves a cosine wave and a sine wave at the same frequency simply by altering their amplitudes in a certain way. Let's see this actually happen. I'm going to start with a cosine wave with an amplitude of 32. You can see that this cosine wave is just a normal cosine wave with no phase shift. Now I'm going to take a sine wave with an amplitude of 29. Again the sine wave is not phase shifted at all. I'm now going to add them together. Look what happens to the resultant wave. It's a cosine wave that has been shifted by about 42 degrees. But what's its amplitude? To find out let's go back again to looking at this idea modeled as a triangle. Here is the amplitude of the cosine wave 32 represented by the length of the base of the triangle. And here is the amplitude of the sine wave 29 represented by the length of the height of the triangle. What is the length of the hypotenuse? Well Pythagoras showed us that the square on the hypotenuse is equal to the sum of the squares on the other two sides. Let's look at this actually happening with a little help from a really simple demonstration I found on a visit to the Bloomfield Science Museum in Jerusalem with my 4 year old son. The base of the triangle has an length of 32. So the area of the square on the base of the triangle is 32 squared which equals 1024. The height of the triangle is 29. So the area of the square on the height of the triangle is 29 squared which equals 841. Now let's turn the triangle round. The coloured water in each of the squares on the sides of the triangle is pouring into the square on the hypotenuse. We can see that Pythagoras was right. The square on the hypotenuse has been completely filled by the water flowing from the sum of the squares on the other two sides 1024 841 equals 1865. Now how do we find the length of the hypotenuse from the area? Simple. We just take the square root of 1865 which gives us 43.18. This is equal to the amplitude of my phase shifted wave. How do we work out the angle of the phase shift based on the amplitude of the cosine and sine waves? Well again, we look at it as a triangle. If I increase the width of the triangle to keep the height the same, the angle decreases. If I increase the height of the triangle to keep the width the same, the angle increases. If I increase the width of the triangle then to keep the angle the same I have to increase its height too. This means that there must be some relationship between the angle, the height and the width of the triangle. Ah, so there's a relationship. A relationship suggests maybe a division. Keeping the width of the triangle the same and increasing the height makes the angle grow. As the numerator of a division operation grows so does the result of the division just like the angle of my triangle. So the height must form the numerator of the division. Keeping the height of the triangle the same and increasing the width makes the angle shrink. As the denominator of a division operation grows the result of the division shrinks just like the angle of my triangle. So the width must form the denominator of the division. So now I'm going to plot on the x-axis of a graph the result of dividing the height of my triangle by its width and I'm going to measure the angle of the triangle and plot it on the y-axis of the graph. When I join up the dots of the graph we discover something. There is a relationship between the width, the height and the angle of a triangle but it isn't a direct or even a linear relationship. That is to say that dividing the height by the width isn't enough to give us the angle. There must be some other operation we need to do before we can recover the angle of the triangle if we know only its width and its height. How can I calculate the actual angle from this relationship? In order to calculate the height of the triangle we multiply the hypotenuse by the sign of the angle. In order to calculate the width of the triangle we multiply the hypotenuse by the cosign of the angle therefore maybe we could recover the angle by dividing these two expressions the hypotenuse times the sign of the angle divided by the hypotenuse times the cosign of the angle. Well if we do that To do that, the first thing we notice, that it doesn't matter what the length of the hypotenuse is, as the hypotenuse is just divided by itself, which equals 1, and we are left with sine of the angle divided by cosine of the angle. But this is equal to yet another trigonometric function, called the tangent function. So to recover the angle, we use the inverse tangent function, and that is what we have drawn on the graph. So to calculate the phase shift of the wave we made before, we divide the amplitude of the sine wave by the amplitude of the cosine wave, and then take the inverse tangent function. So from the previous example, if my sine wave has an amplitude of 29, and my cosine wave has an amplitude of 32, then to work out the angle, I take the inverse tangent of 29 divided by 32, and that's how I arrived at my result of 42 degrees. So by adding together a sine wave and a cosine wave of the same frequency but different amplitudes, we can change the phase of the resultant wave. At school we all learned that there were 360 degrees in a circle. However, there is another way of measuring angles, and that is in radians. The definition of one radian is that angle for which these three lengths are all equal. So for example, if the radius of my circle is one, then at an angle of one radian, the length of this arc will also be one. If I now increase the angle to two radians, what will the length of the arc be? Well that's easy. The length of the arc is always equal to the radius times the radian angle. So on the unit circle, that's a circle with the radius of one, the length of the arc will be two, just like the radian angle. Now you might recall that the ratio of the circumference of a circle to its diameter is 3.14159265358979 or, as it's otherwise known, pi. The diameter of a circle is simply twice the length of the radius. So the circumference of the circle can be calculated by multiplying pi by two times the radius. On the unit circle, the radius is equal to one. So if the radian angle is equal to the length of the arc, there must be two pi radians in a circle. But why if we have a perfectly good way of measuring angles in degrees, do we now have to get involved in radians and complicated numbers like pi? Well the answer is to do with the way that the cosine and sine functions are actually calculated, as we'll find out in the next lecture. So now we know the three properties of a sine wave that we can modify. We need some mathematical system that combines all the things we have learned so far. Sine waves, cosine waves, amplitudes, frequencies and phases. This was the point which I finally lost the plot back in my days at university. As we are now about to enter a world where numbers are both real and imaginary, and where the square root of minus one actually exists, we're about to enter the realm of complex numbers.