## 2 Method and Principles
The last cross term is the quasi-sinusoidal term with beating frequency, which is given by:  
\[f=\frac{\tau}{\pi\sigma\sigma_{n}}\cong\frac{\mu\tau}{2\pi}. \tag{4}\]  
According to Equation (4), one can clearly find the beating frequency is proportional to the time delay \(\tau\) and the linear chirp rate \(\mu\); thus, it can be easily adjusted by tuning the energy chirp and the time delay of the two laser pulses. Figure 2 shows the relation of the calculated beating frequency \(f\) (THz) (based on Equation (4) with the time delay \(\tau\) and the linear chirp rate \(\mu\) ((\(rad/s)^{2}\)). One can find that the up-limit of the beating frequency is determined by the product of \(\mu\) and \(\tau\). As the beating wave will only occur in the intersection of these two laser pulses, \(\tau\) cannot be too large to keep sufficient power for the energy modulation. As a result, the acceptable time delay of the two pulses is determined by the peak power of the initial laser pulse. Here, as an example, we consider an ultrafast Fourier-transform-limit Gaussian laser (Coherent Inc., Santa Clara, CA, USA) with pulse length of 30 fs (RMS) and peak power of 2 MW. Assuming that the laser pulse is stretched to about 300 fs (RMS), the linear chirp rate is about \(8.05\times 10^{25}\) ((\(rad/s)^{2}\)) and the \(\tau\) is tuned as 900 fs. According to Equation (4), the beating frequency for this case is about 11.5 THz. In the following section, we will show the simulation results of this case. To show the beating frequency limit, we also consider an ultrafast laser with pulse length of 30 fs (RMS) and higher peak power. Assuming that the laser pulse is stretched to 300 fs and the time delay is \(\tau=2.3\) ps, the beating frequency for this case is about 30 THz. The required peak power of the initial laser pulse can be calculated by  
\[P_{0}\ \approx\ 2\times 10^{4}\ P_{b}\sigma_{n}/\sigma. \tag{5}\]  
As we will show below, the required minimum power of the combined pulse for energy modulation \(P_{b}\) is about 10 kW, so \(P_{0}\) can be calculated as 2 GW, which can be easily achieved for a commercial ultrafast laser (Coherent Inc., Santa Clara, CA, USA). At the same time, the beating frequency at 0.1 THz can be easily achieved with a time delay of 0.3 ps and a frequency linear chirp rate of \(1.75\times 10^{24}\) (\(rad/s)^{2}\). Therefore, this method can generate optical signal at THz frequency from 0.1 THz to 30 THz by simply adjusting the linear chirp rate and the time delay of laser pulses. If one wants to generate higher frequency, initial laser with shorter pulse length or relative larger time delay is required. The combined laser pulse serves as a seed laser to modulate the electron beam. Assuming an initial Gaussian beam distribution with the average energy \(E_{0}\), the dimensionless energy deviation of a particle \(p=(E-E_{0})/\sigma_{E}\), \(\sigma_{E}\) is the energy spread, and \(E\) is the beam energy. Following the Ref. [47], the initial longitudinal phase space distribution can be written as  
\[f_{0}(p)=N_{0}(2\pi)^{-1/2}e^{-p^{2}/2}, \tag{6}\]  
where \(N_{0}\) is the number of electrons per unit length of the beam. The modulator resonates at the wavelength of the seed laser. The frequency beating pulse interacts with the electron beam in the modulator, where numerous fine structures appear in the longitudinal phase space of electron beam. The dimensionless energy deviation \(p_{1}\) become  
\[p_{1}=p+Asin(\omega z/c), \tag{7}\]  
where \(\omega\) is the frequency of seed laser.