[1,2,3]Maxim Sirotin [1,2]Peter Hommelhoff

1]Department of Physics, Friedrich-Alexander-Universität Erlangen-Nürnberg
(FAU), Schloßplatz 4, Erlangen, 91058, Germany 2]Max Planck Institute for the
Science of Light, Staudtstraße 2, Erlangen, 91058, Germany 3]Research
Laboratory of Electronics, Massachusetts Institute of Technology (MIT), 77
Massachusetts Ave, Cambridge, 02139, MA, USA 4]Institute of Applied Physics,
Hebrew University of Jerusalem (HUJI), Mount Scopus, Jerusalem, 9190500,
Israel

# Quantum Optics with Recoiled Free Electrons

<EMAIL_ADDRESS>Andrei Rasputnyi<EMAIL_ADDRESS>Tomáš Chlouba
<EMAIL_ADDRESS>Roy Shiloh<EMAIL_ADDRESS><EMAIL_ADDRESS>[  [  [  [

###### Abstract

Quantum states of light play a key role in modern quantum science, but
creating hybrid quantum light-matter states remains a challenge. A promising
basis for the creation of hybrid states is the interaction of free electrons
with photons, which has so far been largely implemented without taking into
account electron quantum recoil effects. We provide an analytical quantum
electrodynamics-based framework for quantum optics with recoiled electrons and
introduce a single recoil parameter $\sigma$. With this framework, we show how
to generate photon and electron-photon Bell, Greenberger-Horne-Zeilinger (GHZ)
and NOON states, coherent states, squeezed vacuum (including bright squeezed
vacuum) and twin beams. We analyze the transition between these states and
predict a new class of photon and electron-photon quantum states shaped with
the photon recoil effect (recoil-induced shaping). These results have wide
potential applications including quantum computing and communication with
photons and free electrons, and open up a novel avenue for ultrafast electron
microscopy and next-generation free-electron sources.

###### keywords:

quantum optics, free electrons, electron microscopy

Quantum states of light lie at the heart of quantum science and technology.
They are instrumental for a large variety of fields, the most prominent being
quantum communication, computing and sensing, as well as microscopy. Some of
the states play a particularly important role in quantum optics: Single-photon
states allow quantum key distribution [1] and are indispensable for quantum
sensing [2] and communication [3]; Maximally entangled Bell and
Greenberger–Horne–Zeilinger (GHZ) states helped test quantum mechanics [4] and
are used in quantum communication, cryptography protocols and fault-tolerant
computing architectures [5], along with related Schrödinger cat and Gottesman-
Kitaev-Preskill (GKP) states [6]. Squeezed vacuum (SV) [7, 8, 9] and bright
squeezed vacuum (BSV) (single-mode SV with mean photon number
$\langle\hat{N}\rangle\gg 1$) [10, 11, 12] found a wide variety of
applications in quantum sensing and solid-state physics [13, 14, 15, 16, 17].

For some applications, the generation and handling of photonic states poses
limitations due to the weak interaction of photons with each other [18].
Hence, the realization of hybrid light-matter states is gaining increasing
interest from the quantum physics community. Exploitation of the different
natures of light and matter can be advantageous for numerous applications and
can give rise to novel platforms for quantum technologies [19, 20, 18, 21].

One of the prospective platforms for the realization of quantum light-matter
states are swift electrons coupled to light in the electron microscopes (EM).
Since the first observation of photon-induced near-field electron microscopy
(PINEM) effects [22] and the quantum coherent coupling of electrons and light
[23] in a transmission electron microscope (TEM), this field grew rapidly. In
parallel, engineering the interaction between free electrons and photons has
led to several new fields, such as nanophotonic or dielectric laser
acceleration [24, 25, 26]. The direct interaction between individual electrons
[27, 28] and efficient electron-photon coupling [29, 30, 31, 32] will likely
facilitate new design opportunities and abilities in electron microscopy.
Examples include coherent near-field imaging [33, 34], resolution enhancement
and electron interferometry [35, 36]. Furthermore, the fully quantized
interaction of free electrons, the electromagnetic vacuum, and photons,
results in the creation of entangled hybrid light-matter states [32, 19] (Fig.
1).

Figure 1: Schematic illustration of electron-photon states generation. (1)
Free electron generation by, for example, emission from a metallic nanotip.
(2) Interaction of a free electron with the evanescent cavity vacuum field
$\ket{\text{vac}}$. (3) Formation of the entangled electron-photon state
$\ket{\text{e-ph}}$. Depending on the type of interaction (1- or 2-photon
transition), recoil, and the electron’s spectral width, a variety of states
can be generated. In the table: the dispersion curve (blue) implies weak
recoil (linear curve) or strong recoil (nonlinear curve). A wide electron
spectrum implies the overlap of the electron spectra before and after
interaction, a narrow spectrum implies their distinguishability.

Most of the experiments in these directions were so far done in TEMs at
energies in the range of 70 to 200 keV. Experiments in scanning electron
microscopes (SEM) with their smaller electron beam energies in the range of
0.5 to 30 keV can be advantageous because of a larger potential interaction
strength. Nanophotonic laser acceleration experiments [37] as well as an
initial PINEM experiment [38] inside of an SEM show the great potential [39]
of this platform. When transitioning from TEM to SEM electron energies, the
electron-photon phase-matching condition (energy-momentum conservation) poses
difficulties, because of the quantum recoil effect: the phase-mismatch due to
the change of the electron momentum following any photon emission or
absorption event cannot be ignored. This is of particular importance at large
interaction lengths $L$ (tens and hundreds of micrometers), necessary to
achieve high coupling efficiency. Although recoil has a key advantage—it
brings up an additional degree of freedom for engineering light-matter
states—currently, only a few works [40, 41, 42, 43, 44, 45] are taking it into
account.

In the following, we will develop a quantum electrodynamics-based framework
that provides an exact solution for the problems of free-electron quantum
optics with recoiled electrons. We describe a new effect—recoil-induced
shaping: the change in the electron-photon state under the influence of
recoil—and show the possibility of generating fundamentally new types of
quantum states that can expand the capabilities of quantum optics, attosecond
physics and electron microscopy.

## Microscopic picture of recoil

We consider the interaction of free electrons with the evanescent, quantized
electric field of a cavity (Fig. 1). Free electrons, generated in an SEM or
TEM, on-chip or with other methods, are brought to the energy of interest and
interact with the vacuum near-field of an empty optical resonator. As a
result, an entangled electron-photon state is formed. Depending on the
interaction parameters, a wide range of states can be generated (Fig. 1,
tables). The effect responsible for the electron-light coupling is the near-
field Cherenkov radiation [46, 47, 48, 49, 50, 51]. In the presence of a
diffraction grating (Fig. 1), this effect can also be considered the Smith-
Purcell radiation into the cavity [52, 53]. Here, we focus our attention on
the case of a cavity mode initially empty or populated with photon Fock
states, although the approach can be applied to more general cases.

Flying past the cavity, an electron can emit photons into it or absorb photons
from it. For the interaction to be efficient, it is necessary to fulfill the
phase-matching condition (Fig. 2a), so the change of electron momentum should
be matched with the photon momentum (so-called direct phase-matching). The
dispersion curves of slow and fast electrons are shown schematically in Fig.
2b. In case of fast electrons, the electron dispersion is almost linear, which
results in the generation of photons with Poissonian statistics [29]. In
contrast, the dispersion curve of slow electrons is parabolic, which prevents
the consecutive multiple emission of photons with the same frequency due to
the phase mismatch (Fig. 2b, multi-mode inset). This is attributed to the
quantum recoil effect [41], where the linear dispersion implies weak recoil
and the parabolic a non-negligible one: To compensate the phase-mismatch
appearing after the emission of the first photon, the next photon needs to
have a slightly different frequency.

To visualize the phase-matching condition, it is convenient to use the
coordinates ($\Delta\Omega$, $\omega$) versus ($\Delta k$, $\varkappa$). Here,
$\Delta\Omega$ and $\Delta k$ are the changes of the electron frequency and
momentum after the photon emission, whereas $\omega$ and $\varkappa$ are the
photon angular frequency and momentum, respectively. Thus, the phase-matching
condition is represented by the intersection between the photon dispersion
curve (orange) and the electron frequency and momentum change curve
($\Delta\Omega$ on $\Delta k$, blue) in Fig. 2c. For photon energies much
smaller than the kinetic electron energy we can write the energy-momentum
conservation as $\Delta\Omega=\omega$ and
$v^{photon}_{ph}\equiv\omega/\varkappa=\Delta\Omega/\Delta k\approx
v^{electron}_{gr}$, where the equality of the electron group velocity
$v^{electron}_{gr}$ and the photon phase velocity $v^{photon}_{ph}$ is often
used in the literature as an equivalent phase-matching condition [54].

For direct phase-matching and normal photon dispersion, a blue shift to higher
photon frequencies can be observed because the speed of the electron is
reduced, hence only photons with higher frequency (and lower phase velocity)
can fulfill the phase-matching condition $v^{electron}_{gr}=v^{photon}_{ph}$
with the slowed down electron (Fig. 2c).

Figure 2:  Dispersion curves and phase-matching condition. a) Visualization
and diagram of the process: initial electron with energy $\hbar\Omega_{1}$ and
momentum $\hbar k_{1}$ annihilates and generates photons with angular
frequency $\omega$ and momentum $\hbar\varkappa$ and a final electron with
energy $\hbar\Omega_{2}$ and momentum $\hbar k_{2}$. Energy-momentum
conservation leads to the conditions
$\Omega_{1}-\Omega_{2}\equiv\Delta\Omega=\omega$ and $k_{1}-k_{2}\equiv\Delta
k=\varkappa$. b) Electron dispersion curve $\Omega(k)$ for fast electrons
(upper inset) and slow electrons (lower inset). c-f) Schematic dependence of
the electron energy loss $\hbar\Delta\Omega$ on the electron momentum loss
$\hbar\Delta k$ for the initial electron energy $\hbar\Omega_{1}$ (bold blue
curve) and after the consecutive emission of photons (thin blue curves), and
the schematic dispersion curve $\omega(\kappa)$ of a cavity photon (orange
curve). d) Recoil with quasi-phase-matching (QPM) and
$v^{electron}_{gr}>v^{photon}_{gr}$ results in a blue shift of the generated
photon. $\vec{G}$ (green) is a diffraction grating vector. e) Recoil with QPM
and $v^{electron}_{gr}<v^{photon}_{gr}$ results in a red shift of the
generated photon. (c), (d) and (e) assume a multi-mode cavity. f) QPM allows
the generation of k-photon states inside the single-mode cavity. Here, for
example, two-photon (k=2) generation is phase-matched.

An interesting case is the interaction of free electrons with an effectively
single-mode cavity (Fig. 2b, single-mode inset). This means that the electron
can be phase-matched to one resonant frequency and not to another following
the photon emission. In this case, the recoil effect results in the recoil-
induced shaping of the quantum state of an electron and a photon. In the case
of an effectively single-mode cavity with a phase-matched single-photon
transition, the recoil forbids the generation of higher photon states,
resulting in antibunching (Fig. 2(b,f)) and creation of a single-photon state.
We call this effect recoil-induced antibunching, a particular case of the
recoil-induced shaping. Later in the article we quantitatively describe the
single-mode cavity case.

It is also possible to use the diffraction grating vector $\vec{G}$ to fulfill
the phase-matching condition [52, 53, 43], which is called quasi-phase-
matching (QPM). QPM can change the shift sign of the emitted photon frequency
depending on the group velocity relation. Recoil with QPM, when the group
velocity of the electron is larger than the group velocity of the photon
$v^{electron}_{gr}>v^{photon}_{gr}$, results in a blue shift of the generated
photon (Fig. 2d), while recoil with QPM and
$v^{electron}_{gr}<v^{photon}_{gr}$ results in a red shift of the generated
photon (Fig. 2e). Note that to fulfil the phase-matching condition the photon
phase velocity needs to satisfy the QPM condition $\Delta
k-\varkappa-|\vec{G}|=0$ or
$\omega(1/v^{electron}_{gr}-1/v^{photon}_{ph})-|\vec{G}|=0$. We can also
phase-match two-photon transitions or even higher order ones (Fig. 2f) using
QPM, which can result in the creation of shaped electron-photon squeezed
vacuum state.

## Theoretical model

To quantitatively describe the above processes, we write the Hamiltonian
$\hat{H}\sim g_{Qu}\cdot\hat{a}^{\dagger}\hat{c}^{\dagger}\hat{c}+h.c.$, where
$\hat{c}^{\dagger}$ and $\hat{a}^{\dagger}$ are the electron and photon
creation operators, respectively, and $g_{Qu}$ is the vacuum coupling strength
[29] (see Methods for details). If the cavity is initially in the vacuum state
$\ket{0}$ and the electron has initial energy $\hbar\Omega_{0}$, then the
electron-photon wavefunction $\ket{\psi}=\sum_{n}C_{-n}\ket{-n,n}$, where
$\ket{-n,n}\equiv\ket{\Omega_{0}-n\cdot\omega}\otimes\ket{n}$, i.e., the
electron carries an energy of $\hbar(\Omega_{0}-n\cdot\omega)$, while the
cavity is in a Fock state with $n$ photons. We will further refer to the state
$\ket{-n,n}$ as the $n^{\mathrm{th}}$ level of the electron-photon system. In
the following, we solve this problem numerically, using our approximate,
analytical approach (sinc-model), and exactly (analytically) after
autonomization. We then compare and discuss the results.

We introduce the phase-matching (PM) width $\sigma$ as the recoil parameter,
which characterizes how many photons an electron must emit before it begins to
experience a recoil-induced phase mismatch:

$\sigma\approx\frac{1240}{511^{2}}\frac{\left((E^{2}-E_{0}^{2})[\mathrm{keV}^{2}]\right)^{3/2}}{\left(E_{ph}[\mathrm{eV}]\right)^{2}\cdot
L[\mu\mathrm{m}]}\approx
155\frac{\left(E_{kin}[\mathrm{keV}]\right)^{3/2}}{\left(E_{ph}[\mathrm{eV}]\right)^{2}\cdot
L[\mu\mathrm{m}]},$ (1)

where $E_{ph}=\hbar\omega$, $L$ is the length of interaction, and $E$,
$E_{kin}$, $E_{0}$ are the total, kinetic and rest energy of the electron,
respectively (see Methods for details).

We can approximate the effective number of levels $N_{\mathrm{eff}}$ in the
electron-photon system, according to the number of emission
$\Delta\Omega/\omega_{0}<0$ or absorption $\Delta\Omega/\omega_{0}>0$ side-
bands, and the zero-loss peak at $\Delta\Omega/\omega_{0}=0$, as

$N_{\mathrm{eff}}=\begin{cases}\sigma+1&\text{if $\sigma\geq 1$}\\\ 2&\text{if
$\sigma<1$}.\end{cases}$ (2)

Fig. 3a shows the PM width $\sigma$ as a function of electron energy $E_{kin}$
and emitted photon vacuum wavelength $\lambda$. We see that for small electron
energies or short emitted wavelengths, the electron is quickly driven away
from phase-matching, forming a two-level system for $\sigma<1$ (above the
white line labeled 1). With increasing energy and decreasing emitted
wavelengths, more and more levels need to be included, eventually forming the
infinite ladder.

To characterize the statistics of the photon subsystem of the electron-photon
state, we consider the normalised second-order correlation function at zero
delay
$g^{(2)}(0)=\frac{\langle\hat{a}^{\dagger}\hat{a}^{\dagger}\hat{a}\hat{a}\rangle}{\langle\hat{a}^{\dagger}\hat{a}\rangle^{2}}$
(short $g^{(2)}$), which shows antibunching of the emission for $g^{(2)}<1$
(sub-Poissonian statistics) or bunching $g^{(2)}>1$ (super-Poissonian
statistics), while $g^{(2)}=1$ corresponds to Poissonian statistics. The
emission with $g^{(2)}>3$ is also called superbunched.

## Single-photon processes

Figure 3:  Single-photon processes. a) Phase matching (PM) width $\sigma$
(color code) as function of the photon vacuum wavelength and the electron
energy. A transition from the infinite ladder through the finite ladder to a
two-level system (TLS) can be observed when going to smaller electron
energies, at highly relevant photon energies. The interaction length $L$ is
500 $\mu$m for (a) and (b). b) Correlation function $g^{(2)}$ as function of
photon wavelength and electron energy, showing a transition from coherent
light generation to single-photon generation. c) Comparison of the different
models discussed in the paper: correlation function $g^{(2)}$ as function of
PM width $\sigma$, showing the transition from Poissonian to sub-Poissonian
statistics (the curve is largely independent on $g_{Qu}$ for all the
$g_{Qu}\lesssim 0.5$ because of the dominance of one-photon contribution). The
sinc-model slightly underestimates $g^{(2)}$, while the autonomous solution is
in perfect agreement with the numerical calculations. d) Correlation function
$g^{(2)}$ as function of coupling strength $g_{Qu}$ and PM width $\sigma$,
showing the generation of states with super-Poissonian statistics in the high-
coupling regime. These peaks coincide with the revivals of multi-level Rabi
oscillations (first two are marked with red dots). e) Electron energy spectra
with varying coupling strength $g_{Qu}$ for different PM widths $\sigma$,
showing the transition from Poissonian to deterministic single-photon
generation. The top insets show the relative coupling between the energy
levels (sinc function) for each corresponding $\sigma$. Here and further the
Gaussian broadening of electron spectrum side bands is introduced for clarity.
The probabilities (color scales) are multiplied by the factors given in the
upper left corners. f) Probability distributions of the electron-photon
wavefunctions in (e) for states with maximum single-photon generation
probability (marked in (e) with white dashed lines).

We first focus on single-photon transitions in the low-coupling regime
($g_{Qu}\lesssim 0.5$). The electron-photon state in this case and with no
recoil ($\sigma\gg 1$) is a weak coherent state $\ket{\psi}=\sum_{n\geq
0}^{\infty}e^{-\left|g_{\mathrm{Qu}}\right|^{2}/2}\frac{g_{\mathrm{Qu}}^{n}}{\sqrt{n!}}\ket{-n,n}\equiv\ket{\alpha^{\text{e-ph}}}$
[29]. As $\sigma$ decreases, recoil reduces the probability of state
components with large $n$, which creates a sharp drop in probability (cut-off)
for $n\gtrsim\sigma$. With $\sigma\lesssim 1$ we effectively get
$\ket{\psi}\approx c_{0}\ket{0,0}+c_{1}\ket{-1,1}$ with $c_{1}\approx g_{Qu}$.

The photon subsystem of this state can be used as a single-photon source. The
transition from Poissonian to sub-Poissonian photon statistics with
antibunching is observed as $\sigma$ decreases (Fig. 3c). For small coupling
strengths we can achieve recoil-induced antibunching ($g^{(2)}<1$) for
experimentally-reasonable values of $E_{kin},E_{ph}$ and $L$ (Fig. 3b). For
example, at $E_{ph}=$ 2.33 eV (vacuum wavelength 532 nm) and with 5 keV
electrons at an interaction length of 0.4 mm, we get $\sigma=$ 0.83 and
$g^{(2)}=$ 0.05, which is on-par with quantum-dot single-photon sources [55].
Fig. 3(b-c) show that the recoil parameter $\sigma$ directly determines the
$g^{(2)}$ value and is the only parameter needed in the low-coupling regime.

In the high-coupling regime ($g_{Qu}\gtrsim 0.5$), the behavior of electron-
photon states becomes more complex and depends not only on $\sigma$, but also
on $g_{Qu}$. As $\sigma$ decreases, we observe a transition from the electron-
photon coherent state $\ket{\alpha^{\text{e-ph}}}$ ($\sigma\gg 1$) to a new
type of quantum state: the electron-photon coherent state shaped with the
recoil effect $\ket{\alpha^{\text{e-ph}}_{\text{shaped}}}$, which depends on
both $g_{Qu}$ and $\sigma$ (Fig. 3(e-f)). The shaped coherent state
$\ket{\alpha^{\text{e-ph}}_{\text{shaped}}}$ demonstrates an oscillatory
behavior: with an increase in $g_{Qu}$, the population of the levels reaches
the recoil cut-off ($n\approx\sigma$), is reflected, and returns back to the
zero level. With a further increase in coupling strength, these oscillations
are repeated with increased amplitude (see Extended Data Fig. 6).

At $\sigma\lesssim 1$, the shaped coherent state becomes a Bell-like state
$\ket{\psi}=\alpha\ket{0,0}+\beta\ket{-1,1}$, where $\alpha=\cos(g_{Qu})$ and
$\beta=\sin(g_{Qu})$, showing Rabi oscillations (Fig. 3(e-f) and Extended Data
Fig. 10). From the Bell-like state, by changing $g_{Qu}$, one can obtain the
state $\ket{\psi}=\ket{-1,1}$ and the exact electron-photon Bell state
$\left|\Phi^{+}\right\rangle\equiv\frac{|00\rangle+|11\rangle}{\sqrt{2}}$
(here, the electron state $\ket{-1}$ is redesignated as $\ket{1}$ for
clarity). Note that state $\ket{\psi}=\ket{-1,1}$ can be used as a
deterministic single-photon source.

The photon subsystem of the shaped coherent electron-photon state
$\ket{\alpha^{\text{e-ph}}_{\text{shaped}}}$, depending on $\sigma$ and
$g_{Qu}$, can have both Poissonian statistics (generation of coherent
radiation), sub-Poissonian statistics (single-photon generation), and super-
Poissonian statistics (multiphoton generation, Fig. 3d). Clear peaks (red
dots) in the $g^{(2)}$ map in Fig. 3d coincide with revivals of the zero level
($\Delta\Omega/\omega_{0}=0$) population, and are related to the generation of
superbunched $k$-photon states with low mean photon number
$\langle\hat{N}\rangle\ll 1$ (see Extended Data Fig. 6 for details).

It is interesting to realize that a free electron can be used in single-photon
processes as a perfect single-photon absorber if the initial cavity state is
$\ket{1}$ (Extended Data Fig. 7). Similarly, the electron spectrum after the
interaction can be used to distinguish between different photon states (Fock,
coherent, thermal etc.) [56, 57].

## Two-photon processes

We now investigate two-photon near-field Cherenkov radiation transitions (Fig.
2f). For this process to become dominant, the emission or absorption of a
single photon is mismatched, but the emission or absorption of two photons is
phase-matched.

A two-photon Cherenkov process can be approximately described by the effective
two-photon Hamiltonian $\hat{H}_{\mathrm{eff}}\sim
g_{Qu}^{\mathrm{eff}}\cdot\hat{a}^{\dagger}\hat{a}^{\dagger}\hat{c}^{\dagger}\hat{c}+h.c.$
with the effective two-photon coupling strength
$g_{Qu}^{\mathrm{eff}}\text{(2-photon)}\equiv\frac{g_{Qu}^{2}}{-\varphi_{-1}L}$,
where $\varphi_{-1}L=-\Delta
k_{-1}L=-(k(\Omega_{0})-k(\Omega_{-1})-\varkappa)L$ is the one-photon
transition mismatch, and $g_{Qu}$ is the one-photon transition coupling
strength.

Figure 4:  Two-photon processes. a) Electron energy spectra as a function of
coupling strength $g_{Qu}$ for different PM widths $\sigma$, showing the
transition from electron-photon squeezed vacuum (SV) to shaped SV and NOON
states (the emission of two photons is phase-matched as in in Fig.2(f)). The
inset (right) shows two-photon Rabi oscillations for lower one-photon mismatch
$\varphi_{-1}L$. b) Probability distributions of the electron-photon
wavefunction in (a) for states with $g_{Qu}=15$. c-e) Statistical properties
of the electron-photon shaped SV. Probability distribution $P(n)$ of the
component $\ket{\Omega_{-n},n}$ (diagonal elements in (b)) for different
$\sigma$ and fixed $g_{Qu}=22$ (c-d), and $g^{(2)}$ dependence on $g_{Qu}$ and
$\sigma$ (e).

We discuss the non-recoil regime $\sigma\gg 1$ first. Since the two-photon
process is phase-matched, we obtain a significant probability only for even
photon numbers and even electron energy loss states $\ket{\psi}\approx
c_{0}\ket{0,0}+c_{1}\ket{-2,2}+c_{2}\ket{-4,4}+...$ , we call this state
electron-photon squeezed vacuum $\ket{\text{SV}^{\text{e-ph}}}$ (see the
details in Methods). By changing the coupling strength
$g_{Qu}^{\mathrm{eff}}$, we can move from the photon-pair regime at low
coupling $\ket{\psi}\approx c_{0}\ket{0,0}+c_{1}\ket{-2,2}$ with
$|c_{1}|\ll|c_{0}|$ and $c_{1}\approx g_{Qu}^{\mathrm{eff}}$ to bright
squeezed vacuum (Fig. 4(a-b), left panels).

As $\sigma$ decreases, the electron-photon state changes under the influence
of recoil-induced shaping. We call this type of states shaped squeezed vacuum
$\ket{\text{SV}^{\text{e-ph}}_{\text{shaped}}}$ (Fig. 4(a-b), central panels).
Since recoil reduces the probability of state components with large $n$, the
state acquires a characteristic cut-off in statistics, similar to the single-
photon process. This cut-off is clearly visible in Fig. 4 (a,c,d). It can be
seen that the position of the cut-off depends on both the coupling strength
(the larger the $g_{Qu}^{\mathrm{eff}}$, the farther away the cut-off is, Fig.
4a) and on $\sigma$ (Fig. 4c). Another consequence of recoil is a two-photon
quantum walk, marked in Fig. 4a, which is caused by the interference of
probability amplitudes of different levels after their reflection from the
cut-off boundary.

Finally, at $\sigma\lesssim 1$, shaped squeezed vacuum transitions into the
NOON-like state $\ket{\psi}\approx\alpha\ket{0,0}+\beta\ket{-2,2}$, where
$\alpha=\cos(g_{Qu}^{\mathrm{eff}})$ and $\beta=\sin(g_{Qu}^{\mathrm{eff}})$,
showing two-photon Rabi oscillations (Fig. 4(a-b), right panels and Extended
Data Fig. 10). In this regime, we obtain an effective three-level system with
the coupled levels $\ket{0,0}$ and $\ket{-2,2}$, and with the mismatched
intermediate level $\ket{-1,1}$, which is analogous to the Raman process [58].
At $g_{Qu}^{\mathrm{eff}}\approx 1$, the exact electron-photon NOON state
$\ket{\text{NOON}}\equiv\frac{|20\rangle+|02\rangle}{\sqrt{2}}$ can be
generated.

Controlling $\sigma$ and $g_{Qu}$ (or $g_{Qu}^{\mathrm{eff}}$) allows one to
engineer the statistics of the electron-photon state in general and the photon
subsystem in particular. The statistical properties of the shaped squeezed
vacuum are shown in Fig. 4(c-e): the recoil effect causes a cut-off and limits
the inherent heavy tail of the squeezed vacuum state (Fig. 4c, d). Fig. 4e
shows the dependence of the correlation function of the photon statistics
$g^{(2)}$ on $\sigma$ and $g_{Qu}$. In the absence of the recoil effect
($\sigma\gg 1$), $g^{(2)}=3+1/\langle\hat{N}\rangle$ as expected for squeezed
vacuum [59]. As $\sigma$ decreases, the $g^{(2)}$ function acquires many
periodic peaks allowing to significantly change the degree of bunching with a
slight change in the system parameters. At the same time,
$\ket{\text{SV}^{\text{e-ph}}}$ and
$\ket{\text{SV}^{\text{e-ph}}_{\text{shaped}}}$ states harbor an electron sub-
system that can be used for the photon number resolution (heralding the number
of photons by measuring the spectrum of electrons) and the preparation of non-
Gaussian states of light [60].

If the cavity has two modes that can be phase-matched to the joint two-photon
transition (one photon in each mode simultaneously), the two-photon Cherenkov
process can create an electron-photon twin-beam state or two-mode squeezed
vacuum $\ket{{\text{Twin}}^{\text{e-ph}}}$ (see Extended Data Fig. 9 and
Methods for the details), which turns into a GHZ-like state
$\alpha\ket{000}+\beta\ket{111}$ at $\sigma\lesssim 1$ (Extended Data Fig.
10). At $g_{Qu}^{\mathrm{eff}}\approx 1$ the exact GHZ state is achievable,
where $\ket{\text{GHZ}}\equiv\frac{|000\rangle+|111\rangle}{\sqrt{2}}$.
Deterministic photon pair (electron-photon triplets) creation
$\ket{\psi}=\ket{-2,2}$ (degenerate) and $\ket{\psi}=\ket{-2,1,1}$ (non-
degenerate) is also possible with low $\sigma$, low one-photon transition
mismatch and $g_{Qu}^{\mathrm{eff}}\approx\pi/2$ (Extended Data Fig. 12(d-e)).

Our approach can also describe one-photon as well as two-photon PINEM with
strong classical electromagnetic fields and recoiled electrons (Extended Data
Fig. 11). Since the PINEM interaction can modulate the electron wavefunction
and can result in the formation of attosecond electron bunch trains [23, 61,
62, 63], using the recoil effect and/or two-photon phase-matching provides
another degree of freedom for electron wavefunction shaping, potentially
resulting in improved temporal resolution. Two-photon PINEM can also result in
photon state squeezing, in analogy with the ponderomotive interaction [64].
For the relevant PINEM experiments reported so far (in particular [30, 65])
the recoil parameter $\sigma$ was much larger than the observed number of
side-bands in the electron spectrum, hence the recoil effect could not be
observed. PINEM in the SEM [38] is the most promising candidate for the first
observation of recoil-induced shaping of PINEM spectra.

## Outlook

In this paper, we extensively studied the effects of the quantum electron
recoil on the generation of free-electron-photon states, described an approach
to create electron-photon and pure photon Bell, NOON, GHZ, squeezed vacuum and
twin-beam states, and predict a new class of light-matter states shaped with
the recoil effect. We show the possibility of deterministic single-photon
generation and absorption, as well as deterministic degenerate and non-
degenerate photon pair creation. To do this, we introduced a single recoil
parameter $\sigma$, which only depends on three relevant quantities: the
electron energy, the photon energy, and the interaction length. The resulting
quantum electrodynamics-based model of free-electron-photon interactions can
be widely applied to various questions and experiments in the nascent and
steeply growing field of free-electron quantum optics.

Furthermore, our work naturally raises a number of intriguing questions for
future work such as: (i) What happens to the electron wavefunction during
squeezed vacuum generation? Does energy/momentum or quadrature squeezing show
up? (ii) What is the squeezing effect on the cavity loaded initially with a
coherent state? And (iii) how do recoil and two-photon processes affect the
characteristics of electron attosecond bunches in PINEM? We expect these
questions can be answered based on the approach developed here.

*Data availability The data supporting the findings of this study are available from the corresponding authors upon reasonable request.

*Code availability The code is available from the corresponding authors upon reasonable request.

*Acknowledgements This research was supported by the European Research Council Advanced Grant AccelOnChip, Gordon and Betty Moore Foundation Grant 11473 and Deutsche Forschungsgemeinschaft Project-ID 429529648: TRR 306 QuCoLiMa.

*Author contributions M.S. and P.H. initiated the research. M.S. and A.R. derived the theory. M.S. performed the numerical calculations and wrote the first draft of the paper. The project was supervised by T.C., R.S. and P.H. All authors discussed the results and contributed to the writing of the manuscript.

*Competing interests The authors declare no competing interests.

## References

  *   * [1] Scarani, V. _et al._ The security of practical quantum key distribution.  _Reviews of Modern Physics_ 81, 1301–1350 (2009).  URL https://link.aps.org/doi/10.1103/RevModPhys.81.1301.  Publisher: American Physical Society.
  * [2] Degen, C., Reinhard, F. & Cappellaro, P.  Quantum sensing.  _Reviews of Modern Physics_ 89, 035002 (2017).  URL https://link.aps.org/doi/10.1103/RevModPhys.89.035002.  Publisher: American Physical Society.
  * [3] Gisin, N. & Thew, R.  Quantum communication.  _Nature Photonics_ 1, 165–171 (2007).  URL https://www.nature.com/articles/nphoton.2007.22.  Publisher: Nature Publishing Group.
  * [4] Greenberger, D. M., Horne, M. A., Shimony, A. & Zeilinger, A.  Bell’s theorem without inequalities.  _American Journal of Physics_ 58, 1131–1143 (1990).  URL https://doi.org/10.1119/1.16243.
  * [5] Baragiola, B. Q., Pantaleoni, G., Alexander, R. N., Karanjai, A. & Menicucci, N. C.  All-Gaussian Universality and Fault Tolerance with the Gottesman-Kitaev-Preskill Code.  _Physical Review Letters_ 123, 200502 (2019).  URL https://link.aps.org/doi/10.1103/PhysRevLett.123.200502.  Publisher: American Physical Society.
  * [6] Dahan, R. _et al._ Creation of Optical Cat and GKP States Using Shaped Free Electrons.  _Physical Review X_ 13, 031001 (2023).  URL https://link.aps.org/doi/10.1103/PhysRevX.13.031001.  Publisher: American Physical Society.
  * [7] McKenzie, K. _et al._ Squeezing in the Audio Gravitational-Wave Detection Band.  _Physical Review Letters_ 93, 161105 (2004).  URL https://link.aps.org/doi/10.1103/PhysRevLett.93.161105.  Publisher: American Physical Society.
  * [8] Grote, H. _et al._ First Long-Term Application of Squeezed States of Light in a Gravitational-Wave Observatory.  _Physical Review Letters_ 110, 181101 (2013).  URL https://link.aps.org/doi/10.1103/PhysRevLett.110.181101.  Publisher: American Physical Society.
  * [9] Zhong, H.-S. _et al._ Phase-Programmable Gaussian Boson Sampling Using Stimulated Squeezed Light.  _Physical Review Letters_ 127, 180502 (2021).  URL https://link.aps.org/doi/10.1103/PhysRevLett.127.180502.  Publisher: American Physical Society.
  * [10] Chekhova, M. V., Leuchs, G. & Zukowski, M.  Bright squeezed vacuum: Entanglement of macroscopic light beams.  _Optics Communications_ 337, 27–43 (2015).  URL https://www.sciencedirect.com/science/article/pii/S0030401814006695.
  * [11] Rasputnyi, A. V. & Kopylov, D. A.  Quantum spatial dynamics of high-gain parametric down-conversion accompanied by cascaded up-conversion.  _Physical Review A_ 104, 013702 (2021).  URL https://link.aps.org/doi/10.1103/PhysRevA.104.013702.  Publisher: American Physical Society.
  * [12] Rasputnyi, A. V., Kopylov, D. A., Murzina, T. V. & Chekhova, M. V.  Cascaded frequency up-conversion of bright squeezed vacuum: spectral and correlation properties.  _Optics Letters_ 47, 766–769 (2022).  URL https://opg.optica.org/ol/abstract.cfm?uri=ol-47-4-766.  Publisher: Optica Publishing Group.
  * [13] Spasibko, K. Y. _et al._ Multiphoton Effects Enhanced due to Ultrafast Photon-Number Fluctuations.  _Physical Review Letters_ 119, 223603 (2017).  URL https://link.aps.org/doi/10.1103/PhysRevLett.119.223603.  Publisher: American Physical Society.
  * [14] Heimerl, J. _et al._ Multiphoton electron emission with non-classical light.  _Nature Physics_ 1–6 (2024).  URL https://www.nature.com/articles/s41567-024-02472-6.  Publisher: Nature Publishing Group.
  * [15] Tzur, M. E. _et al._ Generation of squeezed high-order harmonics (2023).  URL http://arxiv.org/abs/2311.11257.  ArXiv:2311.11257 [physics, physics:quant-ph].
  * [16] Gorlach, A. _et al._ High-harmonic generation driven by quantum light.  _Nature Physics_ 19, 1689–1696 (2023).  URL https://www.nature.com/articles/s41567-023-02127-y.  Number: 11 Publisher: Nature Publishing Group.
  * [17] Rasputnyi, A. _et al._ High harmonic generation by bright squeezed vacuum (2024).  2403.15337.
  * [18] Assouline, A. _et al._ Emission and coherent control of Levitons in graphene.  _Science_ 382, 1260–1264 (2023).  URL https://www.science.org/doi/full/10.1126/science.adf9887.  Publisher: American Association for the Advancement of Science.
  * [19] Huang, G., Engelsen, N. J., Kfir, O., Ropers, C. & Kippenberg, T. J.  Electron-Photon Quantum State Heralding Using Photonic Integrated Circuits.  _PRX Quantum_ 4, 020351 (2023).  URL https://link.aps.org/doi/10.1103/PRXQuantum.4.020351.  Publisher: American Physical Society.
  * [20] Cederbaum, L. S. & Fedyk, J.  Activating cavity by electrons.  _Communications Physics_ 6, 1–9 (2023).  URL https://www.nature.com/articles/s42005-023-01227-8.  Number: 1 Publisher: Nature Publishing Group.
  * [21] Karnieli, A. _et al._ Universal and ultrafast quantum computation based on free-electron-polariton blockade (2023).  URL http://arxiv.org/abs/2303.13275.  ArXiv:2303.13275 [quant-ph].
  * [22] Barwick, B., Flannigan, D. J. & Zewail, A. H.  Photon-induced near-field electron microscopy.  _Nature_ 462, 902–906 (2009).  URL https://www.nature.com/articles/nature08662.  Number: 7275 Publisher: Nature Publishing Group.
  * [23] Feist, A. _et al._ Quantum coherent optical phase modulation in an ultrafast transmission electron microscope.  _Nature_ 521, 200–203 (2015).  URL https://www.nature.com/articles/nature14463.  Number: 7551 Publisher: Nature Publishing Group.
  * [24] England, R. J. _et al._ Dielectric laser accelerators.  _Reviews of Modern Physics_ 86, 1337–1389 (2014).  URL https://link.aps.org/doi/10.1103/RevModPhys.86.1337.  Publisher: American Physical Society.
  * [25] Adiv, Y. _et al._ Quantum Nature of Dielectric Laser Accelerators.  _Physical Review X_ 11, 041042 (2021).  URL https://link.aps.org/doi/10.1103/PhysRevX.11.041042.  Publisher: American Physical Society.
  * [26] Shiloh, R. _et al._ Miniature light-driven nanophotonic electron acceleration and control.  _Advances in Optics and Photonics_ 14, 862–932 (2022).  URL https://opg.optica.org/aop/abstract.cfm?uri=aop-14-4-862.  Publisher: Optica Publishing Group.
  * [27] Meier, S., Heimerl, J. & Hommelhoff, P.  Few-electron correlations after ultrafast photoemission from nanometric needle tips.  _Nature Physics_ 19, 1402–1409 (2023).  URL https://www.nature.com/articles/s41567-023-02059-7.  Number: 10 Publisher: Nature Publishing Group.
  * [28] Haindl, R. _et al._ Coulomb-correlated electron number states in a transmission electron microscope beam.  _Nature Physics_ 19, 1410–1417 (2023).  URL https://www.nature.com/articles/s41567-023-02067-7.  Number: 10 Publisher: Nature Publishing Group.
  * [29] Kfir, O.  Entanglements of Electrons and Cavity Photons in the Strong-Coupling Regime.  _Physical Review Letters_ 123, 103602 (2019).  URL https://link.aps.org/doi/10.1103/PhysRevLett.123.103602.  Publisher: American Physical Society.
  * [30] Kfir, O. _et al._ Controlling free electrons with optical whispering-gallery modes.  _Nature_ 582, 46–49 (2020).  URL https://www.nature.com/articles/s41586-020-2320-y.  Number: 7810 Publisher: Nature Publishing Group.
  * [31] Dahan, R. _et al._ Imprinting the quantum statistics of photons on free electrons.  _Science_ 373, eabj7128 (2021).  URL https://www.science.org/doi/full/10.1126/science.abj7128.  Publisher: American Association for the Advancement of Science.
  * [32] Feist, A. _et al._ Cavity-mediated electron-photon pairs.  _Science_ 377, 777–780 (2022).  URL https://www.science.org/doi/full/10.1126/science.abo5037.  Publisher: American Association for the Advancement of Science.
  * [33] Fishman, T. _et al._ Imaging the field inside nanophotonic accelerators.  _Nature Communications_ 14, 3687 (2023).  URL https://www.nature.com/articles/s41467-023-38857-z.  Number: 1 Publisher: Nature Publishing Group.
  * [34] Gaida, J. H. _et al._ Lorentz microscopy of optical fields.  _Nature Communications_ 14, 6545 (2023).  URL https://www.nature.com/articles/s41467-023-42054-3.  Number: 1 Publisher: Nature Publishing Group.
  * [35] Kruit, P. _et al._ Designs for a quantum electron microscope.  _Ultramicroscopy_ 164, 31–45 (2016).  URL https://www.sciencedirect.com/science/article/pii/S0304399116300146.
  * [36] Bucher, T. _et al._ Coherently amplified ultrafast imaging in a free-electron interferometer (2023).  URL http://arxiv.org/abs/2305.04877.  ArXiv:2305.04877 [physics, physics:quant-ph].
  * [37] Chlouba, T. _et al._ Coherent nanophotonic electron accelerator.  _Nature_ 622, 476–480 (2023).  URL https://www.nature.com/articles/s41586-023-06602-7.  Number: 7983 Publisher: Nature Publishing Group.
  * [38] Shiloh, R., Chlouba, T. & Hommelhoff, P.  Quantum-Coherent Light-Electron Interaction in a Scanning Electron Microscope.  _Physical Review Letters_ 128, 235301 (2022).  URL https://link.aps.org/doi/10.1103/PhysRevLett.128.235301.  Publisher: American Physical Society.
  * [39] Sirotin, M., Chlouba, T., Shiloh, R. & Hommelhoff, P.  Tunable Single-Photon Generation in a Scanning Electron Microscope based on Silicon Photonics (2023).  URL https://ieeexplore.ieee.org/abstract/document/10232356.  ISSN: 2833-1052.
  * [40] Talebi, N.  Electron-light interactions beyond the adiabatic approximation: recoil engineering and spectral interferometry.  _Advances in Physics: X_ 3, 1499438 (2018).  URL https://doi.org/10.1080/23746149.2018.1499438.  Publisher: Taylor & Francis _eprint: https://doi.org/10.1080/23746149.2018.1499438.
  * [41] Huang, S. _et al._ Quantum recoil in free-electron interactions with atomic lattices.  _Nature Photonics_ 17, 224–230 (2023).  URL https://www.nature.com/articles/s41566-022-01132-6.  Number: 3 Publisher: Nature Publishing Group.
  * [42] Shi, X., Wong, L. W. W., Huang, S., Wong, L. & Kaminer, I.  Elastic Recoil Imprinted on Free-electron Radiation (2023).  URL http://arxiv.org/abs/2312.04383.  ArXiv:2312.04383 [physics, physics:quant-ph].
  * [43] Karnieli, A. & Fan, S.  Jaynes-Cummings interaction between low-energy free electrons and cavity photons.  _Science Advances_ 9, eadh2425 (2023).  URL https://www.science.org/doi/full/10.1126/sciadv.adh2425.  Publisher: American Association for the Advancement of Science.
  * [44] Eldar, M., Chen, Z., Pan, Y. & Krüger, M.  Self-Trapping of Slow Electrons in the Energy Domain.  _Physical Review Letters_ 132, 035001 (2024).  URL https://link.aps.org/doi/10.1103/PhysRevLett.132.035001.  Publisher: American Physical Society.
  * [45] Karnieli, A., Roques-Carmes, C., Rivera, N. & Fan, S.  Strong coupling and single-photon nonlinearity in free-electron quantum optics (2024).  URL http://arxiv.org/abs/2403.13071.  ArXiv:2403.13071 [quant-ph].
  * [46] Cerenkov, P. A.  Visible emission of clean liquids by action of $\gamma$ radiation.  _Dok Akad Nauk SSSR_ 2, 451–454 (1934).
  * [47] Tamm, I. & Frank, I.  Coherent radiation of fast electrons in a medium.  _Dokl. Akad. Nauk SSSR_ 14, 107–112 (1937).
  * [48] Ginzburg, V.  Quantum theory of radiation of electron uniformly moving in medium.  _Zh. Eksp. Teor. Fiz_ 10, 589 (1940).
  * [49] Tamm, I. E.  General Characteristics of Vavilov-Cherenkov Radiation: The theory of radiation from systems moving with superlight velocities has uses in plasma physics.  _Science_ 131, 206–210 (1960).  URL https://www.science.org/doi/10.1126/science.131.3395.206.
  * [50] Ginzburg, V. L.  Radiation by uniformly moving sources (vavilov–cherenkov effect, transition radiation, and other phenomena).  _Physics-Uspekhi_ 39, 973 (1996).
  * [51] Adiv, Y. _et al._ Observation of 2D Cherenkov Radiation.  _Physical Review X_ 13, 011002 (2023).  URL https://link.aps.org/doi/10.1103/PhysRevX.13.011002.  Publisher: American Physical Society.
  * [52] Doucas, G., Mulvey, J. H., Omori, M., Walsh, J. & Kimmitt, M. F.  First observation of Smith-Purcell radiation from relativistic electrons.  _Physical Review Letters_ 69, 1761–1764 (1992).  URL https://link.aps.org/doi/10.1103/PhysRevLett.69.1761.  Publisher: American Physical Society.
  * [53] Remez, R. _et al._ Spectral and spatial shaping of Smith-Purcell radiation.  _Physical Review A_ 96, 061801 (2017).  URL https://link.aps.org/doi/10.1103/PhysRevA.96.061801.  Publisher: American Physical Society.
  * [54] Park, S. T., Lin, M. & Zewail, A. H.  Photon-induced near-field electron microscopy (PINEM): theoretical and experimental.  _New Journal of Physics_ 12, 123028 (2010).  URL https://dx.doi.org/10.1088/1367-2630/12/12/123028.
  * [55] Senellart, P., Solomon, G. & White, A.  High-performance semiconductor quantum-dot single-photon sources.  _Nature Nanotechnology_ 12, 1026–1039 (2017).  URL https://www.nature.com/articles/nnano.2017.218.  Number: 11 Publisher: Nature Publishing Group.
  * [56] Dahan, R. _et al._ Imprinting the quantum statistics of photons on free electrons.  _Science_ 373, eabj7128 (2021).  URL https://www.science.org/doi/full/10.1126/science.abj7128.  Publisher: American Association for the Advancement of Science.
  * [57] Giulio, V. D., Kociak, M. & Abajo, F. J. G. d.  Probing quantum optical excitations with fast electrons.  _Optica_ 6, 1524–1534 (2019).  URL https://opg.optica.org/optica/abstract.cfm?uri=optica-6-12-1524.  Publisher: Optica Publishing Group.
  * [58] Scully, M. O. & Zubairy, M. S.  _Quantum Optics_ (Cambridge University Press, Cambridge, 1997).  URL https://www.cambridge.org/core/books/quantum-optics/08DC53888452CBC6CDC0FD8A1A1A4DD7.
  * [59] Klyshko, D. N.  _Photons and Nonlinear Optics_ (Routledge, New York, 2017).
  * [60] Virally, S., Cusson, P. & Seletskiy, D. V.  Enhanced Electro-optic Sampling with Quantum Probes.  _Physical Review Letters_ 127, 270504 (2021).  URL https://link.aps.org/doi/10.1103/PhysRevLett.127.270504.
  * [61] Kozák, M., Eckstein, T., Schönenberger, N. & Hommelhoff, P.  Inelastic ponderomotive scattering of electrons at a high-intensity optical travelling wave in vacuum.  _Nature Physics_ 14, 121–125 (2018).  URL https://www.nature.com/articles/nphys4282.  Number: 2 Publisher: Nature Publishing Group.
  * [62] Schönenberger, N. _et al._ Generation and Characterization of Attosecond Microbunched Electron Pulse Trains via Dielectric Laser Acceleration.  _Physical Review Letters_ 123, 264803 (2019).  URL https://link.aps.org/doi/10.1103/PhysRevLett.123.264803.  Publisher: American Physical Society.
  * [63] Black, D. S. _et al._ Net Acceleration and Direct Measurement of Attosecond Electron Pulses in a Silicon Dielectric Laser Accelerator.  _Physical Review Letters_ 123, 264802 (2019).  URL https://link.aps.org/doi/10.1103/PhysRevLett.123.264802.  Publisher: American Physical Society.
  * [64] Giulio, V. D. & Abajo, F. J. G. d.  Optical-cavity mode squeezing by free electrons.  _Nanophotonics_ 11, 4659–4670 (2022).  URL https://www.degruyter.com/document/doi/10.1515/nanoph-2022-0481/html.  Publisher: De Gruyter.
  * [65] Henke, J.-W. _et al._ Integrated photonics enables continuous-beam electron phase modulation.  _Nature_ 600, 653–658 (2021).  URL https://www.nature.com/articles/s41586-021-04197-5.  Number: 7890 Publisher: Nature Publishing Group.
  * [66] Cohen-Tannoudji, C., Dupont-Roc, J. & Grynberg, G.  _Photons and Atoms - Introduction to Quantum Electrodynamics_ (John Wiley & Sons, Ltd, 1997).  URL https://onlinelibrary.wiley.com/doi/abs/10.1002/9783527618422.ch5.  Publication Title: Photons and Atoms - Introduction to Quantum Electrodynamics ADS Bibcode: 1997phat.book…..C.
  * [67] Sharapova, P. R. _et al._ Properties of bright squeezed vacuum at increasing brightness.  _Physical Review Research_ 2, 013371 (2020).  URL https://link.aps.org/doi/10.1103/PhysRevResearch.2.013371.  Publisher: American Physical Society.
  * [68] Magnus, W.  On the exponential solution of differential equations for a linear operator.  _Communications on Pure and Applied Mathematics_ 7, 649–673 (1954).  URL https://onlinelibrary.wiley.com/doi/abs/10.1002/cpa.3160070404.  _eprint: https://onlinelibrary.wiley.com/doi/pdf/10.1002/cpa.3160070404.
  * [69] Levine, H. _et al._ High-Fidelity Control and Entanglement of Rydberg-Atom Qubits.  _Physical Review Letters_ 121, 123603 (2018).  URL https://link.aps.org/doi/10.1103/PhysRevLett.121.123603.
  * [70] Lvovsky, A. I.  _Squeezed Light_ , 121–163 (John Wiley & Sons, Ltd, 2015).  URL https://onlinelibrary.wiley.com/doi/abs/10.1002/9781119009719.ch5.  Section: 5 _eprint: https://onlinelibrary.wiley.com/doi/pdf/10.1002/9781119009719.ch5.
  * [71] Pan, Y., Zhang, B. & Podolsky, D.  Low-energy Free-electron Rabi oscillation and its applications (2023).  URL http://arxiv.org/abs/2304.12174.  ArXiv:2304.12174 [physics, physics:quant-ph].

## Methods

### Hamiltonian derivation

We consider an electron propagating with the momentum $\textbf{p}=\\{0,0,p\\}$
along the z-axis. The quantized Dirac field of the electron reads [66]:

$\hat{\Psi}(z)=\tilde{v}^{-1/2}\sum_{p,\sigma}u_{p,\sigma}(z)\hat{c}_{p,\sigma},$
(3)

where $\hat{c}_{p,\sigma}$ is the annihilation operator of the electron with
the momentum $p$ and spin $\sigma=+\ \text{or}\ -$, and $\tilde{v}$ is a
normalization constant. The function $u_{p,\sigma}(r)$ is given by the
following expression in the plane-wave basis:

$u_{p,\sigma}(z)=\begin{bmatrix}C_{p}I&-S_{p}\sigma_{z}\\\
S_{p}\sigma_{z}&C_{p}I\end{bmatrix}\begin{bmatrix}A_{\sigma}\\\
0\end{bmatrix}e^{ipz/\hbar},$ (4)

where $C_{p}=\cos(\theta_{p}/2)$, $S_{p}=\sin(\theta_{p}/2)$,
$\theta_{p}=\arctan(\dfrac{p}{mc})$,

$A_{+}=\begin{bmatrix}1\\\ 0\end{bmatrix},\ \ \ \ \ A_{-}=\begin{bmatrix}0\\\
1\end{bmatrix}.$ (5)

From this we obtain

$u_{p,+}(z)=\begin{bmatrix}C_{p}\\\ 0\\\ S_{p}\\\
0\end{bmatrix}e^{ipz/\hbar},\ \ \ \ \ u_{p,-}(z)=\begin{bmatrix}0\\\ C_{p}\\\
0\\\ -S_{p}\end{bmatrix}e^{ipz/\hbar}.$ (6)

Let us calculate the current:

$\hat{j}_{n}(r)=qc\widetilde{\hat{\Psi}}(r)^{\dagger}\alpha_{n}\hat{\Psi}(r)=qc/\tilde{v}\sum_{p_{1},p_{2},\sigma_{1},\sigma_{2}}\hat{c}_{p_{1},\sigma_{1}}^{\dagger}\hat{c}_{p_{2},\sigma_{2}}\widetilde{u}^{*}_{p_{1},\sigma_{1}}\alpha_{n}u_{p_{2},\sigma_{2}}.$
(7)

$\widetilde{\Psi}$ is the transpose of $\Psi$ and $\alpha_{n}$ is the $n^{th}$
Dirac matrix.

First, we calculate the $\alpha_{n}u_{p_{2},\sigma_{2}}$ terms
($X_{+}\equiv\alpha_{x}u_{p_{2},+}$ and so on):

$X_{+}=\begin{bmatrix}0&0&0&1\\\ 0&0&1&0\\\ 0&1&0&0\\\ 1&0&0&0\\\
\end{bmatrix}\begin{bmatrix}C_{p_{2}}\\\ 0\\\ S_{p_{2}}\\\
0\end{bmatrix}e^{ip_{2}z/\hbar}=\begin{bmatrix}0\\\ S_{p_{2}}\\\ 0\\\
C_{p_{2}}\end{bmatrix}e^{ip_{2}z/\hbar},$ (8) $X_{-}=\begin{bmatrix}0&0&0&1\\\
0&0&1&0\\\ 0&1&0&0\\\ 1&0&0&0\\\ \end{bmatrix}\begin{bmatrix}0\\\ C_{p_{2}}\\\
0\\\ -S_{p_{2}}\end{bmatrix}e^{ip_{2}z/\hbar}=\begin{bmatrix}-S_{p_{2}}\\\
0\\\ C_{p_{2}}\\\ 0\end{bmatrix}e^{ip_{2}z/\hbar},$ (9)

$Y_{+}=\begin{bmatrix}0&0&0&-i\\\ 0&0&i&0\\\ 0&-i&0&0\\\ i&0&0&0\\\
\end{bmatrix}\begin{bmatrix}C_{p_{2}}\\\ 0\\\ S_{p_{2}}\\\
0\end{bmatrix}e^{ip_{2}z/\hbar}=\begin{bmatrix}0\\\ iS_{p_{2}}\\\ 0\\\
iC_{p_{2}}\end{bmatrix}e^{ip_{2}z/\hbar},$ (10)
$Y_{-}=\begin{bmatrix}0&0&0&-i\\\ 0&0&i&0\\\ 0&-i&0&0\\\ i&0&0&0\\\
\end{bmatrix}\begin{bmatrix}0\\\ C_{p_{2}}\\\ 0\\\
-S_{p_{2}}\end{bmatrix}e^{ip_{2}z/\hbar}=\begin{bmatrix}iS_{p_{2}}\\\ 0\\\
-iC_{p_{2}}\\\ 0\end{bmatrix}e^{ip_{2}z/\hbar},$ (11)

$Z_{+}=\begin{bmatrix}0&0&1&0\\\ 0&0&0&-1\\\ 1&0&0&0\\\ 0&-1&0&0\\\
\end{bmatrix}\begin{bmatrix}C_{p_{2}}\\\ 0\\\ S_{p_{2}}\\\
0\end{bmatrix}e^{ip_{2}z/\hbar}=\begin{bmatrix}S_{p_{2}}\\\ 0\\\ C_{p_{2}}\\\
0\end{bmatrix}e^{ip_{2}z/\hbar},$ (12) $Z_{-}=\begin{bmatrix}0&0&1&0\\\
0&0&0&-1\\\ 1&0&0&0\\\ 0&-1&0&0\\\ \end{bmatrix}\begin{bmatrix}0\\\
C_{p_{2}}\\\ 0\\\ -S_{p_{2}}\end{bmatrix}e^{ip_{2}z/\hbar}=\begin{bmatrix}0\\\
S_{p_{2}}\\\ 0\\\ -C_{p_{2}}\end{bmatrix}e^{ip_{2}z/\hbar}.$ (13)

Using these expressions, one can obtain the components of the current density:

$\begin{gathered}\hat{j}_{x}=qc/\tilde{v}\sum_{p_{1},p_{2}}(C_{p_{1}}S_{p_{2}}-S_{p_{1}}C_{p_{2}})(\hat{c}^{\dagger}_{p_{1},-}\hat{c}_{p_{2},+}-\hat{c}^{\dagger}_{p_{1},+}\hat{c}_{p_{2},-})e^{i(p_{2}-p_{1})z/\hbar}=\\\
=qc/\tilde{v}\sum_{p_{1},p_{2}}S_{p_{2}-p_{1}}(\hat{c}^{\dagger}_{p_{1},-}\hat{c}_{p_{2},+}-\hat{c}^{\dagger}_{p_{1},+}\hat{c}_{p_{2},-})e^{i(p_{2}-p_{1})z/\hbar},\\\
\hat{j}_{y}=iqc/\tilde{v}\sum_{p_{1},p_{2}}(C_{p_{1}}S_{p_{2}}-S_{p_{1}}C_{p_{2}})(\hat{c}^{\dagger}_{p_{1},-}\hat{c}_{p_{2},+}+\hat{c}^{\dagger}_{p_{1},+}\hat{c}_{p_{2},-})e^{i(p_{2}-p_{1})z/\hbar}=\\\
=iqc/\tilde{v}\sum_{p_{1},p_{2}}S_{p_{2}-p_{1}}(\hat{c}^{\dagger}_{p_{1},-}\hat{c}_{p_{2},+}+\hat{c}^{\dagger}_{p_{1},+}\hat{c}_{p_{2},-})e^{i(p_{2}-p_{1})z/\hbar},\\\
\hat{j}_{z}=qc/\tilde{v}\sum_{p_{1},p_{2}}(C_{p_{1}}S_{p_{2}}+S_{p_{1}}C_{p_{2}})(\hat{c}^{\dagger}_{p_{1},+}\hat{c}_{p_{2},+}+\hat{c}^{\dagger}_{p_{1},-}\hat{c}_{p_{2},-})e^{i(p_{2}-p_{1})z/\hbar}=\\\
=qc/\tilde{v}\sum_{p_{1},p_{2}}S_{p_{2}+p_{1}}(\hat{c}^{\dagger}_{p_{1},+}\hat{c}_{p_{2},+}+\hat{c}^{\dagger}_{p_{1},-}\hat{c}_{p_{2},-})e^{i(p_{2}-p_{1})z/\hbar}.\end{gathered}$

We consider the interaction of the electron with the $z$-component of the
cavity mode (quasi-TM00, for example). So, the $z$-component of this mode
quantized vector potential is:

$\hat{A}_{z}(\mathbf{r})=\hat{A}^{\perp}_{z}(x,y)\hat{A}^{\|}_{z}(z)=\hat{A}^{\perp}_{z}(x,y)\left(\sum_{k}\mathcal{A}(k)\hat{a}_{k}e^{ikz}+\mathcal{A}^{*}(k)\hat{a}^{\dagger}_{k}e^{-ikz}\right).$
(14)

The interaction Hamiltonian reads:

$\begin{gathered}V=-\int\mathrm{d}^{3}\mathbf{r}\
\hat{\mathbf{j}}(\mathbf{r})\hat{\mathbf{A}}(\mathbf{r})=-\eta\int\mathrm{d}z\hat{j}^{\|}_{z}(z)\hat{A}^{\|}_{z}(z)=\\\
=-\tilde{\eta}\sum_{p_{1},p_{2},k}\int\mathrm{d}z~{}S_{p_{1}+p_{2}}(\hat{c}^{\dagger}_{p_{1},+}\hat{c}_{p_{2},+}+\hat{c}^{\dagger}_{p_{1},-}\hat{c}_{p_{2},-})e^{i(p_{2}-p_{1})z/\hbar}\big{[}\mathcal{A}(k)\hat{a}_{k}e^{ikz}+\mathcal{A}^{*}(k)\hat{a}^{\dagger}_{k}e^{-ikz}\big{]},\end{gathered}$
(15)

where $\eta=\int\mathrm{d}x\mathrm{d}y\ \hat{A}^{\perp}_{z}(x,y)\
\hat{j}^{\perp}_{z}(x,y)$ is the transverse overlap. We can assume
$\hat{j}_{z}(\mathbf{r})=\hat{j}^{\|}_{z}(z)\hat{j}^{\perp}_{z}(x,y)=\hat{j}^{\|}_{z}(z)\delta(x)\delta(y)$,
so $\eta=\hat{A}^{\perp}_{z}(0,0)$ and
$\tilde{\eta}=\hat{A}^{\perp}_{z}(0,0)qc\tilde{v}^{-1/3}$. Here the remaining
normalization constant along the propagation direction is
$\tilde{v}^{-1/3}=1/L$, where $L$ is the cavity length.

Let’s assume that the electron spin $\sigma=+$, therefore

$\begin{gathered}V=-\tilde{\eta}\sum_{p_{1},p_{2},k}\int\mathrm{d}z~{}S_{p_{1}+p_{2}}\bigg{[}\mathcal{A}(k)\hat{c}^{\dagger}_{p_{1}}\hat{c}_{p_{2}}\hat{a}_{k}e^{i(p_{2}-p_{1})z/\hbar+ikz}+\mathcal{A}^{*}(k)\hat{c}^{\dagger}_{p_{1}}\hat{c}_{p_{2}}\hat{a}^{\dagger}_{k}e^{i(p_{2}-p_{1})z/\hbar-
ikz}\bigg{]}=\\\
=\sum_{p_{1},p_{2},k}V_{p_{1}p_{2}k}\hat{c}^{\dagger}_{p_{1}}\hat{c}_{p_{2}}\hat{a}_{k}+\sum_{p_{1},p_{2},k}W_{p_{1}p_{2}k}\hat{c}^{\dagger}_{p_{1}}\hat{c}_{p_{2}}\hat{a}_{k}^{\dagger}.\end{gathered}$
(16)

The Hamiltonian of the free fields (electrons and photons) is:

$\hat{H}_{0}=\sum_{p}E_{p}\hat{c}_{p}^{\dagger}\hat{c}_{p}+\sum_{k^{\prime}}\hbar\omega_{k^{\prime}}\hat{a}_{k^{\prime}}^{\dagger}\hat{a}_{k^{\prime}},$
(17)

where $E_{p}=\sqrt{p^{2}c^{2}+m^{2}c^{4}}$. The Hamiltonian in the interaction
picture:

$H_{I}=e^{iH_{0}t/\hbar}Ve^{-iH_{0}t/\hbar}=V+it/\hbar[H_{0},V]+\frac{(it/\hbar)^{2}}{2!}[H_{0},[H_{0},V]]+\
...$ (18)

Let’s calculate the commutators:

$[\hat{c}_{p}^{\dagger}\hat{c}_{p},\hat{c}^{\dagger}_{p_{1}}]=\hat{c}_{p}^{\dagger}\hat{c}_{p}\hat{c}^{\dagger}_{p_{1}}-\hat{c}^{\dagger}_{p_{1}}\hat{c}_{p}^{\dagger}\hat{c}_{p}=\hat{c}_{p}^{\dagger}\hat{c}_{p}\hat{c}^{\dagger}_{p_{1}}+\hat{c}_{p}^{\dagger}\hat{c}^{\dagger}_{p_{1}}\hat{c}_{p}=\hat{c}_{p}^{\dagger}\\{\hat{c}_{p},\hat{c}^{\dagger}_{p_{1}}\\}=\delta_{p,p_{1}}\hat{c}_{p}^{\dagger},$
$[\hat{c}_{p}^{\dagger}\hat{c}_{p},\hat{c}_{p_{1}}]=\hat{c}_{p}^{\dagger}\hat{c}_{p}\hat{c}_{p_{1}}-\hat{c}_{p_{1}}\hat{c}_{p}^{\dagger}\hat{c}_{p}=-\hat{c}_{p}^{\dagger}\hat{c}_{p_{1}}\hat{c}_{p}-\hat{c}_{p_{1}}\hat{c}_{p}^{\dagger}\hat{c}_{p}=-\\{\hat{c}_{p_{1}},\hat{c}^{\dagger}_{p}\\}\hat{c}_{p}=-\delta_{p,p_{1}}\hat{c}_{p},$
$[\hat{c}_{p}^{\dagger}\hat{c}_{p},\hat{c}^{\dagger}_{p_{1}}\hat{c}_{p_{2}}\hat{a}_{k}]=[\hat{c}_{p}^{\dagger}\hat{c}_{p},\hat{c}^{\dagger}_{p_{1}}]\hat{c}_{p_{2}}\hat{a}_{k}+\hat{c}^{\dagger}_{p_{1}}[\hat{c}_{p}^{\dagger}\hat{c}_{p},\hat{c}_{p_{2}}]\hat{a}_{k}=\delta_{p,p_{1}}\hat{c}^{\dagger}_{p}\hat{c}_{p_{2}}\hat{a}_{k}-\delta_{p,p_{2}}\hat{c}^{\dagger}_{p_{1}}\hat{c}_{p}\hat{a}_{k}=(\delta_{p,p_{1}}-\delta_{p,p_{2}})\hat{c}^{\dagger}_{p_{1}}\hat{c}_{p_{2}}\hat{a}_{k},$
$[\hat{a}_{k^{\prime}}^{\dagger}\hat{a}_{k^{\prime}},\hat{c}^{\dagger}_{p_{1}}\hat{c}_{p_{2}}\hat{a}_{k}]=\hat{c}^{\dagger}_{p_{1}}\hat{c}_{p_{2}}[\hat{a}_{k^{\prime}}^{\dagger}\hat{a}_{k^{\prime}},\hat{a}_{k}]=-\delta_{k,k^{\prime}}\hat{c}^{\dagger}_{p_{1}}\hat{c}_{p_{2}}\hat{a}_{k^{\prime}},$
$[\hat{a}_{k^{\prime}}^{\dagger}\hat{a}_{k^{\prime}},\hat{c}^{\dagger}_{p_{1}}\hat{c}_{p_{2}}\hat{a}_{k}^{\dagger}]=\hat{c}^{\dagger}_{p_{1}}\hat{c}_{p_{2}}[\hat{a}_{k^{\prime}}^{\dagger}\hat{a}_{k^{\prime}},\hat{a}_{k}^{\dagger}]=\delta_{k,k^{\prime}}\hat{c}^{\dagger}_{p_{1}}\hat{c}_{p_{2}}\hat{a}_{k^{\prime}}^{\dagger}.$

As a result, the first commutator in (18) is:

$it[H_{0},V]=it\bigg{[}\sum_{p}E_{p}\hat{c}_{p}^{\dagger}\hat{c}_{p},\sum_{p_{1},p_{2},k}V_{p_{1}p_{2}k}\hat{c}^{\dagger}_{p_{1}}\hat{c}_{p_{2}}\hat{a}_{k}+\sum_{p_{1},p_{2},k}W_{p_{1}p_{2}k}\hat{c}^{\dagger}_{p_{1}}\hat{c}_{p_{2}}\hat{a}_{k}^{\dagger}\bigg{]}+\\\
+it\bigg{[}\sum_{k^{\prime}}\hbar\omega_{k^{\prime}}\hat{a}_{k^{\prime}}^{\dagger}\hat{a}_{k^{\prime}},\sum_{p_{1},p_{2},k}V_{p_{1}p_{2}k}\hat{c}^{\dagger}_{p_{1}}\hat{c}_{p_{2}}\hat{a}_{k}+\sum_{p_{1},p_{2},k}W_{p_{1}p_{2}k}\hat{c}^{\dagger}_{p_{1}}\hat{c}_{p_{2}}\hat{a}_{k}^{\dagger}\bigg{]}=\\\
=\sum_{p_{1},p_{2},k}V_{p_{1}p_{2}k}it(E_{p_{1}}-E_{p_{2}})\hat{c}^{\dagger}_{p_{1}}\hat{c}_{p_{2}}\hat{a}_{k}+\sum_{p_{1},p_{2},k}W_{p_{1}p_{2}k}it(E_{p_{1}}-E_{p_{2}})\hat{c}^{\dagger}_{p_{1}}\hat{c}_{p_{2}}\hat{a}_{k}^{\dagger}+\\\
+\sum_{p_{1},p_{2},k}V_{p_{1}p_{2}k}(-it)\hbar\omega_{k}\hat{c}^{\dagger}_{p_{1}}\hat{c}_{p_{2}}\hat{a}_{k}+\sum_{p_{1},p_{2},k}W_{p_{1}p_{2}k}(it)\hbar\omega_{k}\hat{c}^{\dagger}_{p_{1}}\hat{c}_{p_{2}}\hat{a}_{k}=\\\
=it\sum_{p_{1},p_{2},k}V_{p_{1}p_{2}k}(E_{p_{1}}-E_{p_{2}}-\hbar\omega_{k})\hat{c}^{\dagger}_{p_{1}}\hat{c}_{p_{2}}\hat{a}_{k}+it\sum_{p_{1},p_{2},k}W_{p_{1}p_{2}k}(E_{p_{1}}-E_{p_{2}}+\hbar\omega_{k})\hat{c}^{\dagger}_{p_{1}}\hat{c}_{p_{2}}\hat{a}_{k}^{\dagger}.$
(19)

Thus, each commutator in (18) gives an exponential series term. After the
summation of the series we get:

$\displaystyle
H_{I}=\int\mathrm{d}z\sum_{p_{1},p_{2},k}g_{p_{1},p_{2},k}e^{i(\frac{p_{2}-p_{1}}{\hbar}+k)z}e^{-i(\frac{E_{p_{2}}-E_{p_{1}}}{\hbar}+\omega_{k})t}\hat{c}^{\dagger}_{p_{1}}\hat{c}_{p_{2}}\hat{a}_{k}$
(20)
$\displaystyle+\int\mathrm{d}z\sum_{p_{1},p_{2},k}g^{*}_{p_{1},p_{2},k}e^{i(\frac{p_{2}-p_{1}}{\hbar}-k)z}e^{-i(\frac{E_{p_{2}}-E_{p_{1}}}{\hbar}-\omega_{k})t}\hat{c}^{\dagger}_{p_{1}}\hat{c}_{p_{2}}\hat{a}_{k}^{\dagger},$

where $g_{p_{1},p_{2},k}=-\tilde{\eta}S_{p_{1}+p_{2}}\mathcal{A}_{k}$. For
non-relativistic electrons
$S_{p_{1}+p_{2}}\approx\frac{p_{1}+p_{2}}{2mc}\approx(v_{p_{1}}+v_{p_{2}})/(2c)$,
and $g_{p_{1},p_{2},k}$ can further be simplified to
$g_{p_{1},k}\approx-\tilde{\eta}v_{p_{1}}\mathcal{A}_{k}/c$, if we assume that
the electron velocity changes insignificantly ($v_{p_{1}}+v_{p_{2}}\approx
2v_{p_{1}}$).

Let’s change the notation for further convenience: $\Omega(k)$ and $k$
represent the electron energy divided by $\hbar$ and its momentum, while
$\omega(\varkappa)$ and $\varkappa$ stand for the photon energy divided by
$\hbar$ and its momentum. Also, we rearrange the constants, so that the
interaction Hamiltonian is:

$\hat{H}_{int}=i\hbar\sum_{k_{1},k_{2},\varkappa}\int\mathrm{d}z\tilde{g}_{k_{1},k_{2},\varkappa}e^{i(k_{1}-k_{2}-\varkappa)z}e^{-i(\Omega_{k_{1}}-\Omega_{k_{2}}-\omega_{\varkappa})t}\hat{c}_{k_{2}}^{\dagger}(t)\hat{c}_{k_{1}}(t)\hat{a}^{\dagger}_{\varkappa}(t)+h.c.$
(21)

And the corresponding Schrödinger equation for the electron-photon
wavefunction $|\psi(t)\rangle$ is

$i\hbar\frac{\mathrm{d}}{\mathrm{d}t}|\psi(t)\rangle=\hat{H}_{int}(t)|\psi(t)\rangle.$
(22)

### Hamiltonian Fourier transform

Since the interaction of free electrons with the cavity is a long macroscopic
process, we can make use of the approaches developed in quantum nonlinear
optics for the description of parametric down-conversion (PDC) [59, 67]. We
can write the continualized version of the Hamiltonian (for brevity
$\Omega_{k_{1}}=\Omega_{1},\ \Omega_{k_{2}}=\Omega_{2}$ and
$\omega_{\varkappa}=\omega$):

$\hat{H}_{int}=i\hbar\int\mathrm{d}z\mathrm{d}k_{1}\mathrm{d}k_{2}\mathrm{d}\varkappa\Gamma
e^{i(k_{1}-k_{2}-\varkappa)z}e^{-i(\Omega_{1}-\Omega_{2}-\omega)t}\hat{c}^{\dagger}(k_{2},t)\hat{c}(k_{1},t)\hat{a}^{\dagger}(\varkappa,t)+h.c.$
(23)

The corresponding Heisenberg equations
$\frac{\mathrm{d}}{\mathrm{d}t}\hat{A}={\frac{i}{\hbar}}[\hat{H},\hat{A}]$ for
the photon and electron operators are:

$\displaystyle\frac{\mathrm{d}\hat{a}(\varkappa,t)}{\mathrm{d}t}=$
$\displaystyle\int\mathrm{d}z\mathrm{d}k_{1}\mathrm{d}k_{2}\Gamma
e^{i(k_{1}-k_{2}-\varkappa)z}e^{-i(\Omega_{1}-\Omega_{2}-\omega)t}\hat{c}^{\dagger}(k_{2},t)\hat{c}(k_{1},t),$
(24) $\displaystyle\frac{\mathrm{d}\hat{c}(p,t)}{\mathrm{d}t}=$
$\displaystyle\int\mathrm{d}z\mathrm{d}k_{1}\mathrm{d}\varkappa\Gamma
e^{i(k_{1}-p-\varkappa)z}e^{-i(\Omega_{1}-\Omega_{p}-\omega)t}\hat{a}^{\dagger}(\varkappa,t)\hat{c}(k_{1},t)-$
$\displaystyle-$
$\displaystyle\int\mathrm{d}z\mathrm{d}k_{2}\mathrm{d}\varkappa\Gamma^{*}e^{-i(p-k_{2}-\varkappa)z}e^{i(\Omega_{p}-\Omega_{2}-\omega)t}\hat{a}(\varkappa,t)\hat{c}(k_{2},t).$

The next step is to take the Fourier transform (FT) of operators to go from
the $(k,t)$ to the $(\Omega,L)$ representation:

$\displaystyle\hat{c}^{\dagger}(k,t)\xrightarrow{FT}\hat{c}^{\dagger}(\Omega,L).$
(25)

First, we introduce the fast varying components of the operators:

$\begin{gathered}\bar{\hat{c}}^{\dagger}(k_{2},t)=e^{i\Omega_{2}t}\hat{c}^{\dagger}(k_{2},t),\\\
\bar{\hat{c}}(k_{1},t)=e^{-i\Omega_{1}t}\hat{c}(k_{1},t),\\\
\bar{\hat{a}}^{\dagger}(\varkappa,t)=e^{i\omega
t}\hat{a}^{\dagger}(\varkappa,t),\\\ \bar{\hat{a}}(\varkappa,t)=e^{-i\omega
t}\hat{a}(\varkappa,t).\end{gathered}$ (26)

The Fourier transform of these operators:

$\begin{gathered}\bar{\hat{c}}(k,t)=\frac{1}{2\pi}\int\bar{\hat{c}}(\tilde{\Omega},\xi)e^{-i\tilde{\Omega}t}e^{-ik\xi}\mathrm{d}\tilde{\Omega}\mathrm{d}\xi=\frac{1}{2\pi}\int{\hat{c}}(\tilde{\Omega},\xi)e^{ik(\tilde{\Omega})\xi}e^{-i\tilde{\Omega}t}e^{-ik\xi}\mathrm{d}\tilde{\Omega}\mathrm{d}\xi,\\\
\bar{\hat{c}}^{\dagger}(k,t)=\frac{1}{2\pi}\int\hat{c}^{\dagger}(\tilde{\Omega},\xi)e^{-ik(\tilde{\Omega})\xi}e^{i\tilde{\Omega}t}e^{ik\xi}\mathrm{d}\tilde{\Omega}\mathrm{d}\xi,\\\
\bar{\hat{a}}^{\dagger}(\varkappa,t)=\frac{1}{2\pi}\int\hat{a}^{\dagger}(\tilde{\omega},\xi)e^{-i\varkappa(\tilde{\omega})\xi}e^{i\tilde{\omega}t}e^{i\varkappa\xi}\mathrm{d}\tilde{\omega}\mathrm{d}\xi,\\\
\bar{\hat{a}}(\varkappa,t)=\frac{1}{2\pi}\int\hat{a}(\tilde{\omega},\xi)e^{i\varkappa(\tilde{\omega})\xi}e^{-i\tilde{\omega}t}e^{-i\varkappa\xi}\mathrm{d}\tilde{\omega}\mathrm{d}\xi.\end{gathered}$
(27)

Integrating the Heisenberg equation (24) over time $t$ from $\tau_{0}=-\infty$
to $\tau=\infty$ and substituting (27), we get for the photon operator:

$\begin{gathered}\hat{a}(\varkappa,\tau)-\hat{a}(\varkappa,\tau_{0})=\int\mathrm{d}t\mathrm{d}z\mathrm{d}k_{1}\mathrm{d}k_{2}\Gamma
e^{i(k_{1}-k_{2}-\varkappa)z}e^{i\omega t}\times\\\
\times\frac{1}{2\pi}\int\hat{c}^{\dagger}(\tilde{\Omega}_{2},\xi_{2})e^{-ik(\tilde{\Omega}_{2})\xi_{2}}e^{i\tilde{\Omega}_{2}t}e^{ik_{2}\xi_{2}}\mathrm{d}\tilde{\Omega}_{2}\mathrm{d}\xi_{2}\times\frac{1}{2\pi}\int{\hat{c}}(\tilde{\Omega}_{1},\xi_{1})e^{ik(\tilde{\Omega}_{1})\xi_{1}}e^{-i\tilde{\Omega}_{1}t}e^{-ik_{1}\xi_{1}}\mathrm{d}\tilde{\Omega}_{1}\mathrm{d}\xi_{1}.\end{gathered}$
(28)

We note that $k(\tilde{\Omega}_{2})$ is a function of $\tilde{\Omega}_{2}$,
while $k_{2}$ is the integration variable. For the electron operator we get:

$\begin{gathered}\hat{c}(p,\tau)-\hat{c}(p,\tau_{0})=\int\mathrm{d}t\mathrm{d}z\mathrm{d}k_{1}\mathrm{d}\varkappa\Gamma
e^{i(k_{1}-p-\varkappa)z}e^{i\Omega_{p}t}\times\\\
\times\frac{1}{2\pi}\int\hat{a}^{\dagger}(\tilde{\omega},\xi)e^{-i\varkappa(\tilde{\omega})\xi}e^{i\tilde{\omega}t}e^{i\varkappa\xi}\mathrm{d}\tilde{\omega}\mathrm{d}\xi\times\frac{1}{2\pi}\int{\hat{c}}(\tilde{\Omega}_{1},\xi_{1})e^{ik(\tilde{\Omega}_{1})\xi_{1}}e^{-i\tilde{\Omega}_{1}t}e^{-ik_{1}\xi_{1}}\mathrm{d}\tilde{\Omega}_{1}\mathrm{d}\xi_{1}-\\\
-\int\mathrm{d}t\mathrm{d}z\mathrm{d}k_{2}\mathrm{d}\varkappa\Gamma^{*}e^{-i(p-k_{2}-\varkappa)z}e^{i\Omega_{p}t}\times\\\
\times\frac{1}{2\pi}\int\hat{a}(\tilde{\omega},\xi)e^{i\varkappa(\tilde{\omega})\xi}e^{-i\tilde{\omega}t}e^{-i\varkappa\xi}\mathrm{d}\tilde{\omega}\mathrm{d}\xi\times\frac{1}{2\pi}\int\hat{c}(\tilde{\Omega}_{2},\xi_{2})e^{ik(\tilde{\Omega}_{2})\xi_{2}}e^{-i\tilde{\Omega}_{2}t}e^{-ik_{2}\xi_{2}}\mathrm{d}\tilde{\Omega}_{2}\mathrm{d}\xi_{2}.\end{gathered}$
(29)

Similar to above, here $\varkappa(\tilde{\omega})$ is a function of
$\tilde{\omega}$, while $\varkappa$ is the integration variable.

Integration in (28) and (29) leads to the $\delta$-functions of the form

$\frac{1}{2\pi}\int_{-\infty}^{\infty}\mathrm{d}t~{}e^{-i(\tilde{\Omega}_{1}-\tilde{\Omega}_{2}-{\omega})t}=\delta(\tilde{\Omega}_{1}-\tilde{\Omega}_{2}-{\omega}),$
(30)

which determine the electron energy/frequency ladder of levels for this
problem and the perfect entanglement between electron energy value and photon
number state. Also we get other $\delta$-functions of the form

$\frac{1}{2\pi}\int_{-\infty}^{\infty}\mathrm{d}k_{1}~{}e^{ik_{1}(z-\xi_{1})}=\delta(z-\xi_{1}),$
(31)

so that from 8 integrals in each equation (28, 29) only 2 survive.

As a result, from (28) and (29) we get

$\displaystyle\hat{a}(\varkappa,\tau)-\hat{a}(\varkappa,\tau_{0})$
$\displaystyle=2\pi\int_{0}^{L}\mathrm{d}z\int\mathrm{d}\tilde{\Omega}_{1}\Gamma
e^{i(k(\tilde{\Omega}_{1})-k(\tilde{\Omega}_{1}-\omega)-\varkappa)z}\hat{c}^{\dagger}(\tilde{\Omega}_{1}-\omega,z){\hat{c}}(\tilde{\Omega}_{1},z),$
(32) $\displaystyle\hat{c}(p,\tau)-\hat{c}(p,\tau_{0})$
$\displaystyle=2\pi\int_{0}^{L}\mathrm{d}z\int\mathrm{d}\tilde{\omega}\Gamma
e^{i(k(\Omega_{p}+\tilde{\omega})-p-\varkappa(\tilde{\omega}))z}\hat{a}^{\dagger}(\tilde{\omega},z){\hat{c}}(\Omega_{p}+\tilde{\omega},z)-$
$\displaystyle-2\pi\int\mathrm{d}z\mathrm{d}\tilde{\omega}\Gamma^{*}e^{-i(p-k(\Omega_{p}-\tilde{\omega})-\varkappa(\tilde{\omega}))z}\hat{a}(\tilde{\omega},z){\hat{c}}(\Omega_{p}-\tilde{\omega},z),$

where $L$ is the length of interaction.

The connection between the boundary conditions in $(k,t)$ and $(\Omega,L)$
representations can be written as [59, 67]:

$\displaystyle\hat{a}(\varkappa,\tau)=u\hat{a}(\omega,L),$ $\displaystyle\ \
\hat{a}(\varkappa,\tau_{0})=u\hat{a}(\omega,0),$ (33)
$\displaystyle\hat{c}(p,\tau)=v\hat{c}(\Omega,L),$ $\displaystyle\ \
\hat{c}(p,\tau_{0})=v\hat{c}(\Omega,0),$

where $u$ and $v$ are the photon and electron group velocities, respectively.
From the boundary conditions we also get
$[\hat{a}({\omega}_{1},L),\hat{a}^{\dagger}({\omega}_{2},L)]=\frac{1}{u^{2}}[\hat{a}(\varkappa_{1},\tau),\hat{a}^{\dagger}(\varkappa_{2},\tau)]=\frac{1}{u^{2}}\delta(\varkappa_{1}-\varkappa_{2})=\frac{1}{u}\delta(\omega_{1}-\omega_{2})$.

Differentiation of the both sides of Eq. 32 with respect to $L$ and variable
reassignment lead, finally, to the Heisenberg equations in the $(\Omega,L)$
representation:

$\displaystyle\frac{\mathrm{d}\hat{a}(\omega,L)}{\mathrm{d}L}=$
$\displaystyle\frac{2\pi}{u}\int\mathrm{d}\tilde{\Omega}\Gamma
e^{i(k(\tilde{\Omega})-k(\tilde{\Omega}-\omega)-\varkappa(\omega))L}\hat{c}^{\dagger}(\tilde{\Omega}-\omega,L){\hat{c}}(\tilde{\Omega},L),$
(34) $\displaystyle\frac{\mathrm{d}\hat{c}(\Omega,L)}{\mathrm{d}L}=$
$\displaystyle\frac{2\pi}{v}\int\mathrm{d}\tilde{\omega}\Gamma
e^{i(k({\Omega}+\tilde{\omega})-k(\Omega)-\varkappa(\tilde{\omega}))L}\hat{a}^{\dagger}(\tilde{\omega},L){\hat{c}}({\Omega}+\tilde{\omega},L)-$
$\displaystyle-$
$\displaystyle\frac{2\pi}{v}\int\mathrm{d}\tilde{\omega}\Gamma^{*}e^{-i(k(\Omega)-k({\Omega}-\tilde{\omega})-\varkappa(\tilde{\omega}))L}\hat{a}(\tilde{\omega},L){\hat{c}}({\Omega}-\tilde{\omega},L),$

where we changed $\Omega(p)\rightarrow\Omega,\ p\rightarrow k(\Omega)$.
Heisenberg equations in this form are useful for the description of the free-
electron interaction with many photons (via
$\langle\hat{a}^{\dagger}\hat{a}\rangle$,
$\langle\hat{c}^{\dagger}\hat{c}\rangle$ and higher moments) — for instance,
for the squeezing estimation, non-classical PINEM and harmonics generation
with PINEM. We will use these equations here to get the Hamiltonian and
Schrödinger equation in the $(\Omega,L)$ representation.

Using Heisenberg equations
$v\frac{\mathrm{d}}{\mathrm{d}L}\hat{c}={\frac{i}{\hbar}}[\hat{H},\hat{c}]$,
we restore the Hamiltonian

$\displaystyle\hat{H}_{int}(L)$ $\displaystyle=2\pi i\hbar
v\int\mathrm{d}{\omega}\mathrm{d}\Omega\Gamma
e^{i(k(\Omega)-k(\Omega-\omega)-\varkappa({\omega}))L}\hat{c}^{\dagger}({\Omega}-{\omega},L)\hat{c}({\Omega},L)\hat{a}^{\dagger}({\omega},L)-$
(35) $\displaystyle-2\pi i\hbar
v\int\mathrm{d}{\omega}\mathrm{d}\Omega\Gamma^{*}e^{-i(k(\Omega+\omega)-k({\Omega})-\varkappa({\omega}))L}\hat{c}^{\dagger}({\Omega}+\omega,L)\hat{c}({\Omega},L)\hat{a}({\omega},L).$

Here and further we assume that the interaction propagates with the group
velocity of the electron $v$. Returning to the discrete form like in the
initial Hamiltonian (21) and rearranging constants:

$\displaystyle\hat{H}_{int}(L)$ $\displaystyle=i\hbar
v\sum_{\omega,\Omega}\gamma_{\omega}e^{i(k(\Omega)-k(\Omega-\omega)-\varkappa({\omega}))L}\hat{c}^{\dagger}_{{\Omega}-{\omega}}(L)\hat{c}_{\Omega}(L)\hat{a}^{\dagger}_{\omega}(L)-$
(36) $\displaystyle-i\hbar
v\sum_{\omega,\Omega}\gamma_{\omega}^{*}e^{-i(k(\Omega+\omega)-k({\Omega})-\varkappa({\omega}))L}\hat{c}^{\dagger}_{{\Omega}+\omega}(L)\hat{c}_{\Omega}(L)\hat{a}_{\omega}(L).$

Now we can write the length-dependent Schrödinger equation $i\hbar
v\frac{\mathrm{d}}{\mathrm{d}L}|\psi(L)\rangle=\hat{H}_{int}(L)|\psi(L)\rangle$
to get the spatial evolution of the wavefunction

$\begin{gathered}\ket{\psi(L)}=\sum_{\Omega,n_{\omega_{1}},n_{\omega_{2}},...,n_{\omega_{N}}}C_{\Omega,n_{\omega_{1}},n_{\omega_{2}},...,n_{\omega_{N}}}(L)\ket{\Omega,n_{\omega_{1}},n_{\omega_{2}},...,n_{\omega_{N}}},\end{gathered}$
(37)

where $\ket{\Omega,n_{\omega_{1}},n_{\omega_{2}},...,n_{\omega_{N}}}$ is the
state of electron with energy $\Omega$ and the cavity with $n_{\omega_{j}}$
photons in the mode $\omega_{j}$.

Considering the interaction of the electron with the multimode state of the
cavity, we get the differential equation for the electron-photon wavefunction
coefficients (Schrödinger equation in the matrix form):

$\displaystyle\frac{\mathrm{d}}{\mathrm{d}L}C_{\Omega,n_{\omega_{1}},n_{\omega_{2}},...,n_{\omega_{N}}}(L)=\sum_{j}$
$\displaystyle\tilde{g}_{Qu}^{\omega_{j}}e^{-i(k(\Omega)-k(\Omega-\omega_{j})-\varkappa(\omega_{j}))L}\sqrt{n_{\omega_{j}}+1}C_{\Omega-\omega_{j},n_{\omega_{1}},n_{\omega_{2}},...,n_{\omega_{j}}+1,...,n_{\omega_{N}}}(L)$
(38)
$\displaystyle-(\tilde{g}_{Qu}^{\omega_{j}})^{*}e^{i(k(\Omega+\omega_{j})-k(\Omega)-\varkappa(\omega_{j}))L}\sqrt{n_{\omega_{j}}}C_{\Omega+\omega_{j},n_{\omega_{1}},n_{\omega_{2}},...,n_{\omega_{j}}-1,...,n_{\omega_{N}}}(L),$

here $\tilde{g}_{Qu}\equiv-\gamma^{*}=g_{Qu}/L_{full}$ is a normalized version
of the dimensionless coupling parameter $g_{Qu}$ often used in literature
[29], and $L_{full}$ is the full length of interaction. Comparing the
constants with Eq. 21, we see that
$g_{Qu}=q\hat{A}^{\perp}_{z}(0,0)\mathcal{A}_{k}\tilde{v}^{-1/3}L^{2}/(i\hbar)$.
Since $\tilde{v}^{-1/3}=1/L$ and $\mathcal{A}_{k}\propto 1/\sqrt{L}$ due to
normalization, we get $|g_{Qu}^{max}|=qAL/(2\hbar)\propto\sqrt{L}$, which is
consistent with the expression in other works [29]:
$|g_{Qu}^{max}|=qEL/(2\hbar\omega)\propto\sqrt{L}$ (here $A$ and $E$ are the
vector potential and electric field amplitude, respectively).

Equation (38) forms the basis of the model. The advantages of this model are
the simultaneous energy conservation and the description of the phase-matching
and recoil effects at long interaction lengths, as well as the possibility to
construct the exact analytical solution. The model also creates another bridge
between free-electron quantum optics and conventional quantum nonlinear
optics.

### Schrödinger equation

We now consider the initial state of the cavity as a single-mode Fock state
$\ket{n}$ and the electron initial state $\ket{\Omega_{0}}\equiv\ket{m=0}$.
From Eq. 38 we can get

$\displaystyle\frac{\mathrm{d}}{\mathrm{d}L}C_{m}=$
$\displaystyle\tilde{g}_{Qu}e^{-i(k(\Omega_{m})-k(\Omega_{m-1})-\varkappa)L}\sqrt{l+1}C_{m-1}$
(39)
$\displaystyle-\tilde{g}_{Qu}^{*}e^{i(k(\Omega_{m+1})-k(\Omega_{m})-\varkappa)L}\sqrt{l}C_{m+1},$
$\displaystyle l=0,1,2$ $\displaystyle,..;\ m=0,\pm 1,\pm 2,..;\ l+m=n.$

Due to the Fock initial state of the cavity and the perfect entanglement,
$\bar{C}$ is now a column and not a matrix.

If the initial state of the cavity is a single-mode vacuum state $\ket{0}$, we
get

$\displaystyle\frac{\mathrm{d}}{\mathrm{d}L}C_{-n}=$
$\displaystyle\tilde{g}_{Qu}e^{-i(k(\Omega_{-n})-k(\Omega_{-n-1})-\varkappa)L}\sqrt{n+1}C_{-n-1}$
(40)
$\displaystyle-\tilde{g}_{Qu}^{*}e^{i(k(\Omega_{-n+1})-k(\Omega_{-n})-\varkappa)L}\sqrt{n}C_{-n+1}.\
\ (n=0,1,2..)$

Or in the matrix form:

$\displaystyle\frac{\mathrm{d}}{\mathrm{d}L}\bar{C}(L)=\bar{\bar{A}}(L)\cdot\bar{C}(L),\
\ \
\bar{C}(L)=\begin{bmatrix}C_{0}(L),C_{-1}(L),C_{-2}(L),\cdots\end{bmatrix}^{\mathrm{T}}$
(41) $\displaystyle\bar{\bar{A}}(L)=\begin{bmatrix}0&\tilde{g}_{Qu}e^{-i\Delta
k_{-1}L}&0&\cdots\\\ -\tilde{g}_{Qu}^{*}e^{i\Delta
k_{-1}L}&0&\tilde{g}_{Qu}e^{-i\Delta k_{-2}L}\sqrt{2}&\cdots\\\
0&-\tilde{g}_{Qu}^{*}e^{i\Delta k_{-2}L}\sqrt{2}&0&\cdots\\\
\vdots&\vdots&\vdots&\ddots\\\ \end{bmatrix}.$

Here $\Delta k_{n}=k(\Omega_{-n+1})-k(\Omega_{-n})-\varkappa$, $C_{-n}$ is the
probability amplitude of the entangled electron-photon state
$\ket{\Omega_{0}-n\cdot\omega}\otimes\ket{n}\equiv\ket{\Omega_{-n},n}$
(electron has energy $\hbar(\Omega_{0}-n\cdot\omega)$, cavity is in the Fock
state with $n$ photons). Thus, $|C_{-n}|^{2}$ describes both the electron
spectrum and cavity photon statistics during the interaction. The evolution
matrix $\bar{\bar{A}}$ is an anti-Hermitian matrix (so that matrix exponential
$e^{\bar{\bar{A}}}$ is unitary) with only -1 and +1 diagonals filled.

Eq. 39 is a system of non-autonomous ordinary differential equations (ODE). We
will solve it both numerically and analytically (via the autonomization
procedure). But first we start with the approximate approach and make use of
the Magnus expansion [68]. In the first order of Magnus expansion the solution
of Eq. 41 is:

$\bar{C}(L)\approx\exp\left(\int_{0}^{L}\bar{\bar{A}}(s)\,\mathrm{d}s\right)\cdot\bar{C}(0).$
(42)

Integration of the matrix $\bar{\bar{A}}$ leads to the terms of the form

$\tilde{g}_{Qu}\int_{0}^{L}e^{-i(k(\Omega_{-n+1})-k(\Omega_{-n})-\varkappa)s}\mathrm{d}s=g_{Qu}\operatorname{sinc}(\Delta
k_{n}L/2)e^{-\Delta k_{n}L/2},$ (43)

where $\Delta k_{n}=k(\Omega_{-n+1})-k(\Omega_{-n})-\varkappa$. Common phase
term doesn’t influence the statistics, so now levels have the effective
coupling modulated by the mismatch $g_{\mathrm{eff}\
(n)}^{\mathrm{sinc}}=g_{Qu}\operatorname{sinc}(\Delta k_{n}L/2)$. This
approach (noted as sinc-model) can be useful in the low-coupling regime,
though giving a slightly tighter recoil cut-off than the exact solution (Fig.
3c). In the strong-coupling regime the effective phase-matching width is
expected to depend on the coupling strength [67] — this behaviour is observed
for the exact solution, but not for the sinc-model.

### Recoil parameter

Sinc-model can provide an important quantitative parameter for assessing the
strength of the recoil effect in a given interaction. First, we find the first
zero of the sinc function: $\Delta k_{\sigma}L/2=\pi$. For the interaction
with optical photons we can write $\Delta
k_{\sigma}\approx\frac{\omega}{c}\frac{1}{\beta_{\sigma}}-\varkappa=\frac{\omega}{c}(\frac{1}{\beta_{\sigma}}-\frac{1}{\beta_{1}})$,
where $\beta_{\sigma}=v^{electron}_{gr\ (\sigma)}/c$ is the normalized
electron group velocity after the emission of the $\sigma^{th}$ photon, and we
suppose that the emission of the first photon is perfectly phase-matched.
Assuming that the total change in the electron energy after the emission of
$\sigma$ photons $\delta=\sigma\cdot\hbar\omega$ is much smaller than the
initial total electron energy $E=E_{kin}+E_{0}$ (here $E_{kin}$ is the kinetic
energy, $E_{0}$ is the rest energy of the electron), we can write
$\frac{1}{\beta(E-\Delta)}-\frac{1}{\beta(E)}\approx\frac{E_{0}^{2}\Delta}{(E^{2}-E_{0}^{2})^{3/2}}$.
Finally, from $\Delta k_{\sigma}L/2\approx\frac{\omega
L}{2c}\frac{E_{0}^{2}\Delta}{(E^{2}-E_{0}^{2})^{3/2}}=\pi$ we get

$\sigma\approx\frac{1240}{511^{2}}\frac{\left((E^{2}-E_{0}^{2})[\mathrm{keV}^{2}]\right)^{3/2}}{\left(E_{ph}[\mathrm{eV}]\right)^{2}\cdot
L[\mu\mathrm{m}]},$ (44)

which is correct for the wide range of electron energies in SEMs and TEMs
(Extended Data Fig. 5a).

Considering electrons with $E_{kin}<150\ \mathrm{keV}$ we can get the easier
formula:

$\sigma\approx
155\frac{\left(E_{kin}[\mathrm{keV}]\right)^{3/2}}{\left(E_{ph}[\mathrm{eV}]\right)^{2}\cdot
L[\mu\mathrm{m}]}.$ (45)

Parameter $\sigma$ describes the phase-matching width in the sinc-model: the
maximum photon number the electron can emit before the recoil is high enough
to completely suppress the phase-matching. Though in the exact solution this
border is not sharp and depends on the coupling strength $g_{Qu}$, parameter
$\sigma$ gives a good estimation of the recoil effect in a given electron-
photon interaction, showing approximately how many photons electron should
emit to start experiencing recoil-induced mismatch. From the N-level-system
point of view we can approximate the effective number of levels in the system
(number of side-bands + zero-loss peak) as

$N_{\mathrm{eff}}=\begin{cases}\sigma+1&\text{if $\sigma\geq 1$}\\\ 2&\text{if
$\sigma<1$},\end{cases}$

so the transition from the infinite ladder to the two-level system (TLS) can
be observed (Fig. 3a) for different variations of only 3 parameters of the
interaction ($E_{kin},E_{ph}$ and $L$).

### Autonomization

Eq. 39 can be solved analytically via the autonomization procedure. We
substitute $C_{m}(L)\equiv f_{m}(L)e^{-i\varphi_{m}L}$, so from Eq. 39

$\displaystyle f_{m}^{\prime}-i\varphi_{m}f_{m}=$
$\displaystyle\tilde{g}_{Qu}e^{-i(\Delta
k_{m-1}+\varphi_{m-1}-\varphi_{m})L}\sqrt{l+1}f_{m-1}$ (46)
$\displaystyle-\tilde{g}_{Qu}^{*}e^{i(\Delta
k_{m}-\varphi_{m+1}+\varphi_{m})L}\sqrt{l}f_{m+1},$ $\displaystyle l=\
0,1,2..;$ $\displaystyle m=0,\pm 1,\pm 2,..;\ l+m=n,$

where $\Delta k_{m}=k(\Omega_{m+1})-k(\Omega_{m})-\varkappa$. To get rid of
the $L$-dependence on the right-hand side we demand
$\varphi_{m}-\varphi_{m-1}=\Delta k_{m-1}$ and
$\varphi_{m+1}-\varphi_{m}=\Delta k_{m}$. From this we get

$\varphi_{m}=\begin{cases}\varphi_{0}-\sum_{i=-1}^{m}\Delta k_{i}&\text{if
$m<0$}\\\ \varphi_{0}+\sum_{i=0}^{m-1}\Delta k_{i}&\text{if
$m>0$}.\end{cases}$

Since $\varphi_{0}$ is a global phase, we can take $\varphi_{0}=0$. As a
result, Eq. 46 becomes autonomous

$\displaystyle
f_{m}^{\prime}=i\varphi_{m}f_{m}+\tilde{g}_{Qu}\sqrt{l+1}f_{m-1}-\tilde{g}_{Qu}^{*}\sqrt{l}f_{m+1}\
\ \longleftrightarrow\
\frac{\mathrm{d}}{\mathrm{d}L}\bar{f}(L)=\bar{\bar{S}}\cdot\bar{f}(L),$

and we can write the exact analytical solution

$\displaystyle\bar{f}(L)=e^{\bar{\bar{S}}\cdot L}\cdot\bar{f}(0)\ \
\Rightarrow\ \ \bar{C}(L)=\bar{f}(L)e^{-i\bar{\varphi}L}.$ (47)

The evolution matrix $\bar{\bar{S}}$ is a tridiagonal anti-Hermitian matrix
(so the matrix exponential $e^{\bar{\bar{S}}\cdot L}$ is unitary). Note that
for the calculation of the electron-photon state probability distribution
$|C_{m}|^{2}=|f_{m}|^{2}$, so the phase factor $e^{-i\varphi_{m}L}$ is not
important, thought for the fidelity calculations this factor matters. We can
compare the solution after the autonomization with the numerical solution of
the initial Eq. 41 to make sure that they are in the perfect agreement (Fig.
3c).

If the initial state of the cavity is a vacuum state $\ket{0}$, we can write

$\begin{gathered}f_{-n}^{\prime}=i\varphi_{-n}f_{-n}+\tilde{g}_{Qu}\sqrt{n+1}f_{-n-1}-\tilde{g}_{Qu}^{*}\sqrt{n}f_{-n+1},\
\ \ (n=0,1,2..)\\\ \bar{\bar{S}}\cdot
L=\begin{bmatrix}i\varphi_{0}L=0&g_{Qu}&0&\cdots\\\
-g_{Qu}^{*}&i\varphi_{-1}L&g_{Qu}\sqrt{2}&\cdots\\\
0&-g_{Qu}^{*}\sqrt{2}&i\varphi_{-2}L&\cdots\\\ \vdots&\vdots&\vdots&\ddots\\\
\end{bmatrix}.\end{gathered}$ (48)

In general, the generated electron-photon states are entangled, but there are
several options where pure photon (and electron) states can be obtained. The
first option is to use an initial electron with a broad spectrum, such that
the electron spectrum side-bands (connected with emission/absorption of
photons) overlap (Fig. 1). Then the electron states before and after the
emission are indistinguishable [19], and we can write
$\ket{\psi}\approx\ket{\Omega}\otimes(c_{0}\ket{0}+c_{1}\ket{1}+...)$, so the
photon state is pure. The second option is the generation of the deterministic
product state $\ket{\psi}=\ket{-1,1}=\ket{-1}\otimes\ket{1}$, in which the
states of the photon and electron are by definition pure.

### Two-photon Hamiltonian

Due to the analogy to the Raman process in the three-level system, we can
introduce effective two-photon Hamiltonian $\hat{H}_{\mathrm{eff}}\sim
g_{Qu}^{\mathrm{eff}}\cdot\hat{a}^{\dagger}\hat{a}^{\dagger}\hat{c}^{\dagger}\hat{c}+h.c.$
with the coupling strength $g_{Qu}^{\mathrm{eff}}$ for the two-photon process
via the adiabatic elimination of the mismatched odd states (taking
$\frac{\mathrm{d}}{\mathrm{d}L}C_{-(2m+1)}=0$, $m\in\mathbb{Z}$). Coupling
coefficient between the states $\ket{-m,m}$ and $\ket{-(m+2),m+2}$ after the
adiabatic elimination is then
$\gamma_{m}=\frac{\tilde{g}_{Qu}^{2}}{i\varphi_{-(m+1)}}\cdot\sqrt{m+1}\sqrt{m+2}$,
so we can define the effective two-photon coupling strength as

$\displaystyle
g_{Qu}^{\mathrm{eff}}\text{(2-photon)}\equiv\frac{g_{Qu}^{2}}{-\varphi_{-1}L},$
(49)

where $\varphi_{-1}L=-\Delta
k_{m}L=-(k(\Omega_{0})-k(\Omega_{-1})-\varkappa)L$ is the one-photon
transition mismatch, and $g_{Qu}$ is the one-photon transition coupling. This
approach is in agreement with the Raman process notation, where the effective
Rabi frequency is
$\Omega_{\mathrm{eff}}=\frac{\Omega_{1}\Omega_{2}}{2\Delta}$, and $\Delta$ is
the detuning from the intermediate level [58, 69]. The values of
$g_{Qu}^{\mathrm{eff}}\text{(2-photon)}$ are also shown in Fig. 4a. Extended
Data Fig. 8 demonstrates the influence of the one-photon mismatch on the
fidelity between the generated state and perfect BSV, and on the coupling
$g_{Qu}^{\mathrm{eff}}$. One-photon mismatch poses the trade-off between state
fidelity and $g_{Qu}$ required to achieve the same $g_{Qu}^{\mathrm{eff}}$
(and the same mean photon number).

The electron-photon single-mode squeezed vacuum state and twin-beam state can
be be written in the following form [58, 70]

$\begin{gathered}\ket{{\text{SV}}^{\text{e-ph}}}\equiv\sum_{\Omega,m}C_{\Omega,m}\ket{\Omega,m}=\frac{1}{\sqrt{\cosh
r}}\sum_{n=0}^{\infty}\left(-e^{i\varphi}\tanh
r\right)^{n}\frac{\sqrt{(2n)!}}{2^{n}n!}\ \ket{-2n,2n},\\\
\ket{{\text{Twin}}^{\text{e-ph}}}\equiv\sum_{\Omega,m_{1},m_{2}}C_{\Omega,m_{1},m_{2}}\ket{\Omega,m_{1},m_{2}}=\frac{1}{\cosh
r}\sum_{n=0}^{\infty}\left(-e^{i\varphi}\tanh
r\right)^{n}\ket{-2n,n,n},\end{gathered}$ (50)

where $r$ and $\varphi$ depend on $g_{Qu}^{\mathrm{eff}}$. These states can be
generated with fidelities $\mathscr{F}>99\%$ (see Extended Data Fig. 8).

### PINEM with recoiled electrons

The developed approach can be also applied for the PINEM with the classical
electromagnetic field to describe the electron spectrum after the interaction.
We approximate that the classical field stays undepleted, so the electron and
photon states are disentangled (this is similar to the parametric
approximation in PDC [59]). In this case
$\hat{a}^{\dagger}_{\varkappa}(t)\rightarrow A_{\varkappa}(t)$ in Eq.21, and
Eq.48 modifies to

$\displaystyle
f_{m}^{\prime}=i\varphi_{m}f_{m}+(\tilde{g}_{Qu}A)f_{m-1}-(\tilde{g}_{Qu}A)^{*}f_{m+1},\
\ (m=0,\pm 1,\pm 2,..)$ (51)

with the ”classical” coupling $\tilde{g}=(\tilde{g}_{Qu}A)=g/L$ proportional
to the field strength (in agreement with Eq.48 for $n\gg 1$ and with
literature [29, 23]). Here $C_{m}(L)\equiv f_{m}(L)e^{-i\varphi_{m}L}$
describes the probability amplitudes of the electron side-bands. When $\sigma$
is big enough, we observe the expected quantum walk with Bessel distribution
of side-bands (Extended Data Fig. 11). The recoil restricts the width of the
electron spectrum and causes revivals of population (Extended Data Fig. 5b).
It’s also possible to achieve the effective two-level system (TLS) and Rabi
oscillations when $\sigma<1$ (Extended Data Fig. 11) [71, 44].

The same considerations also describe two-photon PINEM (Fig. 11b). Note the
quadratic spectral width growth as a function of coupling (compared to the
linear dependence for one-photon PINEM), and characteristic two-photon Rabi
oscillations with the zero-level revivals at
$g_{Qu}^{\mathrm{eff}}A^{2}\approx m\pi$, $m\in\mathbb{Z}$. Thus, for example,
one can use visible light as a pump in the transparency window of the cavity
material, but at the same time create PINEM sidebands with the energy
separation corresponding to the UV light. Note that using single-frequency
pump requires QPM for the two-photon interaction with fast electrons (to
mismatch the one-photon transition), though biharmonic pump can be used both
with the direct phase-matching and QPM.

As a result of recoiled PINEM, the electron becomes an effective two- or
three-level system, driven by a strong classical field. These situations do
not require strong vacuum coupling $g_{Qu}$, because it can be compensated by
the intensity of the pump field ($g=g_{Qu}A$). Note that with increasing $g$,
the two- and three-level systems are blurred (Fig. 11(a-b), right panels),
since mismatched processes become more probable.

## Extended Data

Figure 5: a) Exact calculation of $\operatorname{sinc}(\Delta k_{m}L)$ (map)
and estimations of the first zero of the sinc-function with formulas (44, red)
and (45, orange), $E_{ph}=2~{}eV$, $L=1000~{}\mu m$. b) PINEM spectra with the
recoiled electrons and $\sigma=10$, showing revivals. Parameter $\sigma$
predicts the spectrum boundaries at low coupling strengths. Position (in
coupling strength) of the first revival can be estimated from the fitting as
$g^{\text{T}_{1}}\approx 0.84\sigma+1.66$, and of the second revival as
$g^{\text{T}_{2}}\approx 3.28\sigma+1.95$, where
$g^{\text{T}_{i}}=(|g_{Qu}A|)^{\text{T}_{i}}$. Figure 6: a) Revivals of the
electron spectrum in the strong coupling regime at different $\sigma$. b)
Generation of k-photon states with high $g^{(2)}$ and low mean photon number
$\langle\hat{N}\rangle\ll 1$ at revivals. Figure 7:  a) Electron energy
spectra from coupling strength $g_{Qu}$ for different phase-matching widths
$\sigma$ and cavity in the initial state $\ket{1}$, showing the transition
from probabilistic to deterministic single-photon absorption. b) Probability
distribution of electron-photon wavefunction in (a) for states with the
maximum single-photon absorption probability. Figure 8: a) Fidelity between
the generated state and BSV (blue) along with one-photon $g_{Qu}$ required to
achieve two-photon $g_{Qu}^{\mathrm{eff}}=1$ from the one-photon mismatch.
Higher fidelity requires higher mismatch and, thus, higher $g_{Qu}$ for the
same mean photon number. b) $P(n)$ for low and high mismatch, showing the
transition from coherent-like state (blue) to the BSV-like state (orange).
c-d) $P(n)$ for generated BSV and twin-beam states (along with the exact
states). Note that twin beam decays uniformly exponentially, while BSV has an
accelerated decay at small $n$. The electron-photon squeezed vacuum generation
does not require the recoiled electron regime (but requires QPM) and can be
achieved in TEMs as well. Twin-beam generation can be achieved also with
direct phase-matching. Figure 9: Electron energy spectra from coupling
strength $g_{Qu}$ for different phase-matching widths $\sigma$, showing the
transition from electron-photon twin-beam state to shaped twin-beam state and
GHZ states (emission of two photons is phase-matched). The inset (right) shows
the two-photon Rabi oscillations for lower one-photon mismatch.  Figure 10:
Electron-photon states at high recoil. a-b) Schemes for the generation of
electron-photon Bell (a), GHZ and NOON (b) states, shown here with the quasi-
phase-matching (green lines labeled $|\vec{G}|$). If $\omega_{1}=\omega_{2}$
and $\varkappa_{1}=\varkappa_{2}$, then
$\ket{\text{GHZ}}\rightarrow\ket{\text{NOON}}(N=2)$. c) Electron-photon Bell,
NOON and GHZ states fidelities from the phase-matching width $\sigma$. For
high $\sigma$ these fidelities correspond to the fidelities of Bell, NOON and
GHZ states with coherent, squeezed vacuum and twin-beam states, respectively
(dashed lines). The photon frequencies were the same for all the three states.
It can be seen that twin-beam state generation does not require quasi-phase
matching, but the squeezed vacuum state does. Figure 11:  Stimulated processes
(PINEM). One-photon (a) and two-photon (b) PINEM with recoiled electrons
showing the transition from the quantum walk to restricted PINEM with revivals
and to Rabi oscillations in the two-level system (a) and to two-photon Rabi
oscillations in the three-level system (b). The asymmetry of the spectra is
due to the fact that the emission (not absorption) of one (a) and two (b)
photons, respectively, is in ideal phase-matching. The effective coupling
$g\propto g_{Qu}A$, where $A$ is the field vector potential. Figure 12: The
analogy between the Raman process in a 3-level system and the electron-photon
interaction when the emission of two photons is phase-matched. a-b) (single-
mode case) We can approximate the electron-photon system at low $\sigma$ as
the perfect 3-level system with the Rabi frequencies $\Omega_{0}$ and
$\Omega_{1}=\Omega_{0}\sqrt{2}$ (a). Difference in Rabi frequencies results in
the effective detuning $\delta=\frac{\Omega_{0}^{2}}{4\Delta}$, which lowers
the contrast of the two-photon Rabi oscillations
$P_{2}^{max}/P_{0}^{max}=\frac{8}{9}\approx 0.89$ (b), similarly to the
Autler-Townes effect. c-d) (two-mode case) In the two-mode case
$\Omega_{1}=\Omega_{0}$, and we see no effective detuning, so the two-photon
Rabi oscillations (d) are full and the deterministic generation of photon pair
is possible. e) Low-energy electrons allow the near-resonant situation, when
the one-photon mismatch is small, though the system has still effectively 3
levels. Here
$g_{Qu}^{\mathrm{eff}}\text{(2-photon)}\equiv\frac{g_{Qu}^{2}}{-\varphi_{-1}L}$
and $\tilde{g}_{Qu}^{eff}=g_{Qu}^{\mathrm{eff}}\cdot 3/2$ (due to the
effective detuning). The revivals of $P_{0}$ are at
${g}_{Qu}^{eff}\approx\pi$.