Calculating amplitude, time-shift and phase of third sinusoid as a sum of two others
Here's how I would do it.

Use the Cosine angle addition formula on $x_1$ and $x_2$:

$$ \cos( \alpha + \beta) = \cos( \alpha )  \cos(\beta)-\sin( \alpha )  \sin(\beta) $$

Like this:

$$ x_1(t) = a_1 \cos( \omega t + \phi_1 ) $$

$$ x_1 = a_1 \cos( \omega t ) \cos(\phi_1)- a_1 \sin( \omega t ) \sin(\phi_1) $$

The $\omega$s will be the same, so:

$$ x_2 = a_2 \cos( \omega t ) \cos(\phi_2)- a_2 \sin( \omega t ) \sin(\phi_2) $$

You can now rearrange and add them together:

$$
\begin{align}
 x_3 &amp;= x_1 + x_2 \\
 &amp;= \left[a_1 \cos(\phi_1) + a_2 \cos(\phi_2) \right] \cos( \omega t ) 
- \left[a_1 \sin(\phi_1) + a_2 \sin(\phi_2) \right] \sin( \omega t )  
\end{align}
$$

Since you know the $\phi$s and $a$s, you can put this in the form:

$$ x_3 =  C \cos( \omega t ) - D \sin( \omega t ) $$

Now, you just have to reverse the process to get it back into time phase form.

$$ \theta = \operatorname{atan2}(D,C) $$

$$ M = \sqrt{ C^2 + D^2 } $$

Therefore:

$$ x_3 =  M \cos( \omega t + \theta ) $$

$$ x_3 =  M \cos\left( \omega \left( t + \frac{\theta}{\omega} \right)  \right) $$

Now, just plug and chug and you should have it.



The latter part might be better understood in a different order:

$$ 
\begin{align}
x_3(t) &amp;= a_3 \cos( \omega t + \phi_3 )\\
&amp;= a_3 \cos( \omega t ) \cos(\phi_3)- a_3 \sin( \omega t ) \sin(\phi_3)
\end{align}
$$

From the equations above:

$$ 
\begin{align}
C &amp;= a_3 \cos(\phi_3)\\
D &amp;= a_3 \sin(\phi_3)
\end{align}
$$

From there it follows:

$$ a_3 = \sqrt{C^2+D^2}$$

and

$$ \phi_3 = \tan^{-1}\left(\frac{D}{C}\right) $$

The thing is, both of these last two equations have two possible solutions each and they need to be matched.  Conveniently, the atan2 function is available on most platforms which yields the correct angle from the latter for the positive root of the former.

This solution is actually the proof of a very important principle:  When two pure tones of the same frequency are added together the result is a pure tone of the same frequency although it is possible for it to have zero amplitude.

In order for the zero amplitude case to occur, the two tones have to have the same amplitude and be a half cycle ($\pi$ radians, 180 degrees) out of phase.  This is called complete destructive interference.

If the two tones are in phase, the amplitudes are merely added and the phase remains the same.  This is technically called complete constructive interference.

By repeated application of this principle, the same holds true for any linear combination of tones.

This shows up in a surprising number of places.