## Introduction

Transmission of a monochromatic wave through a static sample is fully described by the transmission matrix (TM), t. The TM is a subset of the scattering matrix which provides the coupling of a system to its surroundings. In the last decade, there has been growing interest in measuring the TM to control the flow of waves through random systems and optical fibers1,2. Shaping the incident waveform illuminating a sample makes it possible to manipulate the net transmitted flux and its spatial intensity profile for applications in medical imaging and communications. For instance, a scattering medium can appear to be transparent or opaque when the incoming wavefront is adjusted to correspond to the first or last transmission eigenchannels3,4,5,6,7,8,9. The intensity can also be focused through random media at a selected point in the output by adjusting the incident wave so that all transmission channels interfere constructively at that point1,10.

The elements tba of the TM are the field transmission coefficients between the N channels leading toward and away from opposite ends of a sample, a and b, respectively. The TM was initially studied in order to explain the scaling of the conductance of wires at zero temperature11,12. Classical and quantum transport are connected by the dimensionless conductance, which is the conductance in units of the quantum of conductance, (e2/h). The dimensionless conductance is equal to the average transmittance, g = 〈T〉, where 〈〉 represents the average over a random ensemble. The crossover to Anderson localization occurs at g = 1; waves are localized for g < 1 and diffusive for 1 < g < N/2. The transmittance is the sum of all flux transmission coefficients, |tba|2, which equals the sum of the N eigenvalues τn, $$T = {\mathrm{\Sigma }}_{a,b = 1}^N\left| {t_{ba}} \right|^2 = tr\left( {{\mathbf{tt}}^\dagger } \right) = {\mathrm{\Sigma }}_{n = 1}^N\tau _n$$11,12.

In principle, the degree of control over transmission in diffusive samples is strong because the distribution of transmission eigenvalues is wide. This distribution is bimodal with a peak near unity containing g “open” channels and a second peak corresponding to “closed” channels with values that are exponentially small in the ratio of the sample length and the transport mean free path, $$L/\ell$$6,12,13,14. In practice, however, measurements of the TM are incomplete so that the dynamic range over which transmission can be controlled is limited4,15,16,17. Because the dwell time and the energy density profile inside a medium excited in a specific eigenchannel are correlated with the corresponding transmission eigenvalue, exciting transmission eigenchannels also provides a measure of control over the dwell time and the spatial distribution of energy within a random medium3,5,6,7,8,9,18. The full diversity of dwell times is given by the eigenvalues of the Wigner-Smith time-delay matrix, known as the proper delay times, which are constructed from the spectrum of the scattering matrix19,20,21,22.

Another approach to controlling propagation within random or structured media might be to manipulate the incident wave to preferentially excite specific quasi-normal modes23 which have different lifetimes and spatial profiles. Modes of open systems are solutions of the wave equation over the volume of the random medium with outgoing radiation boundary conditions24,25,26. In resonating structures for which the complex eigenvalues and eigenvectors can be found analytically or numerically, the field for any source excitation can be reconstructed from the coherent superposition of modal contributions26,27. Beyond the independent contribution of each mode, the resultant field depends critically upon the interference between the fields of modes that overlap spectrally and spatially. Modal coupling plays a key role in describing the physics of photonic systems such as chaotic cavities28,29,30,31,32, coupled cavities or waveguides33,34, optical resonators27,35, quantum plasmonic36,37 or disordered media30,38,39,40.

In large complex systems, it is generally not possible to solve for the eigenvectors of the wave equation, but important properties of a system and its coupling to its surroundings can be determined from the statistics of scattering spectra and their analysis into modes or energy levels. Great emphasis has been placed on the probability distributions of level spacings41,42,43 and level widths28,32,44. However, the statistics of level widths and spacings do not directly yield the statistics of scattering because the scattered wave also reflects the interference between modes and the degree to which modal speckle patterns are correlated.

Here we consider the degree of modal selectivity that can be achieved in random media by manipulating the incident waveform. We approach the problem by analyzing the spectrum of the TM into its modal components in locally 2D N–channel samples. The complex modal frequencies and amplitudes are found by decomposing the spectra of the elements of the TM into a superposition of spectral lines via Breit-Wigner theory30,45,46

$$t_{ba}\left( \omega \right) = {\mathrm{\Sigma }}_n\frac{{t_{ba}^n}}{{\omega - \omega _n + i{\mathrm{\Gamma }}_n/2}} = {\mathrm{\Sigma }}_nt_{ba}^n\varphi _n(\omega ).$$
(1)

Here φn(ω) = (ω − ωn + iΓn/2)−1 is the frequency variation of excitation of the field associated with the mode with central frequency ωn and linewidth Γn, and $$t_{ba}^n$$ is the complex field transmission coefficient associated with the nth resonance. Each resonance is then associated with a modal transmission matrix (MTM), tn, which is built upon the coefficients $$t_{ba}^n$$, and is the contribution of a mode of the scattering medium to the TM23. An MTM therefore provides the incoming wavefront that maximally enhances the energy in a specific mode. However, modal selectivity becomes more challenging as the degree of modal overlap increases in non-Hermitian media.

## Results

### Modal decomposition in the effective Hamiltonian formalism

The coupling of a system to its surroundings can be analyzed in terms of an effective Hamiltonian. The coupling is described via the 2N×2N scattering matrix S expressed in terms of the M×M effective Hamiltonian Heff as28,29,30,47,48,49

$${\mathbf{S}} = {\mathbf{1}} - i{\mathbf{V}}^{T}\frac{1}{{{\mathbf{\omega }} - {\mathbf{H}}_{{\mathrm{eff}}}}}{\mathbf{V}}{\mathrm{.}}$$
(2)

Here V is a real M × 2N matrix describing the coupling of the M modes of the closed system to the exterior via the 2 N channels in the leads on both sides of the sample. The non-Hermitian effective Hamiltonian is

$${\mathbf{H}}_{{\mathrm{eff}}} = {\mathbf{H}}_0 - \frac{i}{2}{\mathbf{VV}}^{\mathbf{T}},$$
(3)

where H0 is the Hermitian Hamiltonian of the closed system. The poles of the S matrix occur at the complex eigenvalues $$\tilde \omega _n$$ of $${\mathbf{H}}_{{\mathrm{eff}}}$$, $$\tilde \omega _n = \omega _n - i{\mathrm{\Gamma }}_n/2$$. Two sets of eigenvectors are associated with these eigenvalues. These are the right $$|\phi _n\rangle$$ and left $$\langle \varphi _n|$$ eigenvectors, which are the transpose of one another, $$\langle \varphi _n| = (|\phi _n\rangle )^T$$. The eigenfunctions of $${\mathbf{H}}_{{\mathrm{eff}}}$$ are bi-orthogonal and satisfy the following orthogonality condition due to the time-reversal symmetry of $${\mathbf{H}}_{{\mathrm{eff}}}$$, $$\langle \phi _n^ \ast |\phi _m\rangle = \delta _{nm}$$. As a result of the imaginary part of $${\mathbf{H}}_{{\mathrm{eff}}}$$, the eigenfunctions are complex.

The modal decomposition of the TM may be expressed in terms of the complex vectors |WLn|2 and |WRn|2 which couple the eigenstates φn to the scattering wavefunctions ξL and ξR in the left and right leads, respectively29,

$${\mathbf{t}}(\omega ) = - i\mathop {\sum }\limits_{n = 1}^M \frac{{{\mathbf{W}}_{{\mathrm{R}}n}{\mathbf{W}}_{{\mathrm{L}}n}^T}}{{\omega - \omega _n + i\frac{{{\mathrm{\Gamma }}_n}}{2}}}{\mathrm{.}}$$
(4)

We identify the MTM of the nth mode at resonance as $${\mathbf{t}}_n = - i{\mathbf{W}}_{{\mathrm{R}}n}{\mathbf{W}}_{{\mathrm{L}}n}^T/\left( {{\mathrm{\Gamma }}_n/2} \right)$$. The MTM for each mode is of unit rank since it is the product of the vectors WRn and $${\mathbf{W}}_{{\mathrm{L}}n}^T$$. In principle, the coupling of the eigenfunctions of the closed system to the leads, and therefore vectors WRn and WLn, depend on frequency. However, in the case of resonances with high quality factors Qn = 2ωnn, which are explored in the experiments described below, we can take WRn(ω) = WRn(ωn) = WRn and WLn(ω) = WLn(ωn) = WLn. The TM is then expressed as a superposition of MTMs with modal transmission coefficients for Lorentzian lines defined at the resonance frequency. The decomposition of the TM into MTMs and the properties of the MTMs are demonstrated below in microwave experiments.

### Experimental setup

Measurements of the TM are performed in a two-dimensional cavity containing randomly positioned disks (see Fig. 1a and Methods for details). Spectra of the N × N TM are measured between two arrays of N = 8 emitting and receiving antennas on the left and right sides of the cavity, respectively. Measurements are carried out in the frequency range 10.7–11.7 GHz in a scattering sample of 300 randomly distributed 6-mm-diameter aluminum disks. The sample is weakly localized and modal spectral overlap is moderate. The coupling strength $$\tilde T_a$$ of the antennas to the sample is determined using the mean value of the reflection parameter at each antenna, $$\left\langle {S_{aa}} \right\rangle$$, $$\tilde T_a = 1 - \left| {\left\langle {S_{aa}} \right\rangle } \right|^2$$ gives $$\tilde T_a \sim 0.99$$ so that the antennas are strongly coupled to the cavity.

### Decomposition into MTMs

The modes can be found from an analysis of the spectrum of the TM as a superposition of MTMs using Eq. (1). The set {ωn, Γn} is extracted via the Harmonic inversion (HI) method from the inverse Fourier transform of spectra of transmission coefficients tba(ω)45,50,51 (see Methods). The coefficients $$t_{ba}^n$$ of tn are then found from the fit of transmission coefficients in the time domain. The flux transmission coefficient between two channels, |tba(ω)|2, and the underlying modal transmission coefficients between the channels for each mode, $$\left| {t_{ba}^n} \right|^2\left| {\varphi _n(\omega )} \right|^2$$ are shown in Fig. 1b. The transmittance and the contribution $$T_n\left( \omega \right) = {\mathrm{\Sigma }}_{ba}\left| {t_{ba}^n} \right|^2\left| {\varphi _n(\omega )} \right|^2$$ of each mode to T(ω) are shown in Fig. 1c. The reconstructions of the transmission and of the transmittance from the modes and the measurements of these quantities are in excellent agreement.

The degree of modal overlap may be expressed as the ratio of the mode width and spacing δ = δωω, where δω = < Γn > is the average linewidth of modes and Δω = < ωm+1 − ωm > is the typical spacing between neighboring modes. In random media, the degree to which modes overlap spectrally tracks the spatial extent of the eigenstates in the interior of the sample and so the crossover from diffusion to localization44,46,52,53. When reflection at the interface is weak, the ensemble average of the ratio of the level width to level spacing gives the Thouless number, which is equal to the conductance g44. Modes of the medium are generally exponentially peaked within the sample when δ < 1 and extended when δ > 1. Here the average linewidth is 〈Γn〉 ~9 MHz and the degree of modal overlap is δ ~ 1.2. The high average modal quality factor Q = 3300 justifies the assumption that the coupling vectors between the quasi-normal modes and the antennas are independent of frequency.

An additional check is placed on the accuracy of the modal decomposition of the TM when the fit to transmission is carried out simultaneously at several points in the sample: the rank of MTMs found in the fits of transmission must be close to unit rank, as predicted by Eq. (4). This additional check is not possible when a single spectrum of a transmission coefficient is decomposed into modes with use of HI, as has been done in studies of chaotic cavities45. Spectra of the transmission eigenvalues of the measured TM, τi(ω), are compared in Fig. 1d to the transmission eigenvalues of modes found from the diagonalization of $$t_nt_n^\dagger$$. The second modal eigenvalue is typically smaller than the first by a factor of 10–2. The dominance of the first modal eigenvalue supports the predicted decomposition of the TM into MTMs of unit rank. This is further confirmed in measurements with smaller modal overlap (Supplementary Note 1) in which the ratios of the second and first modal eigenvalue are substantially smaller. The ratio is still smaller in simulations for samples with modal overlap comparable to that in experiments indicating that the quality of the modal decomposition is degraded by noise in the measurements.

We find that when the first and second eigenvalues of the MTM are close in value, the results are likely to be spurious. The modal analysis is limited here to samples with moderate modal overlap. For higher modal overlap, spurious resonances may appear in the modal analysis due to the contributions of modes with large linewidth which cannot be resolved and to modes that lie outside the frequency range but still contribute since their linewidth is broad.

### Modal selectivity

The strength of excitation of an individual mode is maximized when the incoming wave on the left or right excites the sample with the optimal modal patterns $${\mathbf{W}}_{{\mathrm{L}}n}^ \ast$$ and $${\mathbf{W}}_{{\mathrm{R}}n}^ \ast$$, respectively. These are the complex conjugates or the time-reversal of modal speckle patterns at the sample boundaries. Using Eq. (4), the vector of the transmitted field for an excitation of the sample from the left with the normalized optimal waveform, $${\mathbf{v}}_n = {\mathbf{W}}_{{\mathrm{L}}n}^ \ast /{\mathbf{W}}_{{\mathrm{L}}n}$$, can be expressed as

$${\mathbf{E}}_{{\mathrm{max}}}\left( \omega \right) = {\mathbf{t}}(\omega ){\mathbf{v}}_n = - i\frac{{{\mathbf{W}}_{{\mathrm{L}}n}^2}}{{\omega - \omega _n + i\frac{{{\mathrm{\Gamma }}_n}}{2}}}\frac{{{\mathbf{W}}_{{\mathrm{R}}n}}}{{{\mathbf{W}}_{{\mathrm{L}}n}}} \\ - i{\mathrm{\Sigma }}_{m \ne n}\frac{{{\mathbf{W}}_{{\mathrm{L}}m}^{\mathrm{T}}{\mathbf{W}}_{{\mathrm{L}}n}^ \ast }}{{\left( {\omega - \omega _m + i\frac{{{\mathrm{\Gamma }}_m}}{2}} \right)}}\frac{{{\mathbf{W}}_{{\mathrm{R}}m}}}{{{\mathbf{W}}_{{\mathrm{L}}n}}}.$$
(5)

The first term in Eq. (5) gives the contribution of the nth mode to transmission for maximal coupling and the sum in the second term gives the contributions of other modes. Apart from the Lorentzian function, the energy in the mode to which the field is maximally coupled is equal to $$\left\| {{\mathbf{W}}_{{\mathrm{L}}n}} \right\|^2\left\| {{\mathbf{W}}_{{\mathrm{R}}n}} \right\|^2$$. This can be compared to the average energy for a normalized random incoming waveform vrand which is $$\left\langle {\left| {{\mathbf{W}}_{{\mathrm{L}}n}^T{\mathbf{v}}_{{\mathrm{rand}}}} \right|^2} \right\rangle \left\| {{\mathbf{W}}_{{\mathrm{L}}n}} \right\|^2 = \left\| {{\mathbf{W}}_{{\mathrm{L}}n}} \right\|^2\left\| {{\mathbf{W}}_{{\mathrm{R}}n}} \right\|^2/N$$. The energy in the mode for maximal coupling in an N-channel system is therefore enhanced by a factor N using the optimal modal pattern. This property is a consequence of the unit-rank of the MTMs. At the same time, the contribution to transmission of the selected mode vanishes for any incoming vector orthogonal to the optimal modal pattern WLn. Residual transmission is due to the contributions of neighboring modes.

Excitation of specific quasi-normal modes differs from excitation of transmission eigenchannels. The eigenchannels and eigenvalues of the TM can be found via a singular value decomposition in which the TM at a single frequency is expressed as the product of three N × N matrices, $${\mathbf{t}}\left( \omega \right) = {\mathbf{U\Lambda }}{\mathrm{V}}^\dagger$$. Here Λ is a diagonal matrix whose elements are the singular values $$\sqrt {\tau _i}$$, and V and U are unitary matrices and correspond to the waveforms of the transmission eigenchannel on the input and output of the sample, respectively. In contrast to modes, which have a Lorentzian spectrum, the eigenchannels are defined at a specific frequency; a new set of transmission eigenvalues and eigenchannels must be computed at each frequency5,23,54,55. However, the spectral characteristics of the channels can be obtained by decomposing the transmission eigenchannels into modes23,54. When a single mode dominates transmission, the MTM for this mode is close to the first eigenchannel. At the resonance, the first transmission eigenvalue is, $$\tau _1\left( {\omega _n} \right) = \left\| {{\mathbf{W}}_{{\mathrm{L}}n}} \right\|^2\left\| {{\mathbf{W}}_{{\mathrm{R}}n}} \right\|^2/\left( {{\mathrm{\Gamma }}_n/2} \right)^2$$. When several resonances overlap, however, the first transmission eigenchannel is a combination of modal contributions of several modes.

### Experimental demonstration of modal selectivity

To explore the degree of modal selectivity for different incident waveforms, the field coefficient within the medium ea(x, y, ω) is measured using a wire antenna inserted through subwavelength holes (see Methods). The contributions of modes inside the medium, $$e_a^n(x,y)$$, are then obtained from a fit of the coefficients $$e_a\left( {x,y,\omega } \right) = {\mathrm{\Sigma }}_ne_a^n\left( {x,y} \right)\varphi _n(\omega )$$ using the set of resonances {ωn, Γn} obtained from the modal expansion of the TM. The spatial energy distribution for each mode is reconstructed from the contributions of modal field patterns due to the eight incoming channels summed to give the optimum incident modal pattern.

For isolated modes, strong modal discrimination is readily accomplished by tuning to resonance. The strength of excitation is enhanced over the average of random excitation by a factor of N by adjusting the incident wavefront to the optimal modal pattern. In Fig. 2, we consider two weakly overlapping modes at f1 = = 11.434 GHz and f2 = 11.461 GHz with linewidths of Γ1/(2π) = 3.75 MHz and Γ2/(2π) = 4.84 MHz. This gives a degree of modal overlap between the modes of $$\delta _{12} = \left[ {\frac{{{\mathrm{\Gamma }}_n + {\mathrm{\Gamma }}_{n + 1}}}{2}} \right]/(\omega _{n + 1} - \omega _n)$$ of 0.15. The two modes are spatially distinct and peaked at different points within the sample, as seen in Fig. 2a. For maximal coupling to the first and second modes, the transmission is seen in Fig. 2c, d to be enhanced by a factor of close to N = 8 at the resonance of the two modes in comparison transmission for a random incoming wavefront shown in Fig. 2b. The energy density inside the medium at resonance then closely matches the spatial distribution of the mode, as seen in the insets of Fig. 2c, d. In contrast, for vanishing coupling to the first mode using the third singular vector of the MTM, the first mode does not contribute to transmission and the energy density is due to the contribution of weakly overlapping modes, as seen in Fig. 2e. The energy density is concentrated at the beginning of the sample and falls rapidly into sample. Thus, specific modes can be selected using optimal modal incident wave patterns when the modes overlap weakly.

In Fig. 2f, we show the average over the cross-section of the modal strength inside the medium for maximal and vanishing coupling to the first mode at f1 = 11.434 GHz. The contribution of the mode is maximum for the optimal incident modal pattern and should vanish for the orthogonal waveforms. For vanishing coupling, the intensity is seen to fall exponentially within the sample and transmission is more than two orders of magnitude below that for maximal coupling, in agreement with the ratio between the first and second modal eigenvalues.

We next consider selectivity in a case of two strongly overlapping modes (Fig. 3). The modes at f1 = 11.763 GHz and f2 = 11.773 GHz with linewidths Γ1/(2π) = 12.1 MHz and Γ2/(2π) = 16.6 MHz have the modal overlap factor δ12 = 1.35. The spatial profiles of the two modes are seen in Fig. 3a to be more extended than the modes discussed previously with δ12 = 0.15 and to be very similar. In addition to enhancing the contribution of the maximally excited mode, maximal coupling is seen in Fig. 3c, d to enhance the contribution of the neighboring mode in comparison to a wavefront that has not been optimized. The modal transmission associated with the second mode is enhanced by a factor 4 for maximal coupling to the first mode.

The distributions of energy density for a random wavefront and for the first transmission eigenchannel at a frequency midway between the two resonances ω0 = (ωn + ωn+1)/2, are seen in Fig. 4a, b to be primarily mixtures of the modal spatial patterns of the two neighboring modes shown in Fig. 354. Nevertheless, it is possible to preferentially excite a single mode by adjusting the incident wave to match the pattern of one of the nearby resonant modes. In Fig. 4c, d, the energy density at the frequency between the modal resonances is shown for maximal coupling to one or the other of the modes. In each case, the energy density matches the spatial distribution of the selected mode shown in Fig. 3a. The degree of modal selectivity between two modes achieved by maximizing the input for one of the modes is reduced as a result of the hybridization and spectral broadening of the modes of the closed system when the sample is coupled to its surroundings. We will see in the theoretical analysis and measurements below that the similarity in modal patterns in the interior of the sample seen in Fig. 3a is a consequence of the bi-orthogonality of the eigenfunctions and the correlation between them.

The degree of modal selectivity can be further enhanced at the expense of the net excitation of the mode by exciting with a waveform that is orthogonal to the neighboring mode. In the case of two overlapping modes, this is achieved by illuminating the sample with an incident wavefront $$a{\mathbf{W}}_{{\mathrm{L}}1}^ \ast + b{\mathbf{W}}_{{\mathrm{L}}2}^ \ast$$ with coefficients a and b satisfying the condition, a$${\mathbf{W}}_{{\mathrm{L}}2}^T{\mathbf{W}}_{{\mathrm{L}}1}^ \ast + b{\mathbf{W}}_{{\mathrm{L}}2}^T{\mathbf{W}}_{{\mathrm{L}}2}^ \ast = 0$$. The contribution of the second mode therefore vanishes so that the desired modes is perfectly selected relative to the second mode. Because of the correlation of modal speckle pattern, this also suppresses the excitation of the selected mode.

## Mixing of eigenfunctions

### Nonorthogonality matrix

Equation (4) shows that the contribution to the output speckle pattern of the mth mode for the incident waveform that couples maximally to the nth mode at resonance, ω = ωn, is equal to

$$C_{mn} = \frac{{{\mathbf{W}}_{{\mathrm{L}}m}^\dagger {\mathbf{W}}_{{\mathrm{L}}n}}}{{\omega _n - \tilde \omega _m^ \ast }}.$$
(6)

The matrix C involves the degree of correlation between the modal patterns at the input. It can be related to the Bell-Steinberger nonorthogonality matrix U, which gives the correlation over the volume between the eigenfunctions φn of the system32,56. The elements of U given by the scalar product, $$U_{mn} = \phi _m^\dagger \phi _n$$ can also be expressed in terms of the vectors Wn, in the absence of losses that are not due to the coupling of the antennas to the system.

$$U_{mn} \equiv \phi _m^\dagger \phi _n = i\frac{{{\mathbf{W}}_m^\dagger {\mathbf{W}}_n}}{{\tilde \omega _n - \tilde \omega _m^ \ast }}$$
(7)

Here, the vector Wn with 2N elements is the concatenation of the two vectors WLn and WRn. In Hermitian systems, U is the identity matrix since the modes are orthogonal over the volume. However for non-Hermitian systems, the diagonal elements of U, which are the inverses of the phase rigidities of the eigenfunctions, Unn = 1/ρn, increase with modal overlap32,57,58. The phase rigidity, $$\rho _n \equiv \langle \phi _n^2\rangle /\left\langle {\left| {\phi _n} \right|} \right\rangle ^2$$, can be expressed in terms of the degree of complexness of the eigenfunctions of Heff, $$q_n^2 = \left\langle {{\mathrm{Im}}\left( {\phi _n} \right)^2} \right\rangle /\left\langle {{\mathrm{Re}}\left( {\phi _n} \right)^2} \right\rangle$$, as $$\rho _n = (1 - q_n^2)/(1 + q_n^2)$$39. For traveling waves, the real and imaginary parts of the eigenstates are the same on average so that qn = 1 and ρn = 0. In contrast, for isolated resonances, the eigenfunctions coincide with the real eigenfunctions of the closed system and ρn → 1. In random media, the degree of complexness and the phase rigidity track the transition from the diffusive to localized regime59.

The completeness of the eigenfunctions implies the sum rule $${\mathrm{\Sigma }}_mU_{nm}^2 = 1$$60. The positive diagonal elements of U matrix and the negative off-diagonal elements are enhanced as the degree of modal overlap δ increases. In the weak coupling regime, the diagonal elements are of order 1 + δ248, while the magnitude of off-diagonal elements increase as −δ58.

Equation (7) shows that the non-orthogonality of eigenfunctions over the volume yields a non-vanishing degree of correlation between modal speckle patterns at the interface. In the case of maximal coupling to a mode, the off-diagonal elements are also responsible of the non-vanishing of the contribution of the neighboring modes as shown by the similarity of Eqs. (6) and (7). However, two differences can be observed. First, Cnm involves $${\mathbf{W}}_{{\mathrm{L}}m}^\dagger {\mathbf{W}}_{{\mathrm{L}}n}$$ instead of $${\mathbf{W}}_m^\dagger {\mathbf{W}}_n = {\mathbf{W}}_{{\mathrm{L}}m}^\dagger {\mathbf{W}}_{{\mathrm{L}}n} + {\mathbf{W}}_{{\mathrm{R}}m}^\dagger {\mathbf{W}}_{{\mathrm{R}}n}$$. Since WLn and WRn are statistically independent random variables, we may apply the central limit theorem and approximate $${\mathbf{W}}_m^\dagger {\mathbf{W}}_n \sim 2{\mathbf{W}}_{Lm}^\dagger {\mathbf{W}}_{Ln}$$ for N>>1 . Second, the denominator of Eq. (6) depends on $$\omega _n - \tilde \omega _m^ \ast$$ instead of $$\tilde \omega _n - \tilde \omega _m^ \ast$$. However, in the case of strongly overlapping resonances, the spacing between the central frequencies ωn − ωm is much smaller than the linewidths Γn and Γm so that $$\omega _n - \tilde \omega _m^ {\ast} \sim - {i}{\mathrm{\Gamma }}_m/2$$ and $$\tilde \omega _n - \tilde \omega _m^ {\ast} \sim - {i} \left( {\mathrm{\Gamma }}_n + {\mathrm{\Gamma }}_m \right)/2$$. For resonances with similar linewidths, we therefore obtain Cnm ~ Unm. The non-orthogonality of eigenfunctions therefore yields a non-vanishing degree of correlation between modal speckle patterns.

We define the modal selectivity for maximal modal coupling as the ratio of the strength of the selected mode in transmission over the incoherent sum of strengths of all modes

$$S_{{\mathrm{mode}}} = \frac{{T_n(\omega _n)}}{{{\mathrm{\Sigma }}_{m = 1}^MT_m(\omega _n)}} \sim \frac{{\left| {C_{nn}} \right|^2}}{{{\mathrm{\Sigma }}_m\left| {C_{nm}} \right|^2}}.$$
(8)

A diagonal matrix C would correspond to perfect modal selectivity with Smode = 1. However, for non-Hermitian systems, modal selectivity falls below unity due to off-diagonal elements of Cnm. Thus the bi-orthogonality of the eigenfunctions of a non-Hermitian system reduces the degree of modal selectivity for maximal coupling to a mode. This is illustrated in the analytical analysis of a two-level non-Hermitian effective Hamiltonian model.

### Two-level effective Hamiltonian

The modes of the system are expressed in the basis of the two modes of the closed cavity39,40

$${\mathbf{H}}_{{\mathrm{eff}}} = \left( {\begin{array}{*{20}{c}} {\omega _1} & 0 \\ 0 & {\omega _2} \end{array}} \right) - \frac{i}{2}\left( {\begin{array}{*{20}{c}} {{\mathrm{\Gamma }}_{11}} & {{\mathrm{\Gamma }}_{12}} \\ {{\mathrm{\Gamma }}_{12}} & {{\mathrm{\Gamma }}_{22}} \end{array}} \right)$$
(9)

The parameters Γnm are given by, $${\mathrm{\Gamma }}_{nm} = {\mathrm{\Sigma }}_{c = 1}^{2N}V_n^cV_m^c$$, where the vectors Vn represent the coupling of the closed system to the leads (see Eq. (1))39. The parameter γ = Γ12 is the coupling parameter between the resonances. Diagonalizing Heff gives the eigenvalues $$\tilde \omega _{1,2} = \frac{1}{2}(\omega _2 + \omega _1) \mp \frac{1}{2}\sqrt {{\it{\epsilon }}^2 - \gamma ^2} - \frac{i}{4}\left( {{\mathrm{\Gamma }}_{11} + {\mathrm{\Gamma }}_{22}} \right)$$, with $${\it{\epsilon }} = \left( {\omega _2 - \omega _1} \right) - \frac{i}{2}({\mathrm{\Gamma }}_{11} - {\mathrm{\Gamma }}_{22})$$. The eigenvectors |ϕn〉 of the effective Hamiltonian Heff can be written in the basis {|ψn} of the unperturbed eigenvectors of the Hamiltonian of the closed system H48

$$\vert {ϕ} _{1} \rangle = \frac{1}{{\sqrt {1 - f^{2}} }}\left( {\begin{array}{*{20}{c}} 1 \\ { - if} \end{array}} \right), \vert {ϕ} _{2}\rangle = \frac{1}{{\sqrt {1 - f^{2}} }}\left( {\begin{array}{*{20}{c}} {if} \\ 1 \end{array}} \right).$$
(10)

The mixing of the two eigenstates depends on the single parameter, $$f = \gamma /({\it{\epsilon }} + \sqrt {{\it{\epsilon }}^2 - \gamma ^2} )$$. The degree of complexness of the eigenfunctions is the same for both modes, $$q_1^2 = q_2^2 = f^2$$. In the present case of the two-level Hamiltonian, $$q_n^2$$ increases from 0 for isolated modes ($$\gamma \ll {\it{\epsilon }}$$) to unity for f = 1, which is the case of an exceptional point at which the eigenvalues $$\tilde \omega _1$$ and $$\tilde \omega _2$$ coalesce61.

The two-level Hamiltonian model is illustrated in Fig. 5 by the eigenfunctions of two hybridized modes at f1 = 11.260 GHz and f2 = 11.266 GHz, which are isolated from other modes but overlap strongly with a degree of overlap between the modes of δ12 = 5.5. The eigenfunctions are normalized following the bi-orthogonality condition, $${\int}^{d} r{\phi}_{n}^{2}( r ) = 1$$. There is a strong similarity between Re(ϕ1) and Im(ϕ2) and between Im(ϕ1) and Re(ϕ2), as anticipated in Eq. (10). The eigenfunctions give $$q_{1}^{2} = 0.86$$ and $$q_{2}^{2} = 0.4$$. The two values are not equal because of the weak overlap with other modes. We observe in Fig. 5e, f that when the incident wave is maximally coupled to the first or second mode, the transmission spectra and the contribution of the two modes are very similar. The correlation between the incident waveforms WL1 and WL2, $$\left| {{\mathbf{W}}_{{\mathrm{L}}1}^{\dagger} {\mathbf{W}}_{{\mathrm{L}}2}} \right|/(\left\| {{\mathbf{W}}_{{\mathrm{L}}1}} \right\|\left\| {{\mathbf{W}}_{{\mathrm{L}}2}} \right\|)$$ is 0.98. The modal mixing of two strongly overlapping modes and its impact on the modal selectivity are further confirmed in finite-element simulations in Supplementary Note 2.

The decrease of Smode with increasing degree of modal mixing is demonstrated analytically in Supplementary Note 3 within the framework of the two-level Hamiltonian model. By expressing the average degree of correlation between vectors WL1 and WL2 as a function of f in the limit $$N \gg 1$$ and $$f \ll 1$$,, we find using Eq. (4) that Smode only depends upon the modal overlap and f with $$S_{{\mathrm{mode}}} \sim \left[ {1 + \frac{{4f^2{\mathrm{\Gamma }}_1^2}}{{4{\mathrm{\Delta }}_{12}^2 + {\mathrm{\Gamma }}_2^2}}} \right]^{ - 1}$$, where Δ12 = ω2 − ω1.

### Average modal selectivity

In order to investigate the average modal selectivity in a large number of samples, we carry out simulations utilizing the recursive Green’s function method62 in random quasi-1D samples connected to leads supporting N channels to find t(ω) (see Methods). Four ensembles with modal overlap δ equal to 0.08, 0.11, 0.64, and 1.13 are studied. The number of channels is N = 10 for δ = 0.08, N = 16 for δ = 0.11 and 0.64, and N = 33 for diffusive samples with δ > 1. The HI method is applied to more than one hundred samples for each ensemble giving more than 4,000 modes.

The modal selectivity for maximal coupling Smode is shown as a function of the modal overlap δ in Fig. 6, and compared to Sran computed for a random incident wavefront. As expected, maximal coupling enhances modal selectivity, but Smode falls below the value expected in the case of isolated modes of unity, even for localized waves. For δ = 0.08, modes overlap and interfere giving Smode = 0.92. Modal selectivity is seen to decrease with increasing δ as a result of greater spectral overlap with a larger number of modes and consequent increased correlation between their MTMs.

## Discussion

We have considered the inverse problem of characterizing and controlling the modes within the sample on the basis of the properties of waves scattered from the sample. We have seen that the road to the control of modes and of wave properties related to modes runs through the MTM which can be obtained from spectra of the TM. We have demonstrated that a single mode can be excited within the sample even in the case of a moderate modal overlap. The incident vector of the MTM of unit rank couples maximally to the mode with an enhancement by a factor N over excitation by a random wavefront. However, as modal overlap increases as a result of greater coupling of the modes to the environment through the boundaries of the sample, the bi-orthogonality of the eigenfunctions leads to increasing modal correlation so that the degree of modal control is reduced.

This investigation of selective excitation of quasi-normal modes in disordered system has been carried out in systems with resonances with high quality factors. The decomposition of the TM into MTMs is more challenging for diffusive waves when the degree of modal overlap is high. However, as Alpeggiani et al. have demonstrated analytically, the scattering matrix can be reconstructed from the far-field properties of the eigenmodes for any degree of overlap26. The modal coefficients depend on all other contributing modes through a coupling matrix, but MTMs are still of unit rank. Future studies will be dedicated to exploring the characteristics of modes and the limits of selectivity in systems with strong modal overlap. This will advance a more comprehensive understanding of the relationship between eigenchannels, time-delay eigenstates and quasi-normal modes of open system.

Selecting specific modes in samples in which the wave is localized would make it possible to deliver energy to specific regions of a sample. In the case of moderate modal overlap in open random systems, the modes extend over the entire sample, even in absorbing samples, and so if a single mode or a small number of modes is selected, it would be possible to deliver energy to the center of the sample. In contrast, when, many modes overlap, the average profile of energy density within the sample is determined by the diffusion equation and is concentrated within an absorption depth of the sample La = (a)1/2, where D is the diffusion coefficient and τa is the absorption time, and particularly the absorption associated with exciting gain in the medium63. As a result, light emitted from excited samples with weakly overlapping modes, in which energy penetrates more deeply into a random medium, is longer lived than in samples in with stronger modal overlap. There is therefore greater opportunity for the emitted photons to stimulate emission before escaping the sample. The lasing threshold will consequently be lowered and narrow-line emission will be observed64. In general the smaller the degree of modal overlap, the more it is possible to deposit energy into a random absorbing medium. Finding the MTM and then pumping from the front of the sample64,65 could thereby lower the threshold of random lasers via coherent feedback.

Modal decomposition of the TM has been demonstrated with microwave radiation but is in principle possible in optics. Measurement of spectrally resolved TM has indeed been reported recently66. Modal selectivity could then be utilized to enhance light-matter interactions in photonic materials67, solar cells68, or biomedical optics69. The use of MTMs is not restricted to random media but can also be applied to structured media such as optical microcavities31, or photonic crystals70.

## Methods

### Experimental setup

The aluminum cavity has length L = 500 mm, width W = 268 mm, and height H = 8 mm and only supports a single waveguide mode in the vertical dimension over the frequency range of the measurements. The antennas are waveguide to coax adapters designed for the Ku band (12–18 GHz). Measurements of individual elements of the TM between two antenna arrays are made with use of electro-mechanical switches and a vector network analyzer. The channels of the switches that are turned off are matched to a 50 Ω load so that the boundary conditions of the system do not change when different emitting source and receiving antennas are used. The spacing between two antennas on the left and right sides of the sample is metallic as seen in Fig. 1a.

The field inside the waveguide is detected by inserting an antenna sequentially into a square grid of holes which are 4 mm in diameter and spaced by 8 mm on a side. The transmission coefficient ea (x, y, ω) is measured between each source antenna and a wire antenna inserted 0.5 mm below the bottom of the 6-mm thick aluminum cover. The penetration depth of the antenna is small enough that it does not distort the field profile in the waveguide. The spatial energy distribution I(x, y) for any incoming vector v is then reconstructed from the coherent superposition of the fields arising from each source antenna, I(x, y) = |Σaea(x, y)va|2.

Once the decomposition into modes of the field inside the sample, $$e_a\left( {x,y,\omega } \right) = {\mathrm{\Sigma }}_ne_a^n\left( {x,y} \right)\varphi _n(\omega )$$, has been obtained, the modal spatial profile is found from an average on incoming channels $$I_n\left( {x,y} \right) = \left\langle {\left| {e_a^n\left( {x,y} \right)} \right|} \right\rangle ^2$$. We also present in Fig. 2f the modal energy density profile for incoming vector v computed from $$W_n\left( {x,y} \right) = \left| {{\mathrm{\Sigma }}_ae_a^n\left( {x,y} \right)v_a} \right|^2$$. For maximal modal coupling v = WLn/||WLn|| and for vanishing coupling v is orthogonal to WLn.

### Harmonic inversion

The modal analysis of the TM is performed using the HI method to obtain the complex modal frequencies $$\omega _m - i{\mathrm{\Gamma }}_m$$ within a range $$\omega _{min} < \omega _m < \omega _{max}$$. Following the algorithm described in ref. 50, we choose a Fourier-type Krylov basis to extract the resonances. The HI method consists of solving a generalized eigenvalue problem applied to two matrices $${\boldsymbol{U}}^{(0)}$$ and $${\boldsymbol{U}}^{(1)}$$ of dimension J×J with $$J = N\prime dt(\omega _{max} - \omega _{min})/(4\pi )$$ which are created from a time signal of length $$N\prime$$ and time step $$dt$$. The generalized eigenvalue problem is $${\boldsymbol{U}}^{(1)}{\boldsymbol{B}}_n = u_n{\boldsymbol{U}}^{(0)}{\boldsymbol{B}}_n$$, where un and Bn are the eigenvalues and the eigenvectors, respectively. The M non-zero eigenvalues yield the M unknown complex frequencies; the associated complex amplitudes can be computed from the eigenvectors.

However, we may miss a few modes by applying HI to a single spectrum of the TM since the modal speckle patterns are random vectors. The strength of a particular mode could thus vanish for a single spectrum when the incoming and outgoing channels correspond to two nodes of this mode. We therefore include several spectra from the TM in the generalized eigenvalue problem. We first perform an inverse Fourier transform of nine field transmission spectra randomly chosen from the N² spectra of the TM. The time window of the inverse Fourier transform is taken to be the time domain for which the signals are above the noise level. We then create 9 matrices $${\boldsymbol{U}}_i^{(0)}$$ and $${\boldsymbol{U}}_i^{(1)}$$ from each time signals si(t). Those 9 matrices of dimensions J×J are then concatenated into two matrices of dimension 3J×3J, $${\boldsymbol{U}}_T^{(0)}$$ and $${\boldsymbol{U}}_T^{(1)}$$. Because we are seeking for the same set of resonance time signals si(t), we solve the generalized eigenvalue problem $${\boldsymbol{U}}_T^{(1)}{\boldsymbol{B}}_n = u_n{\boldsymbol{U}}_T^{(0)}{\boldsymbol{B}}_n$$. We then extract the resonances $$\tilde \omega _n$$ from the significant eigenvalues un. However, this does not directly provide the associated modal transmission coefficients $$t_{ba}^n$$ which are the elements of the MTMs. These are then obtained from a simple inverse problem by fitting in the time domain each transmission coefficient of the TM using Eq. (4) of the main text: $$t_{ba}\left( \omega \right) = {\mathrm{\Sigma }}_n\frac{{t_{ba}^n}}{{\omega - \omega _n + i{\mathrm{\Gamma }}_n/2}}$$.

### Recursive Green’s function simulations

The Green’s functions between points at the input and output surfaces of a waveguide are obtained by solving the two-dimensional wave equation $$\nabla ^2\psi \left( {x,y,\omega } \right) + k_0^2{\it{\epsilon }}\left( {x,y} \right)\psi \left( {x,y,\omega } \right) = 0$$ using the recursive Green’s function method. The random dielectric permittivity $${\it{\epsilon }}(x,y)$$ is drawn from a rectangular distribution centered on unity. The field transmission coefficients between each of the incoming modes a and outgoing modes b at frequency ω, tba(ω), are then calculated using the projection of the Green’s function onto the modes of the empty waveguide. Spectra of the TM is then obtained by computing the TM for each frequency over a frequency range which is much larger than the typical linewidth of the resonances.