# document.write (document.title)

 Math Help > Trigonometry > Trig Equivalences > Phase shift

Consider the generalized sum of two sinusoidal functions with the same period:

y = a cos(x-A) + b cos(x-B)

Here, we are adding two sine waves with the same period but different phases (A and B) and different amplitudes (a and b).  Surprisingly, this sum is also a sine wave.  On this page, we will discover the amplitude and phase of the sum.

We will start by applying the cosine-of-sum identities to these two cosines, so we can express y as u cos(x) + v sin(x), for some constants u and v:

y = a cos(x-A) + b cos(x-B)
= a cos x cos A + a sin x sin A + b cos x cos B + b sin x sin B
= a cos x cos A + b cos x cos B + a sin x sin A + b sin x sin B
= cos x (a cos A + b cos B) + sin x (a sin A + b sin B)
= u cos x + v sin x, where

u = a cos A + b cos B, and
v = a sin A + b sin B.

Now, given any two numbers u and v, we can find r and θ such that u=r cosθ and v=r sinθ.  This is just converting from rectangular to polar coordinates.  Let's do that with u=a cos A + b cos B and v=a sin A + b sin B:

To find r, we let r2 = u2+v2 = (a cos A + b cos B)2 + (a sin A + b sin B)2.  Then,

r2 = a2cos2A + 2ab cos A cos B + b2cos2B + a2sin2A + 2ab sin A sin B + b2sin2 B
= a2cos2A + a2sin2A + b2cos2B + b2sin2 B + 2ab cos A cos B + 2ab sin A sin B
= a2 + b2 + 2ab cos(A-B)

r = sqrt(a2 + b2 + 2ab cos(A-B))

Now, let θ be the common solution to θ = acos(u/r) and θ = asin(v/r). Following the tradition of Microsoft Excel, I'll denote this common solution of θ by the function atan2(u,v):

θ = atan2(a cos A + b cos B, a sin A + b sin B)

At this point, we assert that r is the amplitude of y, and that θ is the phase shift.  To prove this, we start by reminding the reader that we have chosen r and θ such that:

r cos θ = a cos A + b cos B, and
r sin θ = a sin A + b sin B, so

y = cos x (a cos A + b cos B) + sin x (a sin A + b sin B)
= cos x (r cos θ) + sin x (r sin θ)
= r cos(x-θ)

In summary, with the values of r and θ given by

r = sqrt(a2 + b2 + 2ab cos(A-B))
θ = atan2(a cos A + b cos B, a sin A + b sin B),

the following expressions are equivalent:

y = a cos(x-A) + b cos(x-B)
y = r cos(x-θ)