# Linear combinations of sine and cosine

If you take a linear combination of the cosine and sine function, then the result is again a sinusoid, but with a new amplitude and phase shift. $$a \cos(\theta) + b \sin(\theta) = A \cos(\theta + \theta_0)$$ This is one of those facts which I've always felt should be more obvious to me than it is. I can't help feeling that I might be missing out on some good "conceptual reason" for this to be true. I did a bit of thinking about it today and I came up with the following explanation which I'm not particularly satisfied with. I feel like there should be some perspective on this which renders the fact obvious.

Multiplying the polar equation $r = 2a \cos(\theta) + 2b \sin(\theta)$ by $r$ yields $x^2+y^2 = 2a x + 2by$. Rearranging terms and adding $a^2 + b^2$ to both sides gives $x^2 - 2ax + a^2 +y^2 -2by + b^2 = a^2 + b^2$ which is identical to $$(x-a)^2 + (y-b)^2 = a^2 + b^2$$ which we recognize as the equation for the circle with centre at $(a,b)$ and passing through the origin. This hints that $r = 2a \cos(\theta) + 2b \sin(\theta)$ should define a parametrization of this circle and, indeed, this holds. This circle can be rotated about the origin so as to have its centre on the $x$-axis. Such a circle will have the simpler equation $$r = D \cos(\theta)$$ where $D=2(a^2+b^2)$ is the diameter of the circle. In polar coordinates, performing this rotation amounts to introducing a phase $\theta_0$. In fact $\theta_0$ is an argument for the point $(a,b)$.

Note I'm not really looking for rigorous proofs of this fact, more like interpretations, really.

Every sinusoid (of unit angular frequency) is the real part of $Ae^{i\theta}$ for some complex number $A$. But $A_1e^{i\theta}+A_2e^{i\theta}=(A_1+A_2)e^{i\theta}$, so the sum of two sinusoids is again a sinusoid!

• I was confused until I noticed $A$ is allowed to be complex. This is nice, thanks! – Mike F Mar 28 '14 at 7:34

# Geometric

Here is a geometric illustration: Start with two circles around the origin $O$, one with radius $OA=a$, the other with radius $OB=b$. Choose $A$ so its angle is $\theta$ (marked in cyan). Then projecting that onto the $x$ axis will give $OC=a\cos\theta$. Construct a line perpendicular to $OA$ and intersect it with the other circle to obtain $B$. Make sure to choose the right point of intersection: $B$ should be $90°$ behind $A$ in terms of angle, since $\sin$ is $90°$ begind $\cos$. Projecting $B$ onto the $x$ axis gives $OS=b\sin\theta$. Now you could add these projections, but you could also add the original vectors $OA$ and $OB$ to obtain $OD$ and then project the result $D$ to get $OE=a\cos\theta+b\sin\theta$.

Now as you rotate $A$, $B$ and $D$ will rotate along with it. So you can see that as $D$ moves at the same speed but on a larger circle, its projection $E$ will follow a cosine function so you have $OE=d\cos(\theta+\theta_0)$. You can use the Pythagorean theorem to find that $d^2=a^2+b^2$. You can also see that angle $\theta_0$, marked in orange and negative in my case. It's the angle between ray $OA$ and $OD$, and is defined by $\tan\theta_0=-\frac ba$ unless I got a knot in my thoughts with the sign. As usual when using a tangens to compute an angle from a fraction, make sure you end up in the correct quadrant, perhaps use an atan2 function if available.

# Complex numbers

Since others answers brought up complex numbers, here is what you get if you do all of this in complex numbers:

\begin{align*} A &= ae^{i\theta}=a\cos\theta+ai\sin\theta \\ B &= -bie^{i\theta}=b\sin\theta-bi\cos\theta \\ C &= \operatorname{Re}A = a\cos\theta \\ S &= \operatorname{Re}B = b\sin\theta \\ D &= A+B = (a-bi)e^{i\theta} = (de^{i\theta_0})e^{i\theta} = de^{i(\theta+\theta_0)}\\ E &= \operatorname{Re}D = a\cos\theta+b\sin\theta = d\cos(\theta+\theta_0) \end{align*}

So the core aspect here is the conversion from the Cartesian coordinates $a-bi$ to the polar coordinates $de^{i\theta_0}$. Which again can be characterized by $d^2=a^2+b^2$ and $\tan\theta_0=-\frac ba$. To avoid confusion: $a,b,d,\theta_0$ are all rational numbers here.

The complex representation (or rotational matrix representation) gives a nice way of visualizing without actually saying we are using complex numbers. Cosine and sine are position of a point that started at the x axis and was rotated by angle $\theta$. $a\cos\theta$ is the segment on the $x$ axis at distance $a$, while $b\sin\theta$ has to start with a phase shift of quarter circle. Adding them means fixing the second circle to the point of the first circle.

Because both rotate by the same angle, we can just add (a,0)+(0,-b) in unrotated frame and rotate both by $\theta$. The resulting $x$ segment is your cosine with a phase shift. This method also works if the LHS already contains phase shifts.

Perhaps a better way:

Start with the sum of angles formula for cosine. $$A \cos(\theta + \theta_0) = A \cos\theta \cos\theta_0 - A \sin\theta \sin\theta_0$$

Observe that $\frac{A \sin\theta_0}{A \cos\theta_0} = \tan\theta_0$, which can be any real number as $\theta_0$ ranges over $(-\pi/2, \pi/2)$. In fact, it can be $-b/a$: $\frac{A \sin\theta_0}{A \cos\theta_0} = \frac{-b}{a}$, so that $$A \cos(\theta + \theta_0) =a \cos \theta + b \sin \theta$$