## 4 Combined Optimization of UAV Location, User Pairing, and Power Allocation
### UAV Transmission Power Optimization
\begin{array}{l}\max\limits_{p,t}t\\ s.t.\sum_{m=1}^{M}p_{m}\leq P_{\max}\\ p\geq 0\\ R_{m}^{*}(p_{m})\geq t,\forall m\end{array}  \tag{32}\]  
where \(R_{m}^{*}(p_{m})\geq t\) is equivalent to \(p_{m}\geq(a^{t}\Gamma_{2,m}+\Gamma_{1,m})(a^{t}-1)/\left(\Gamma_{1,m}\Gamma_{2,m}\right)\), \(a=2^{\frac{1}{\Gamma_{c}}}\), then the Lagrange form of the optimization problem (32) is formulated as:  
\[L=t+\sum_{m=1}^{M}\mu_{m}[p_{m}-\frac{(a^{t}\Gamma_{2,m}+\Gamma_{1,m})(a^{t}-1 )}{\Gamma_{1,m}\Gamma_{2,m}}]-\lambda(\sum_{m=1}^{M}p_{m}-P_{\max}) \tag{33}\]  
where \(\{\mu_{m}\}_{m=1}^{M}\) and \(\lambda\) are Lagrange multipliers. Since the optimization problem (32) is a convex optimization problem, the optimization problem can be solved using the KKT (Karush-Kuhn-Tucker) condition as follows:  
\[\frac{\partial L}{\partial p_{m}}=\mu_{m}-\lambda=0 \tag{34}\]  
\[\frac{\partial L}{\partial t}=1-a^{2t}\sum_{m=1}^{M}\frac{2\mu_{m}\ln a}{ \Gamma_{1,m}}+a^{t}(\sum_{m=1}^{M}\frac{\mu_{m}\ln a}{\Gamma_{1,m}}-\sum_{m=1 }^{M}\frac{\mu_{m}\ln a}{\Gamma_{2,m}})=0 \tag{35}\]  
\[ \begin{array}{l}\sum\limits_{m=1}^{M}\mu_{m}[p_{m}-\frac{(a^{t}\Gamma_{2,m}+ \Gamma_{1,m})(a^{t}-1)}{\Gamma_{1,m}\Gamma_{2,m}}]=0,\\ \lambda(\sum\limits_{m=1}^{M}p_{m}-P_{\max})=0.\end{array}  \tag{36}\]  
Given (34) and (35), \(\mu_{m}=\lambda\
eq 0\), (35) can be expressed as \(C_{1}a^{2t}-C_{2}a^{t}-1=0\). Utilizing the root-finding formula to solve the quadratic equation with respect to variable \(a^{t}\) yields \(a^{t}=\frac{C_{2}}{2C_{1}}+\sqrt{(\frac{C_{2}}{2C_{1}})^{2}+\frac{1}{C_{1}}}= Z(\lambda)\), where \(C_{1}=\sum\limits_{m=1}^{M}\frac{2\lambda\ln a}{\Gamma_{2,m}}\) and \(C_{2}=\lambda\ln a\sum\limits_{m=1}^{M}\left(\frac{1}{\Gamma_{1,m}}-\frac{1}{ \Gamma_{2,m}}\right)\). Substituting \(a^{t}\) into (36) yields the optimal solution \(p_{m}^{*}\) for power allocation across all channels, denoted:  
\[p_{m}^{*}=\frac{(Z(\lambda)\Gamma_{2,m}+\Gamma_{1,m})(Z(\lambda)-1)}{\Gamma_{ 1,m}\Gamma_{2,m}},\forall m \tag{37}\]  
where \(Z(\lambda)\triangleq X+X^{2}+\frac{B_{c}}{2\lambda\sum_{m=1}^{M}1/\Gamma_{1, m}}\), \(X\triangleq\frac{\sum_{m=1}^{M}\left(\Gamma_{2,m}-\Gamma_{1,m}\right)/\left( \Gamma_{1,m}\Gamma_{2,m}\right)}{4\sum_{m=1}^{M}1/\Gamma_{1,m}}\), and \(\lambda\) are the Lagrange multipliers that make the optimal solution of the power allocated to each channel satisfy \(\sum_{m=1}^{M}p_{m}^{*}=P_{trans}\). Substituting (37) into (28)-(30), the user-optimal power allocation and optimal transmission rate for all channels are obtained as:  
\[p_{1,m}^{*}=\frac{-(\Gamma_{1,m}+\Gamma_{2,m})+\sqrt{\left(\Gamma_{1,m}+ \Gamma_{2,m}\right)^{2}+4\Gamma_{1,m}\Gamma_{2,m}^{2}p_{m}^{*}}}{2\Gamma_{1,m} \Gamma_{2,m}},\forall m \tag{38}\]  
\[p_{2,m}^{*}=p_{m}^{*}-\frac{-(\Gamma_{1,m}+\Gamma_{2,m})+\sqrt{\left(\Gamma_{ 1,m}+\Gamma_{2,m}\right)^{2}+4\Gamma_{1,m}\Gamma_{2,m}^{2}p_{m}^{*}}}{2\Gamma_ {1,m}\Gamma_{2,m}},\forall m \tag{39}\]\[R_{m}^{*}\triangleq B_{c}\log\left(\frac{\Gamma_{2,m}-\Gamma_{1,m}+\sqrt{\left( \Gamma_{1,m}+\Gamma_{2,m}\right)^{2}+4\Gamma_{1,m}\Gamma_{2,m}^{2}p_{m}^{*}}}{2 \Gamma_{2,m}}\right),\forall m \tag{40}\]