**Identical Amplitudes**

When two sinusoidal waves of close frequency are played together, we get
$$
\begin{align}
\sin(\omega_1t)+\sin(\omega_2t)
&=2\sin\left(\frac{\omega_1+\omega_2}{2}t\right)\cos\left(\frac{\omega_1-\omega_2}{2}t\right)\\
&=\pm\sqrt{2+2\cos((\omega_1-\omega_2)t)}\;\sin\left(\frac{\omega_1+\omega_2}{2}t\right)\tag{1}
\end{align}
$$
Unless played together, two tones of equal frequency, but different phase sound just the same, so the "$\pm$" goes undetected (the sign flips only when the amplitude is $0$), and what is heard is the average of the two frequencies with an amplitude modulation which has a frequency equal to the difference of the frequencies.

$\hspace{1.5cm}$

The green curve is the sum of two sinusoids with $\omega_1=21$ and $\omega_2=20$; its frequency is $\omega=20.5$. The red curve is the amplitude as given in $(1)$, which has frequency $\omega=|\omega_1-\omega_2|=1$.

**Differing Amplitudes**

A similar, but more complex and less pronounced, effect occurs if the amplitudes are not the same; let $\alpha_1< \alpha_2$. To simplify the math, consider the wave as a complex character:
$$
\begin{align}
\alpha_1e^{i\omega_1 t}+\alpha_2e^{i\omega_2 t}
&=e^{i\omega_2t}\left(\alpha_1e^{i(\omega_1-\omega_2)t}+\alpha_2\right)\tag{2}
\end{align}
$$
The average frequency, $\omega_2$, is given by $e^{i\omega_2 t}$ (the frequency of the higher amplitude component), and the amplitude and a phase shift is provided by $\alpha_1e^{i(\omega_1-\omega_2)t}+\alpha_2$:

$\hspace{3.5cm}$

The amplitude (the length of the blue line) is
$$
\left|\alpha_1e^{i(\omega_1-\omega_2)t}+\alpha_2\right|=\sqrt{\alpha_1^2+\alpha_2^2+2\alpha_1\alpha_2\cos((\omega_1-\omega_2)t)}\tag{3}
$$
The phase shift (the angle of the blue line) is
$$
\tan^{-1}\left(\frac{\alpha_1\sin((\omega_1-\omega_2)t)}{\alpha_1\cos((\omega_1-\omega_2)t)+\alpha_2}\right)\tag{4}
$$
The maximum phase shift (the angle of the green lines) to either side is
$$
\sin^{-1}\left(\frac{\alpha_1}{\alpha_2}\right)\tag{5}
$$
This phase modulation has the effect of varying the frequency of the resulting sound from
$$
\omega_2+\frac{\alpha_1(\omega_1-\omega_2)}{\alpha_2+\alpha_1}
=\frac{\alpha_2\omega_2+\alpha_1\omega_1}{\alpha_2+\alpha_1}\tag{6}
$$
(between $\omega_2$ and $\omega_1$) at peak amplitude to
$$
\omega_2-\frac{\alpha_1(\omega_1-\omega_2)}{\alpha_2-\alpha_1}
=\frac{\alpha_2\omega_2-\alpha_1\omega_1}{\alpha_2-\alpha_1}\tag{7}
$$
(on the other side of $\omega_2$ from $\omega_1$) at minimum amplitude.

Equation $(3)$ says that the amplitude varies between $|\alpha_1+\alpha_2|$ and $|\alpha_1-\alpha_2|$ with frequency $|\omega_1-\omega_2|$.

$\hspace{1.5cm}$

The green curve is the sum of two sinusoids with $\alpha_1=1$, $\omega_1=21$ and $\alpha_2=3$, $\omega_2=20$; its frequency varies between $\omega=20.25$ at peak amplitude to $\omega=19.5$ at minimum amplitude. The red curve is the amplitude as given in $(3)$, which has frequency $\omega=|\omega_1-\omega_2|=1$.

**Conclusion**

When two sinusoidal waves of close frequency are played together, the resulting sound has an average frequency of the higher amplitude component, but with a modulation of the amplitude and phase (beating) that has the frequency of the difference of the frequencies of the component waves. The amplitude of the beat varies between the sum and the difference of those of the component waves, and the phase modulation causes the frequency of the resulting sound to oscillate around the frequency of the higher amplitude component (between the frequencies of the components at peak amplitude, and outside at minimum amplitude).

If the waves have the same amplitude, the phase modulation has the effect of changing the frequency of the resulting sound to be the average of the component frequencies with an instantaneous phase shift of half a wave when the amplitude is $0$.

Ok, I have found how to fit my sine curve. I have done it by adding delta y between those two vectors into the value of found sine function (blue). However, the sine wave which is now fitted between points is a little bit different (violet). I got a question for all you experts, does it affect the length of sine wave which i found or the length of the original and "moved" curves are the same? Here is the image

## Best Answer

Saying no phase difference does not make sense if the frequencies are different. If you have the first rising zero crossings together, then next one will not be. The result will not be a sine wave, so there will not be one frequency. The period will be the least common multiple of the to periods, assuming one exists. You can use the function sum identities to see that you have a product of two sine waves, one at the average of the two frequencies and one at half the difference. In your example you would have the product of a $1.5 Hz$ wave and a $0.5 Hz$ wave.

It is easier to see if the frequencies are closer. The envelope is half the difference frequency and the high frequency is the average.