## Main

Stemming from the first demonstration of optical harmonic generation1, nonlinear optics has been in the spotlight of science and technology for more than half a century. In particular, second-harmonic generation (SHG) is a second-order nonlinear process widely used for frequency conversion, self-referencing of frequency combs2, crystal symmetry and Rashba effect studies3,4, sensing5, interface spectroscopy6 and ultrashort pulse characterization7. Aside from free-space applications, there is increasing interest towards the realization of microscale integrated nonlinear devices. Here, a major challenge comes from the centrosymmetric nature of silicon (Si) and silicon nitride (Si3N4), which forbids second-order nonlinearities. Large efforts have been devoted to the integration of nonlinear crystals such as lithium niobate8,9, or to symmetry breaking in Si and Si3N4, for instance, via strain10, electric fields11 or the photogalvanic effect12.

Two-dimensional materials such as graphene and transition metal dichalcogenides (TMDs) hold great promise for nonlinear optical applications. They have a strong and broadband optical response13,14, combined with the possibility of harmonic generation enhancement at excitonic resonances in TMDs15 and at multiphoton resonances in graphene’s Dirac cones16,17. Furthermore, thanks to their flexibility and mechanical strength18, they can be easily integrated into photonic platforms. Various functionalized devices for sensing and frequency conversion have been demonstrated on fibres19, waveguides20 and microrings21, while direct patterning of TMDs has been used to realize atomically thin meta-lenses22,23 and nonlinear holograms24,25. Furthermore, harmonic generation in two-dimensional materials can be efficiently tuned by external electrical16,26,27,28 or all-optical excitation29,30, offering an extra degree of freedom for the design of advanced nanoscale devices.

However, all of the electrical and all-optical schemes that have been proposed so far for SHG modulation in two-dimensional materials have considerable downsides. On one hand, electrical modulation has been demonstrated in tungsten diselenide (WSe2) monolayers26 by tuning the oscillator strength of neutral and charged exciton resonances through electrostatic doping, and also in molybdenum disulfide (MoS2) homobilayers27 by breaking the naturally occurring inversion symmetry through electrical gating, in the latter case with a large modulation depth of up to a factor of 60; however, electronics is intrinsically slower than optics and photonics. On the other hand, all-optical SHG modulation has been achieved by quenching of the exciton oscillator strength following ultrafast optical excitation in MoS2 (refs. 29,30). This approach offers high modulation speed and is limited in principle only by the excited state/exciton lifetime (approximately tens of picoseconds); however, the largest depth in all-optical SHG modulation reported29 so far in TMDs is 55%, with a strong dependence on the excitation wavelength and fluence. Furthermore, this scheme for all-optical SHG modulation is only effective for excitation and frequency conversion above-gap or at excitonic resonances and it is not applicable for below-gap excitation, thus leading to a naturally limited spectral bandwidth.

Here we demonstrate a novel approach for the all-optical control of the second-harmonic (SH) polarization in MoS2 and show that this can be used for all-optical modulation of the SH efficiency with modulation depth close to 100% and speed limited only by the fundamental frequency (FF) pulse duration. Our method relies solely on symmetry considerations in combination with the deep subwavelength thickness of the sample and thus does not require resonant enhancement or above-gap excitation for its implementation. Moreover, the same approach can be extended to any two-dimensional material belonging to the D3h symmetry group, thus for instance to any material of the TMD family. Our findings provide a new strategy for the tuning of the fundamental properties of light (polarization and amplitude) in the nonlinear regime and in the two-dimensional thickness limit, and thus pave the way to the design of novel advanced functionalities in high-speed frequency converters, nonlinear all-optical modulators and transistors31,32, interferometric autocorrelators for ultrashort pulse characterization and tunable atomically thin holograms24.

## Nonlinear optical characterization

For the experiments, we used high-quality monolayer MoS2 flakes fabricated by a modified chemical vapour deposition method33,34 on thermally oxidized Si/SiO2 substrates. By contrast to thin films where surface SHG is allowed due to an out-of-plane component of the second-order susceptibility6,35, TMDs belong to the D3h symmetry group and thus have only one non-vanishing in-plane component of the nonlinear optical susceptibility (Methods)35,36,37,38,39,40

$${\chi }^{(2)}\equiv {\chi }_{yyy}^{(2)}=-{\chi }_{yxx}^{(2)}=-{\chi }_{xyx}^{(2)}=-{\chi }_{xxy}^{(2)},$$
(1)

where x and y refer to the in-plane Cartesian coordinates of the SH polarization and of the two FFs. A sketch of the hexagonal lattice for MoS2 is shown in Fig. 1a, in which the Cartesian coordinates are defined with respect to the two main lattice orientations: the armchair (AC) and zigzag (ZZ) directions. In this framework, the SH intensity I2ω as a function of the FF for any TMD along the AC and ZZ directions can be written as

$${I}_{\mathrm{AC}}^{2\omega } \propto | {E}_{\mathrm{AC}}^{2}-E_{\mathrm{ZZ}}^{2}{| }^{2},$$
(2)
$${I}_{\mathrm{ZZ}}^{2\omega } \propto | 2{E}_{\mathrm{AC}}{E}_{\mathrm{ZZ}}{| }^{2},$$
(3)

where EAC and EZZ correspond to the FF fields with polarization along the AC and ZZ directions, respectively39,41,42,43. The SHG from two electric fields with the same polarization (either along AC or ZZ) will thus always result in an emitted SH intensity with polarization along the AC direction, as depicted in Fig. 1b. This is indeed the case for all of the SHG experiments on two-dimensional materials performed so far15,36,39,43. On the other hand, two ultrashort FFs with perpendicular polarization (along the AC and ZZ directions) and with the same amplitude will generate a SH signal along the AC direction if they do not overlap in time (Fig. 1c), whereas they will generate a SH signal along the ZZ direction at zero delay (Fig. 1d), thus leading to an ultrafast 90° polarization switch within the FFs pulse duration. Finally, for circularly polarized FFs, the emitted SH has opposite circular polarization due to valley-dependent selection rules (see the analysis of equation (4))44,45,46.

The SHG measurements were performed using the set-up shown in Fig. 2a and described in Methods. To realize all-optical polarization switching and SH modulation, it is crucial to first characterize the relative orientation between the FFs and the MoS2 sample. To do so, we first performed SHG experiments using a tunable near-infrared optical parametric oscillator (OPO) as the FF. The emitted SHG power for the FF wavelengths used in our experiments (between 1,360 nm and 1,560 nm) is shown in Fig. 2b. The slope of 2 in the double logarithmic plot is further proof of a genuine SHG process. The crystal orientation of the MoS2 sample was determined for each FF wavelength by SH polarization-dependent experiments, with an extra polarizer in front of the detector to measure the SH parallel to the excitation polarization36,39,43,47: the SH intensity is proportional to cos2[3(θ − ϕ0)], where θ is the FF polarization angle and ϕ0 is the rotation of the AC direction relative to the p-polarization in the laboratory frame. Figure 2c is an example of the SH polar plot for a FF wavelength of 1,400 nm and shows that the AC direction is tilted by ϕ0 = 13.6° + n × 60° (where n is an integer) with respect to p-polarization in the laboratory coordinates. Furthermore, Fig. 1c confirms the absence of any detectable strain in our sample, as uniaxial strain would result in a symmetric attenuation along its direction of action38,39. The small asymmetry of the lobes along the two AC directions (~15°/70° and ~190°/250°) is attributed to polarization-scrambling effects due to the use of a dichroic mirror in reflection geometry48. Finally, on the basis of the results in Fig. 2b, we determine the modulus of the complex second-order nonlinear susceptibility at the FF wavelengths used in our experiments. To do so, we estimate the optical losses of the set-up from the SH emission at the sample position to the detection on the single-photon avalanche diode (SPAD) and calculate the SH tensor element χ(2) of MoS2, as described in Methods. We thus obtained effective second-order susceptibility values for our FF wavelengths at 1,360 nm, 1,400 nm, 1,480 nm and 1,560 nm of ~282.1 pm V–1, ~153.7 pm V–1, ~44.7 pm V–1 and ~24.2 pm V–1, respectively. The highest value obtained at 1,360 nm FF wavelength is due to exciton resonant SH enhancement15,49. All values are in good agreement with those previously reported by experiments performed at similar FF wavelengths36,42,49,50,51 and predicted by theory52,53. It is worth noting that for single-layer TMDs where interlayer interference54 is absent, SHG is insensitive to the phase of the nonlinear optical response.

## Nonlinear all-optical modulation

Having defined the AC and ZZ directions of our sample, we now demonstrate all-optical SH polarization and amplitude modulation. We separate the FF beam into two perpendicular replicas, align them along the AC and ZZ directions of the sample using a half-waveplate, and control their relative delay with a motorized mechanical stage (see Methods for details). For large delays (that is, longer than the FF pulse duration) between the two perpendicular FFs, SH will be emitted by each individual FF along the AC direction following equation (2). At zero delay (when the two FFs overlap perfectly in time) the SH intensity along the AC direction will go to zero and the SH signal will be emitted only along the ZZ direction. Figure 3a shows the SH average power emitted along the ZZ direction as a function of the delay between the two perpendicularly polarized FFs and for a FF wavelength of 1,480 nm. The Gaussian fit (the blue curve in Fig. 3a) has a full-width at half-maximum (FWHM) of ~250 fs, which corresponds to the autocorrelation function of our OPO pulse with a duration of ~175 fs. Moreover, the SH signal along the ZZ direction is now ideally background free, demonstrating the potential of ultrafast SH polarization switching and the close-to-100% amplitude modulation of our approach.

We further note that this result is solely based on symmetry considerations and thus provides an ultrabroadband response that is not limited to above-gap or resonant exciton pumping. We obtained the same result for all of the FF wavelengths used in our experiments, as shown in Fig. 3b. The possibility to emit SH along perpendicular directions (AC and ZZ) with the same efficiency is a unique feature that arises from the combination of symmetry and deep subwavelength thickness of TMDs, which relaxes the phase-matching constraints typical of harmonic generation. This result could have an immediate application in background-free ultrabroadband and ultrashort pulse characterization. For instance, in the most advanced commercial systems55 for ultrashort pulse characterization, one has to switch between collinear and non-collinear geometries to collect either the interferometric or the background-free intensity autocorrelation signals, respectively. By contrast, in our approach both signals are accessible using the same geometry and by simply switching the SH detection from AC to ZZ. Further, following equation (3), the power scaling of the emitted SH along the ZZ direction is linear with respect to each of the FF intensities. This is confirmed by the power-dependent SHG measurements reported in Fig. 3c, where we show the emitted SH power along the ZZ direction at zero delay between the two FFs and as a function of the AC-polarized FF power.

To gain more insight into the temporal evolution of the emitted SH polarization and amplitude, we scan the delay between the two perpendicularly polarized FFs with interferometric precision and measure the emitted SH along both the AC and ZZ directions (Fig. 4a). To control the delay between two perpendicular pulses with the desired sub-optical-cycle precision, we used the common-path delay generator sketched in Fig. 4b and described in Methods. As expected, the SH power is emitted only along the AC direction for delays longer than our pulse duration, and no signal is detected along the ZZ direction (Fig. 4a). Instead, for delays close to zero we observe a strong ultrafast modulation of the SH power emitted along the AC direction. This can be better appreciated by looking at Fig. 4c, which shows the emitted SH power along the AC and ZZ directions at 1,480 nm for delays between −10 fs and +10 fs.

It is useful to note that, for delays much shorter than the pulse duration, our interferometric measurement is the analogue of tuning the polarization of one FF pulse along the orthodrome of the Poincaré sphere (see the inset in Fig. 4a). This corresponds to a rotation of the FF polarization from −45° with respect to the AC–ZZ directions (at zero delay), to left/right circular polarization (at $$\tau =\pm \frac{T}{4}$$ delay, where τ is the FF optical cycle), to +45° with respect to the AC–ZZ directions (at $$\tau =\pm \frac{T}{2}$$ delay). This result is consistent with the theoretical SH polarization P(2) generated by an arbitrary elliptically polarized FF46 after a simple basis transformation to account for the rotation by −45° with respect to AC/ZZ directions:

$${{\bf{P}}}^{(2)}={\epsilon }_{0}{\chi }^{(2)}| {\bf{E}}{| }^{2}\left(\widehat{\mathrm{ZZ}}\pm i\ \,{\text{sin}}\,(2\vartheta )\widehat{\mathrm{AC}}\right),$$
(4)

Here ϑ = 0° denotes a linearly polarized FF at 45° with respect to the AC/ZZ direction, whereas ϑ = 45° corresponds to a circularly polarized FF. This clearly shows that the SH component emitted along the AC direction oscillates with a period of $$\frac{T}{2}$$ as a function of the FF polarization, by contrast to the SH emitted along the ZZ direction. This underpins the interferometric precision required to fully capture the modulation along the AC direction. The experimental results show a weak modulation also for the SH emitted along the ZZ direction, although this is not expected from theory. This could arise from weak strain (that is, below the limit detectable by our SHG polarization measurements39,56), small deviations in the alignment of the detection polarizer with respect to the AC/ZZ directions or from extra terms in the χ(2) arising from the valley degree of freedom48,57. Looking at Fig. 4c, one can indeed appreciate that the SH is emitted only along the ZZ direction at zero delay (FF at −45° with respect to AC/ZZ directions), whereas the emitted SH components along AC and ZZ are identical at $$\frac{T}{4}$$ delay, as expected for circular polarization.

## Discussion

In conclusion, we have demonstrated all-optical polarization switching and amplitude modulation of SHG in MoS2. Our approach surpasses all previously reported electrical and all-optical attempts of SH tuning in terms of modulation depth and speed, providing a 90° polarization switch, modulation depth close to 100%, and speed limited only by the FF pulse duration. Moreover, our method is intrinsically broadband as it only relies on the crystal symmetry of TMDs. We thus foresee a direct impact of our results on a variety of photonic devices, such as high-speed frequency converters, nonlinear all-optical modulators and transistors31,32, autocorrelators for ultrashort pulse characterization, and atomically thin optically tunable nonlinear holograms24.

## Methods

### Polarization-dependent SH intensity

The vectorial components of the second-order polarization P(2)(2ω) for a material with D3h symmetry (such as TMDs) are given by

$$\left(\begin{array}{l}{P}_{x}^{(2)}(2\omega )\\ {P}_{y}^{(2)}(2\omega )\\ {P}_{z}^{(2)}(2\omega )\end{array}\right)={\epsilon }_{0}\left(\begin{array}{llllll}0&0&0&0&0&{\chi }_{xxy}^{(2)}\\ {\chi }_{yxx}^{(2)}&{\chi }_{yyy}^{(2)}&0&0&0&0\\ 0&0&0&0&0&0\end{array}\right)\left(\begin{array}{l}{E}_{x}^{2}(\omega )\\ {E}_{y}^{2}(\omega )\\ {E}_{z}^{2}(\omega )\\ 2{E}_{y}(\omega ){E}_{z}(\omega )\\ 2{E}_{x}(\omega ){E}_{z}(\omega )\\ 2{E}_{x}(\omega ){E}_{y}(\omega )\end{array}\right)$$

where $${\chi }_{yyy}^{(2)}=-{\chi }_{xxy}^{(2)}=-{\chi }_{yxx}^{(2)}={\chi }^{(2)}$$. If we now consider a TMD oriented in such way that the ZZ and AC directions lie along the x and y Cartesian coordinates, respectively, and we neglect the z (out-of-plane) direction, we obtain the following expression:

$$\left(\begin{array}{l}{P}_{\mathrm{ZZ}}^{(2)}(2\omega )\\ {P}_{\mathrm{AC}}^{(2)}(2\omega )\end{array}\right)={\epsilon }_{0}{\chi }^{(2)}(2\omega ,\omega ,\omega )\left(\begin{array}{l}2{E}_{\mathrm{ZZ}}(\omega ){E}_{\mathrm{AC}}(\omega )\\ {E}_{\mathrm{ZZ}}^{2}(\omega )-{E}_{\mathrm{AC}}^{2}(\omega )\end{array}\right)$$

Finally, as the SH intensity is proportional to the absolute square value of the second-order polarization, we retrieve equations (2) and (3) shown in the main text:

$$\begin{array}{lll}{I}_{\mathrm{AC}}^{2\omega }&=&| {P}_{\mathrm{AC}}^{(2)}{| }^{2} \propto | {E}_{\mathrm{AC}}^{2}-{E}_{\mathrm{ZZ}}^{2}{| }^{2}\\ {I}_{\mathrm{ZZ}}^{2\omega }&=&| {P}_{\mathrm{ZZ}}^{(2)}{| }^{2} \propto | 2{E}_{\mathrm{AC}}{E}_{\mathrm{ZZ}}{| }^{2}\end{array}$$

### SHG set-up

For the FF we used an OPO (Levante IR from APE) pumped by an ytterbium-doped mode locked laser (FLINT12, Light Conversion) with a repetition rate of 76 MHz, pulse duration of 100 fs, and generating pulses tunable between ~1.3 μm and 2.0 μm. The FF is then separated into two perpendicular replicas whose relative delay is tuned with two different approaches: a computer-controlled motorized stage (M-414.2PD, PI) in a Mach–Zehnder interferometer configuration and a commercial common-path birefringent interferometer (GEMINI, NIREOS)58. Compared with standard home-built interferometers, the GEMINI provides subwavelength interferometric stability with precise control on the delay between the two replicas with attosecond precision. The polarization of the FFs was tuned using a half-waveplate (AHWP05M-1600, Thorlabs) and the power on the sample was controlled by two polarizers (LPNIR050 and WP12L-UB, both Thorlabs). Finally, the two collinear and perpendicularly polarized FFs were focused on the sample using a custom built microscope equipped with a ×40 reflective objective (LMM-40X-P01, Thorlabs). The backscattered SH signal is spectrally separated using a dichroic mirror (DMSP950, Thorlabs), further spectrally purified by filters (FELH0650, FESH850, FESH0950, all Thorlabs) and detected with a SPAD (C11202-050, Hamamatsu). The SH polarization was measured using a wire grid polarizer (WP12L-UB, Thorlabs).

### Estimate of the optical losses of the set-up

To quantify the SH signal generated directly at the sample position, optical losses of the different components of the set-up must be considered. Although the transmission coefficients for the investigated SH wavelengths of the filters and the dichroic mirror (all >96%) were taken from the manufacturer’s website, the values for polarizers and the microscope objective were determined experimentally. A transmission of ~79% was determined for the wire grid polarizer, whereas we determined a transmission of 50% for the reflective objective. Last, the responsivity of the SPAD was taken into account, which ranges depending on the investigated SH wavelength between ~17% and ~31%. In total, we estimated our optical losses from the SH emission to the detector to be ~86–92%, depending on the wavelength.

### Calculation of the second-order nonlinear susceptibility

The sheet SH tensor element $${\chi }_{{\mathrm{S}}}^{(2)}$$ can be calculated from the FF and SH average powers using the equation42:

$${\chi }_{{\mathrm{S}}}^{(2)}=\sqrt{\frac{{c}^{3}{\epsilon }_{0}f\uppi {r}^{2}{t}_{\mathrm{FWHM}}{(1+{n}_{2})}^{6}{P}_{\mathrm{SHG}}(2\omega )}{16\sqrt{2}S{\omega }^{2}{P}_{\mathrm{FF}}^{2}(\omega )}},$$
(5)

where c is the speed of light, ϵ0 is the permittivity of free-space, f = 76 MHz is the pump laser repetition rate, r ≈ 1.85 μm is the focal spot radius, tFWHM ≈ 200 fs is the FWHM of the pulse, n2 ≈ 1.45 is the substrate refractive index, S = 0.94 is a shape factor for Gaussian pulses, ω is the FF angular frequency, and PSHG(2ω) – PFF(ω) are the SH and FF average powers, respectively. The effective bulk-like second-order susceptibility $${\chi }_{\mathrm{eff}}^{(2)}$$ can be subsequently calculated from equation (5) as $${\chi }_{\mathrm{eff}}^{(2)}=\frac{{\chi }_{S}^{(2)}}{{d}_{\mathrm{Mo{S}_{2}}}}$$, where the thickness of MoS2 $${d}_{\mathrm{Mo{S}_{2}}}$$ is 0.65 nm (refs. 18,46).

### Pulse duration of the FFs

To prove that our method is solely limited by the pulse duration of the FFs, we performed a standard characterization of a temporal profile of our OPO source at different wavelengths (Extended Data Fig. 1). For the measurements, we used a home-built autocorrelator based on a Michelson interferometer equipped with a motorized and computer-controlled translation stage (HPS60-20X-M5, Optosigma). Two identical and temporally delayed replicas of the OPO pulse were then focused onto a 1-mm-thick beta barium borate crystal (BBO-652H, Eksma Optics) in non-collinear geometry and the background-free SHG autocorrelation intensity was detected on a silicon photodetector (DET10A2, Thorlabs). From this we obtained values for the autocorrelation in the range of 217 fs to 310 fs with Gaussian fits, corresponding to pulse durations between 150 fs and 220 fs, respectively.