Phase shift is a small difference between two waves; in math and electronics, it is a delay between two waves that have the same period or frequency. Typically, phase shift is expressed in terms of angle, which can be measured in degrees or radians, and the angle can be positive or negative. For example, a +90 degree phase shift is one quarter of a full cycle; in this case, the second wave leads the first by 90 degrees. You can calculate phase shift using the frequency of the waves and the time delay between them.

### Sine Wave Function and Phase

In math, the trigonometric sine function produces a smooth wave-shaped graph that cycles between a maximum and a minimum value, repeating every 360 degrees or 2 pi radians. At zero degrees, the function has a value of zero. At 90 degrees, it reaches its maximum positive value. At 180 degrees, it curves back down toward zero. At 270 degrees, the function is at its maximum negative value, and at 360, it returns to zero, completing one full cycle. Angles greater than 360 simply repeat the previous cycle. A sine wave with a phase shift begins and ends at a value other than zero, although it resembles a “standard” sine wave in every other respect.

### Choosing the Wave Order

Calculating phase shift involves comparing two waves, and part of that comparison is choosing which wave is “first” and which is “second.” In electronics, the second wave is typically the output of an amplifier or other device, and the first wave is the input. In math, the first wave may be an original function and the second a subsequent or secondary function. For example, the first function may be y = sin(x), and the second function may be y = cos(x). The order of the waves does not affect the absolute value of the phase shift, but it does determine if the shift is positive or negative.

### Comparing the Waves

When comparing the two waves, arrange them such that they read left to right using the same x-axis angle or time units. For example, the graph for both may start at 0 seconds. Find a peak on the second wave, and find the corresponding peak on the first. When looking for a corresponding peak, stay within one full cycle, otherwise the phase difference result will be incorrect. Note the x-axis values for both peaks, then subtract them to find the difference. For example, if the second wave peaks at 0.002 seconds and the first peaks at 0.001 seconds, then the difference is 0.001 - 0.002 = -0.001 seconds.

### Calculating Phase Shift

To calculate the phase shift, you need the frequency and period of the waves. For example, an electronic oscillator may produce sine waves at a frequency of 100 Hz. Dividing the frequency into 1 gives the period, or duration of each cycle, so 1/100 gives a period of 0.01 seconds. The phase shift equation is ps = 360 * td / p, where ps is the phase shift in degrees, td is the time difference between waves and p is the wave period. Continuing the example, 360 * -0.001 / 0.01 gives a phase shift of -36 degrees. Because the result is a negative number, the phase shift is also negative; the second wave lags behind the first by 36 degrees. For a phase difference in radians, use 2 * pi * td / p; in our example, this would be 6.28 * -.001 / .01 or -.628 radians.