# Optimization of Phase-Only Computer-Generated Holograms Based on the Gradient Descent Method
## 2 Theory
### Determination of Step Length Coefficient  
Next, the determination of the step length coefficient is explained. In this study, the coefficient is determined using the estimated MSE of the next iteration.  
The MSE of the next iteration is estimated as below:  
\[E^{{}^{\prime}}=\sum_{m}^{M}\sum_{n}^{N}\frac{\left[\hat{I}_{mn}-\left(I_{mn}+ \Delta I_{mn}\right)\right]^{2}}{MN} \tag{15}\]  
where \(\Delta I_{mn}\) is the estimated change of the intensity distribution for the phase change \(\Delta\theta_{pq}\). The step length coefficient \(\gamma\) is determined so that \(E^{{}^{\prime}}\) becomes minimum, i.e., \(\frac{\partial E^{{}^{\prime}}}{\partial\gamma}\).  
\[E^{{}^{\prime}}=\frac{1}{MN}\sum_{m}^{M}\sum_{n}^{N}\left[\left(\hat{I}_{mn}-a _{mn}^{2}\right)-\Delta I_{mn}\right]^{2} \tag{16}\]  
\[\frac{\partial E^{{}^{\prime}}}{\partial\gamma}=\frac{2}{MN}\sum_{m}^{M}\sum_ {n}^{N}\left[\left(\hat{I}_{mn}-a_{mn}^{2}\right)-\Delta I_{mn}\right]\left(- \frac{\partial\Delta I_{mn}}{\partial\gamma}\right)=0 \tag{17}\]  
We can adopt the first order approximation to calculate \(\Delta I_{mn}\)  
\[\Delta I_{mn}\approx\sum_{p}^{P}\sum_{q}^{Q}\frac{\partial I_{mn}}{\partial \theta_{pq}}\Delta\theta_{pq} \tag{18}\]  
Substrate (10) into (18)  
\[\begin{split}\Delta I_{mn}&\approx\sum_{p}^{P}\sum_ {q}^{Q}2a_{mn}\Delta\theta_{pq}\sin\left[\phi_{mn}-\theta_{pq}+2\pi\left( \frac{mp}{P}+\frac{nq}{Q}\right)\right]\\ &\approx 2\text{Im}\left\{a_{mn}e^{j\phi_{mn}}\sum_{p}^{P}\sum_{q}^{Q} \Delta\theta_{pq}e^{-j\left[\theta_{pq}-2\pi\left(\frac{mp}{P}+\frac{nq}{Q} \right)\right]}\right\}\end{split} \tag{19}\]  
Substrate (2) into (19)  
\[\Delta I_{mn}\approx 2\text{Im}\left\{a_{mn}e^{j\phi_{mn}}\left[\mathcal{F} \left(\Delta\theta_{pq}e^{j\theta_{pq}}\right)\right]^{*}\right\}=2\gamma \text{Im}\left\{a_{mn}e^{j\phi_{mn}}\left[\mathcal{F}\left(-\frac{\partial E }{\partial\theta_{pq}}e^{j\theta_{pq}}\right)\right]^{*}\right\} \tag{20}\]  
Substrate (20) into (17).  
\[\begin{split}\frac{2}{MN}\sum_{m}^{M}\sum_{n}^{N}\left[\left( \hat{I}_{mn}-a_{mn}^{2}\right)-2\gamma\text{Im}\left\{a_{mn}e^{j\phi_{mn}} \left[\mathcal{F}\left(-\frac{\partial E}{\partial\theta_{pq}}e^{j\theta_{pq}} \right)\right]^{*}\right\}\right]\left[-2\text{Im}\left\{a_{mn}e^{j\phi_{mn} }\left[\mathcal{F}\left(-\frac{\partial E}{\partial\theta_{pq}}e^{j\theta_{ pq}}\right)\right]^{*}\right\}\right]=0\end{split} \tag{21}\]Finally, \(\gamma\) is determined as follows:  
\[\gamma=\frac{\sum\limits_{m}^{M}\sum\limits_{n}^{N}(\hat{l}_{mn}-a_{mn}^{2}) \text{Im}\left\{a_{nm}e^{j\phi_{mn}}\left[\mathcal{F}\left(-\frac{\partial E}{ \partial\theta_{pq}}e^{j\theta_{pq}}\right)\right]^{*}\right\}}{2\sum\limits_{m }^{M}\sum\limits_{n}^{N}\left[\text{Im}\left\{a_{mn}e^{j\phi_{mn}}\left[ \mathcal{F}\left(-\frac{\partial E}{\partial\theta_{pq}}e^{j\theta_{pq}} \right)\right]^{*}\right\}\right]^{2}} \tag{22}\]  
The proposed technique calculates the step length coefficient for each iteration by following the above equation.  
The proposed algorithm can be extended for applications in the Fresnel regime for the optimization of the phase-only holograms. The MSE function used in this study can then be replaced by other error MSE functions.