## 2 Methods
### Distributed Dielectric Constant-Based RCWA
According to Floquet theorem, the following conditions should be satisfied,  
\[\mathbf{k}_{\rho,i}=k_{xi}\mathbf{\hat{x}}+k_{yi}\mathbf{\hat{y}}+k_{qz,i} \mathbf{\hat{z}};\ \ \ \rho=R,T, \tag{7}\]  
\[k_{xi}=k_{inc,x}-i\frac{2\pi}{\Lambda}, \tag{8}\]  
\[k_{yi}=k_{inc,y}, \tag{9}\]  
where \(i\) is the diffraction order, \(\mathbf{k}_{\rho z,i}\) is \(z\) component of the wave vector. In the grating region (\(0<z<H\)), the electric field \(\mathbf{E}_{l}\) and magnetic field \(\mathbf{H}_{l}\) can be written as Floquet-Fourier series as  
\[ \begin{array}{rl}\mathbf{E}_{l}&=\sum\limits_{i}S_{l,i}(z)\exp\left[-j \left(k_{xi}x+k_{yi}y\right)\right]\\ &=\sum\limits_{i}\left\{S_{l,xi}(z)\hat{x}+S_{l,yi}(z)\hat{y}+S_{l,zi}(z)\hat{ z}\right\}\exp\left[-j\left(k_{xi}x+k_{yi}y\right)\right]\end{array} , \tag{10}\]  
\[ \begin{array}{rl}\mathbf{H}_{l}=&\left(\frac{\varepsilon_{0}}{\mu_{0}} \right)^{\frac{1}{2}}\sum\limits_{i}U_{l,i}(z)\exp\left[-j\left(k_{xi}x+k_{yi} y\right)\right]\\ &=\left(\frac{\varepsilon_{0}}{\mu_{0}}\right)^{\frac{1}{2}}\sum\limits_{i} \left\{U_{l,xi}(z)\hat{x}+U_{l,yi}(z)\hat{y}+U_{l,zi}(z)\hat{z}\right\}\exp \left[-j\left(k_{xi}x+k_{yi}y\right)\right]\end{array} , \tag{11}\]  
where \(\mathbf{S}_{l,i}(z)\) and \(\mathbf{U}_{l,i}(z)\) are the amplitudes of the electric and magnetic fields of the \(l\)-th layer in the grating region. In the grating region, the electric and magnetic fields satisfy the Maxwell equations  
\[\
abla\times\mathbf{E}_{l}=-jk_{0}\mu\mathbf{H}_{l}^{\prime}, \tag{12}\]  
\[\
abla\times\mathbf{H}_{l}^{\prime}=jk_{0}\varepsilon(x)\mathbf{E}_{l}, \tag{13}\]  
where \(k_{0}\) is the wave number in the free space, given by \(k_{0}=2\pi/\lambda_{0}\) and \(\lambda_{0}\) is the wavelength of the incident wave in free space; \(\varepsilon_{0}\) and \(\mu_{0}\) are the electric permittivity and magnetic permeability in the free space and  
\[\mathbf{H}_{l}^{\prime}=\sqrt{\mu_{0}/\varepsilon_{0}}\mathbf{H}_{l}. \tag{14}\]Then submit Equations (10) and (11) to Maxwell equations Equations (12) and (13), the coupled wave equation in matrix form can be achieved as  
\[\frac{\partial}{\partial z}\left[ \begin{array}{c}\mathbf{S}_{l,x}\\ \mathbf{S}_{l,y}\\ \mathbf{U}_{l,x}\\ \mathbf{U}_{l,y}\end{array} \right]=jk_{0}\left[ \begin{array}{cccc}0&0& \mathbf{K}_{x}\mathbf{E}_{l-tp}^{-1}\mathbf{K}_{y}&\mathbf{I}-\mathbf{K}_{y} \mathbf{E}_{l-tp}^{-1}\mathbf{K}_{y}\\ 0&0&\mathbf{K}_{x}\mathbf{E}_{l-tp}^{-1}\mathbf{K}_{x}-\mathbf{I}&-\mathbf{K}_ {x}\mathbf{E}_{l-tp}^{-1}\mathbf{K}_{y}\\ \mathbf{K}_{x}\mathbf{K}_{y}&\mathbf{F}_{l}^{-1}-\mathbf{K}_{y}^{2}&0&0\\ \mathbf{K}_{x}^{2}-\mathbf{E}_{l-tp}&-\mathbf{K}_{y}\mathbf{K}_{x}&0&0\end{array}  \right]\left[ \begin{array}{c}\mathbf{S}_{l,x}\\ \mathbf{S}_{l,y}\\ \mathbf{U}_{l,x}\\ \mathbf{U}_{l,y}\end{array} \right], \tag{15}\]  
where \(\mathbf{K}_{x}\) and \(\mathbf{K}_{y}\) are diagonal matrices, whose diagonal elements are \(k_{xi}/k_{0}\) and \(k_{yi}/k_{0}\); \(\mathbf{I}\) is identity matrix with the same dimension of \(\mathbf{K}\). \(\mathbf{E}_{l-tp}\) is the Toeplitz matrix consists of the Fourier coefficients of the relative dielectric constant at the \(l\)-th layer. \(\mathbf{F}_{l}\) is the Toeplitz matrix corresponding to the reciprocal of the relative dielectric constant. Combined with the boundary conditions and enhanced transmit matrix, the distribution of the electric field \(\mathbf{R}\) and magnetic field \(\mathbf{T}\) can be achieved by solving Equation (15). Further, the reflected and transmit electric fields of s- and p- polarized light can be achieved.