## 3 Problem Formulation and Solution
\begin{split}& F_{ij}(\mathbf{w},\mathbf{\theta};\mathbf{w}^{[ \ell]},\mathbf{\theta}^{[\ell]})=f_{ij}(\mathbf{w}^{[\ell]},\mathbf{\theta}^{ [\ell]})+\frac{2\operatorname{Re}\left[\left(\mathbf{w}^{[\ell]}\right)^{H} \mathbf{H}_{ij}(\mathbf{\theta}^{[\ell]})\mathbf{w}-\left(\mathbf{w}^{[\ell] }\right)^{H}\mathbf{H}_{ij}(\mathbf{\theta}^{[\ell]})\mathbf{w}^{[\ell]} \right]}{\left(\mathbf{w}^{[\ell]}\right)^{H}\mathbf{H}_{ij}(\mathbf{\theta}^ {[\ell]})\mathbf{w}^{[\ell]}+\sigma^{2}}-\\ &\frac{2\operatorname{Re}\left[\left(\mathbf{w}^{[\ell]}\right)^{H }\mathbf{\tilde{H}}_{ij}(\mathbf{\theta}^{[\ell]})\mathbf{w}-\left(\mathbf{w} ^{[\ell]}\right)^{H}\mathbf{\tilde{H}}_{ij}(\mathbf{\theta}^{[\ell]})\mathbf{ w}^{[\ell]}\right]}{\left(\mathbf{w}^{[\ell]}\right)^{H}\mathbf{\tilde{H}}_{ij}( \mathbf{\theta}^{[\ell]})\mathbf{w}^{[\ell]}+\sigma^{2}}+\frac{2\operatorname {Re}\left[\left(\mathbf{\theta}_{j}^{[\ell]}\right)^{H}\mathbf{\Omega}( \mathbf{w}^{[\ell]})\mathbf{\theta}_{j}-\left(\mathbf{\theta}_{j}^{[\ell]} \right)^{H}\mathbf{\Omega}(\mathbf{w}^{[\ell]})\mathbf{\theta}_{j}^{[\ell]} \right]}{\left(\mathbf{\theta}_{j}^{[\ell]}\right)^{H}\mathbf{\Omega}( \mathbf{w}^{[\ell]})\mathbf{\theta}_{j}^{[\ell]}+\sigma^{2}}-\\ &\frac{2\operatorname{Re}\left[\left(\mathbf{\theta}_{j}^{[\ell]} \right)^{H}\mathbf{\tilde{\Omega}}(\mathbf{w}^{[\ell]})\mathbf{\theta}_{j}- \left(\mathbf{\theta}_{j}^{[\ell]}\right)^{H}\mathbf{\tilde{\Omega}}(\mathbf{w }^{[\ell]})\mathbf{\theta}_{j}^{[\ell]}\right]}{\left(\mathbf{\theta}_{j}^{[ \ell]}\right)^{H}\mathbf{\tilde{\Omega}}(\mathbf{w}^{[\ell]})\mathbf{\theta}_{j }^{[\ell]}+\sigma^{2}}-2\xi_{ij}\operatorname{Re}\left[\left(\mathbf{w}^{[ \ell]}\right)^{H}\mathbf{w}-||\mathbf{w}^{[\ell]}||^{2}+\left(\mathbf{\theta}^{[ \ell]}\right)^{H}\mathbf{\theta}-||\mathbf{\theta}^{[\ell]}||^{2}\right]\\ &\qquad i\in\mathcal{M},\ j_{1},j_{2}\in\mathcal{N}.\end{split}  \tag{29}\]  
Until now, the optimization subproblem (11) has been converted as  
\[\min_{\mathbf{w},\mathbf{\theta},\mathbf{R}}\ \sum_{k=1}^{K}\sum_{j=1}^{N}\frac{p_{k}q_{ij}z_{ \mathrm{ik}}^{*}L_{k}}{\bar{R}_{ij}}, \tag{30a}\] \[ \begin{split}\textbf{s.t.}&\quad\sum_{j=1}^{N}|| \mathbf{w}_{ij}||^{2}\leq P,\forall i\in\mathcal{M},\\ &\frac{2\theta_{ij}^{[\ell]}-\theta_{ij}}{\left(\theta_{ij}^{[\ell] }\right)^{2}}\geq\sqrt{\left(x_{i}-x_{jk}\right)^{2}+\left(y_{i}-y_{jk}\right)^{2 }+H^{2}},\forall i\in\mathcal{M},\forall j\in\mathcal{N},\end{split} \] (30c) \[\bar{R}_{ij}\leq F_{ij}(\mathbf{w},\mathbf{\theta};\mathbf{w}^{[\ell]}, \mathbf{\theta}^{[\ell]})-\xi_{ij}(||\mathbf{w}||^{2}+||\mathbf{\theta}||^{2}), \forall i\in\mathcal{M},\forall j\in\mathcal{N}. \tag{30d}\]  
Problem (30) is a convex optimization problem, and it is a transformation of problem (11), which corresponds to the optimization of UAV location and beamforming variables with caching variable fixed. Then, we oppositely consider optimizing a caching variable with the UAV location and beamforming variables fixed. UAV caching optimization subproblem is formulated as \[\min_{\mathbf{z}} \sum_{k=1}^{K}\sum_{j=1}^{N}p_{k}\left(\frac{z_{0k}L_{k}}{R_{0}}+ \sum_{i=1}^{M}q_{ij}\frac{z_{ik}L_{k}}{R_{ij}^{*}(\mathbf{w}_{ij},\mathbf{\theta }_{ij})}\right), \tag{31a}\] \[\textbf{s.t.} \sum_{k=1}^{K}z_{ik}L_{ik}\leq L_{\max},\forall i\in\mathcal{M},\] (31b) \[\sum_{i=0}^{M}z_{ik}\geq 1,\forall k\in\mathcal{K},\] (31c) \[0\leq z_{ik},z_{0k}\leq 1,\,\forall i\in\mathcal{M},\,\forall k \in\mathcal{K}. \tag{31d}\]  
It is obvious that problem (31) is a linear programming problem. Algorithm 1 outlines the DC-based method to solve (10). ```
0:
1. Set user positions \(\mathbf{u}\) and connection relationship \(q_{ij}\). 2. Set the iteration number \(\ell=0\), and initialize start values of \(\mathbf{w}^{[\ell]}\), \(\mathbf{v}^{[\ell]}\) and \(\mathbf{z}^{[\ell]}\). Calculate \(\boldsymbol{\theta}^{[\ell]}\) from \(\mathbf{v}^{[\ell]}\) and \(\mathbf{u}\). Repeat:
3. Solve problem (30) to obtain the optimal solutions \(\mathbf{w}^{*}\), \(\mathbf{v}^{*}\).