Curves are projected along the line of sight for inclination $i$. During the challenge, click near the extrema; the largest $|v_r|$ you sample becomes your measured $K$.
Top strip shows rest-frame lab lines. Lower strip shows what the observer sees after Doppler shifting the selected element lines.
Signed circular-orbit energies in teaching units: $M_{\odot}\,\mathrm{AU}^2/\mathrm{yr}^2$. Positive bars are kinetic; negative bars are bound energy terms.
Start from gravitational force and circular motion in the barycentric frame:
$$F = \frac{G M_1 M_2}{a^2}, \qquad F = M_1\omega^2 a_1.$$
Using $a_1 = a\,M_2/(M_1+M_2)$ gives:
$$\omega^2 = \frac{G(M_1 + M_2)}{a^3}.$$
Then with $\omega = 2\pi/P$ and the teaching normalization for $G$:
$$P^2 = \frac{a^3}{M_1 + M_2}.$$
Once orbital speeds are projected along the line of sight, the measurable quantities are the RV semi-amplitudes:
$$K_1 = \frac{2\pi a_1 \sin i}{P}, \qquad K_2 = \frac{2\pi a_2 \sin i}{P}.$$
For a double-lined binary, the ratio tells you the mass ratio directly:
$$\frac{K_1}{K_2} = \frac{M_2}{M_1} = q.$$
For mass inference, astronomers use the SB1 mass function and the SB2 minimum masses:
$$f(m) = \frac{P K_1^3}{2\pi G}, \qquad M_1\sin^3 i,\; M_2\sin^3 i.$$