## 2 Theoretical Considerations about Frequency Mixing  
As stated in the introduction, frequency mixing is enabled by nonlinearities in the FEL amplification process. As is well known, in the linear regime, bunching, energy modulation, and radiation at different frequencies evolve independently of each other, while in the non-linear regime this is no longer the case. However, pushing the FEL process to the non-linear regime to obtain frequency mixing has the disadvantage of a relatively large output at the initial frequencies \(\omega_{1}\) and \(\omega_{2}\), which spoils the electron beam. Moreover, ideally, one wants to control and keep the emission at \(\omega_{1}\) and \(\omega_{2}\) as small as possible because it constitutes usually unwanted background to the main pulse at the mixed frequency and, in particular, at the difference frequency \(\omega_{2}-\omega_{1}\). This is achieved by keeping the FEL process at \(\omega_{1}\) and \(\omega_{2}\) in the linear regime, and mostly relying on a longitudinally dispersive region for creating non-linearities and optimizing the mixing process. Therefore, for the frequency-mixing setup at SASE3, we rely on configurations such as the one in Figure 1. The largest part of the setup is dedicated to the generation of electron energy modulation in the linear regime at two separate frequencies. This is obtained by using an alternating configuration where several undulator segments are tuned at frequency \(\omega_{1}\), followed by others tuned at frequency \(\omega_{2}\) (highlighted in green and yellow colors in the figure). In this way, diffraction effects are kept as small as possible and moreover, while one frequency is amplified, the beam energy modulation at the other can still benefit from the passage through a longitudinally dispersive medium. The exact sequence used in the configuration depends on the frequencies to be generated. The first part of the undulator is followed by a second, consisting of a few segments that are detuned with respect to all the frequencies of interest. They act as a longitudinally dispersive region that further bunches the beam at the difference frequency \(\omega_{2}-\omega_{1}\) (white region in Figure 1) by transforming energy modulation into density modulation. Finally, a few radiator segments are tuned to the difference frequency (orange region in Figure 1). Initially, the pre-bunched electron beam emits coherent radiation. However, if the radiator is longer than a gain length, FEL amplification takes place, resulting in an exponential increase of the frequency-mixed component of the radiation pulse. We can describe the essence of the frequency mixing scheme outlined above for the simple case of vanishing small SASE bandwidths around \(\omega_{1}\) and \(\omega_{2}\) as a special subcase of the Echo Enable Harmonic Generation (EEHG) equation for the bunching factor [7]:  
\[b_{n,m}=|e^{-(1/2)[nB_{1}+(Km+n)B_{2}]^{2}}J_{m}[-(Km+n)A_{2}B_{2}]J_{n}\{-A_ {1}[nB_{1}+(Km+n)B_{2}]\}| \tag{1}\]Here, \(b_{n,m}\) is the bunching at a harmonic with wave number \(k_{E}=nk_{1}+mk_{2}\), with \(k_{1,2}\) the wave numbers of the two EEHG lasers, \(K=k_{2}/k_{1}\), \(A_{1,2}=\Delta E_{1,2}/\sigma_{E}\), and \(B_{1,2}=R_{56}^{1,2}k_{1}\sigma_{E}/E_{0}\). To describe the frequency-mixing mode, it is sufficient to consider a particularly simple case when \(B_{1}=0\), i.e., the first chicane is turned off (the generalization to non-zero case is straightforward, and can be used to further optimize the performance). Moreover, our case of interest actually corresponds to \(m=1\) and \(n=-1\). Finally, setting \(B=B_{2}\) we obtain the bunching factor at the mixed frequency [5]. \[b_{FM}=e^{-(1/2)[(K-1)B]^{2}}J_{1}[(K-1)A_{2}B]J_{1}[(K-1)A_{1}B] \tag{2}\]  
Figure 1: One of the undulator configurations used during the fourth frequency mixing experiment, see text. The upper part of the plot shows the configuration using the color code: green for 1400 eV, yellow for 800 eV and orange for 600 eV.