# Numerical Estimation of Bending in Holographic Volume Gratings by Means of RCWA and Deep Learning
## 2 Theory
### Rigorous Coupled Wave Analysis--Shooting Method Approach
\begin{array}{ccccc}\mathbf{S}_{y}(0)&=&[\ldots&R_{-1}&1+R_{0}&R_{+1}& \ldots]^{T},\\ \mathbf{S}_{y}(d)&=&\begin{bmatrix}\ldots&T_{-1}e^{\beta^{(i-1)}_{x}d}&T_{0}e ^{\beta^{(0)}_{x}d}&T_{+1}e^{\beta^{(i+1)}_{x}d}&\ldots\end{bmatrix}^{T},\\ \mathbf{U}_{x}(0)&=&\frac{-j}{k_{0}}\Big{[}\ldots&-k^{(i-1)}_{lx}R_{-1}&k^{(0) }_{lx}(1-R_{0})&-k^{(i+1)}_{lx}R_{+1}&\ldots\Big{]}^{T},\\ \mathbf{U}_{x}(d)&=&\frac{-j}{k_{0}}\Big{[}\ldots&k^{(-1)}_{lx}-1&k^{(i-1)}_{lx}R _{+1}&k^{(0)}_{lx}e^{\beta^{(i)}_{x}d}&k^{(i+1)}_{lx}R^{(i+1)}_{lx}R^{(i+1) }_{lx}&\ldots\Big{]}^{T}.\end{array}  \tag{7}\]  
Indeed, with \([k_{\mathcal{L},z}]\) being the diagonal matrices of the \(z\)-components of the wave vectors in the outer media, we can rewrite the last two in terms of the first ones:  
\[ \begin{bmatrix}\mathbf{U}_{x}(0)=\frac{j}{k_{0}}\mathbf{k}_{I,z}\big{(} \mathbf{S}_{y}(0)-2[\delta_{0}]_{i}\big{)}\\ \mathbf{U}_{x}(d)=\frac{-j}{k_{0}}\mathbf{k}_{I,z}\mathbf{S}_{y}(d)\end{bmatrix} . \tag{8}\]Similarly, following [34], if we now define the reflectance and transmittance vectors, \(R=(R_{i})i\) and \(T=\left(T_{j}\right)j\), we can express the boundary conditions in an alternative manner:  
\[ \begin{bmatrix}\mathbf{S}_{y}(0)&=&\mathbf{R}+\left[\delta_{i0}\right]_{i}& \mathbf{S}_{y}(d)&=&\mathbf{T}e^{jk_{\mathcal{L}}d}\\ \mathbf{U}_{x}(0)&=&\frac{-j}{k_{0}}\mathbf{k}_{I,z}(\left[\delta_{i0}\right]_ {i}-R)&\mathbf{U}_{x}(d)&=&\frac{-j}{k_{0}}\mathbf{k}_{I,z}Te^{jk_{\mathcal{L }}d}\end{bmatrix} . \tag{9}\]  
We will modify the problem, transforming it to an Initial Value Problem (IVP), with the initial conditions given by  
\[\widehat{S}_{y}(z_{0};p)=\left(\delta_{ip}\right)_{i}= \begin{bmatrix}\dots& \dots&0&1&0&\dots\end{bmatrix} ^{T} \tag{10a}\] \[\frac{d}{dz}\widehat{S}_{y}(z_{0};p)=-j\left(k_{\mathcal{L},z}^{(i)}\delta_{ip }\right)_{i}= \begin{bmatrix}\dots&\dots&0&-jk_{\mathcal{L},z}^{(p)}&0&\dots \end{bmatrix} ^{T} \tag{10b}\]  
which, in turn, define those of \(\widehat{U}_{x}(z_{0};p)\) and its derivative through Equation (8):  
\[\widehat{U}_{x}(z_{0};p)=\frac{-j}{k_{0}} \begin{bmatrix}\dots&\dots&0&k_{II,z} ^{(p)}&0&\dots\end{bmatrix} ^{T}.\]  
The general solution will then be a linear combination of the particular solutions, with some constants \(\{a_{p},b_{p}\}_{p\in\{-N,\dots,N\}}\) to be determined:  
\[S_{y}(z)=\sum_{p=-N}^{N}a_{p}\widehat{S}_{y}(z;p), \tag{11a}\] \[U_{x}(z)=\sum_{p=-N}^{N}b_{p}\widehat{U}_{x}(z;p). \tag{11b}\]  
By construction, Equation (11) at \(z=z_{0}\) becomes  
\[ \begin{bmatrix}S_{y}^{(i)}(z_{0})=\sum_{p=-N}^{N}a_{p}\widehat{S}_{y}^{(i)}(z_ {0};p)=\sum_{p=-N}^{N}a_{p}\delta_{ip}=a_{i},\\ U_{x}^{(i)}(z_{0})=\sum_{p=-N}^{N}b_{p}\widehat{U}_{x}^{(i)}(z_{0};p)=-j\sum_{ p=-N}^{N}b_{p}\frac{k_{II,z}^{(i)}}{k_{0}}\delta_{ip}=-j\frac{k_{II,z}^{(i)}}{k_{0}}b_{ i},\end{bmatrix} . \tag{12}\]  
This helps us to rewrite the boundary conditions by considering \(z_{0}=d\). \[\blacksquare z=d \tag{13a}\] \[\delta_{i0}+R_{i}=\sum_{p}a_{p}\widehat{S}_{y}^{(i)}(0;p) T_{i}=a_{i}e^{-jk_{\mathcal{L}}^{(i)}d}\] (13b) \[k_{I,z}^{(i)}(\delta_{i0}-R_{i})=jk_{0}\sum_{p}b_{p}\widehat{U}_{x}^{(i)}(0;p) T_{i}=b_{i}e^{-jk_{\mathcal{L}}^{(i)}d} \tag{13c}\]  
In the previous relationships, there is a total of \(4N\) equations for the four sets of \(N\) unknowns: \(a_{p}\), \(b_{p}\), \(R_{i}\), and \(T_{j}\). Proceeding as we did for the previous formalism, we only need to choose the boundary condition at \(z=0\) with \(a_{i}=b_{i}\):  
\[2k_{I,z}^{(i)}\delta_{i0}=\sum_{p}\Bigl{[}k_{I,z}^{(i)}\widehat{S}_{y}^{(i)}(0 ;p)+jk_{0}\widehat{U}_{x}^{(i)}(0;p)\Bigr{]}a_{p}. \tag{14}\]This is done to construct a system of equations for the constants \(a_{p}\) in the form \(\sum_{p}M_{ip}a_{p}=n_{i}\), where  
\[\left. \begin{array}{rcl}M_{ip}&=&k_{l,z}^{(i)}\widehat{S}_{y}^{(i)}(0;p)+jk_{0} \widehat{U}_{x}^{(i)}(0;p)\\ n_{i}&=&2k_{l,z}^{(i)}\delta_{i0}\end{array} \right\}a=M^{-1}n \tag{15}\]  
are known.