# Maximization of Average Achievable Rate for NOMA-UAV Dual-User Communication System Assisted by RIS
## 4 Proposed Algorithm
### UAV Trajectory Optimization  
By fixing the RIS phase shift \(\Phi_{1,2}\) and the UAV power \(P_{1,2}\), there is only one variable \(Q\). Then we can get  
\[{\rm{P}}(2): \max_{Q}\frac{1}{K}\sum\limits_{k=1}^{K}(R_{1}[k]+R_{2}[k])\] \[s.t. \left\|q[k+1]-q[k]\right\|^{2}\leq D^{2},k\in\{1,2,...,K-1\},\] \[\left\|q[K]-q_{e}\right\|^{2}\leq D^{2},\] \[q[1]=q_{s},\] \[H_{2}[k]\geq H_{1}[k],\]  
both \(R_{1}[k]\) and \(R_{2}[k]\) are nonconvex, we will deal with them separately and transform them into convex functions. Expand Formulas (23) and (24) to get  
\[H_{1}^{\prime}[k]=\frac{A}{d_{itg_{1}}^{\rm{a}}[k]}+\frac{B}{d_{itg_{1}}^{\rm{ a}}[k]d_{it}^{\frac{\delta}{2}}[k]}+\frac{C}{d_{it}^{\rm{a}}[k]}, \tag{25}\]  
\[H_{2}^{\prime}[k]=\frac{D}{d_{itg_{2}}^{\rm{a}}[k]}+\frac{E}{d_{itg_{2}}^{\rm{ a}}[k]d_{it}^{\frac{\delta}{2}}[k]}+\frac{F}{d_{it}^{\rm{a}}[k]}, \tag{26}\]  
where \(A=c_{0}\left|\widetilde{h}_{1}\right|^{2}\), \(B=2c_{0}\sum\limits_{m=0}^{M_{x}-1}\sum\limits_{n=0}^{M_{x}-1}\left|h_{{\rm{rg }}_{1},(m,n)}\right|_{C}=c_{0}\sum\limits_{m=0}^{M_{x}-1}\sum\limits_{n=0}^{M_ {x}-1}\left|h_{{\rm{rg}}_{1},(m,n)}\right|^{2}\), \(D=c_{0}\left|\widetilde{h}_{2}\right|^{2}\), \(E=2c_{0}\sum\limits_{m=0}^{M_{x}-1}\sum\limits_{n=0}^{M_{x}-1}\left|h_{{\rm{rg} }_{2},(m,n)}\right|^{2}\). In order to relax the constraints, we introduce the relaxation variables \(\mathbf{u_{1}}\triangleq\{u_{1}[k]\},k\in\{1,2,...,K\}\), \(\mathbf{u_{2}}\triangleq\{u_{2}[k]\}\)\(k\in\{1,2,...,K\}\) and \(\mathbf{v_{1}}\triangleq\{v_{1}[k]\},k\in\{1,2,...,K\}\) to strike a balance between the constraint strictness and the problem's solvability. \[v_{1}[k]\geq\sqrt{(Z_{UAV}-Z_{RIS})^{2}+\left\|q[k]-L_{R}\right\|^{2}}, \tag{27}\]  
\[u_{1}[k]\geq\sqrt{Z_{UAV}^{2}+\left\|q[k]-L_{G1}\right\|^{2}}, \tag{28}\]  
\[u_{2}[k]\geq\sqrt{Z_{UAV}^{2}+\left\|q[k]-L_{G2}\right\|^{2}}, \tag{29}\]  
Substituting Formulas (27)-(29) into Formulas (25) and (26), we can get  
\[s.t. \left\|q[k+1]-q[k]\right\|^{2}\leq D^{2},k\in\{1,2,...,K-1\},\]0  
\[s.t. \left\|q[k+1]-q[k]\right\|^{2}\leq D^{2},k\in\{1,2,...,K-1\},\]1  
\[s.t. \left\|q[k+1]-q[k]\right\|^{2}\leq D^{2},k\in\{1,2,...,K-1\},\]2  
\[s.t. \left\|q[k+1]-q[k]\right\|^{2}\leq D^{2},k\in\{1,2,...,K-1\},\]3  
Taylor approximation is a technique used to approximate a function by utilizing its derivative information at a specific point. Let \(f(x)\) have all derivatives of order at a point \(x_{0}\), then the Taylor expansion of \(f(x)\) at that point is: \(f(x)=f(x)+f^{\prime}(x_{0})\)\((x-x_{0})+\frac{f^{\prime\prime}(x_{0})}{2!}(x-x_{0})^{2}+\cdots+\frac{f^{(n)}(x_{0})}{n! }( x-x_{0})^{n}\). This expansion approximates the function value by progressively incorporating higher-order derivatives. In practical applications, the Taylor series is typically truncated to obtain an approximation. The accuracy of the Taylor expansion relies on the local linearization assumption and the differentiability of the function. In this paper, each iteration requires calculating only the gradient at the current point, with the expansion truncated to a single term. Next, we obtain the first-order Taylor series of \(H_{1}^{\prime}[k],H_{2}^{\prime}[k],R_{1}^{\prime}[k],R_{2}^{\prime}[k],u_{1} ^{2}[k],u_{2}^{2}[k]\) and \(v_{1}^{2}[k]\) for fixed points \(\mathbf{u_{1}^{(0)}}=\{u_{1}^{(0)}[k]\}_{k=1}^{K},\mathbf{u_{2}^{(0)}}=\{u_{2}^{(0)}[k ]\}_{k=1}^{K}\)and \(\mathbf{v_{1}^{(0)}}=\{v_{1}^{(0)}[k]\}_{k=1}^{K}\), respectively. That is, we calculate the first-order partial derivatives of \(u_{1}[k],u_{2}[k]\) and \(v_{1}[k]\) for (32) and (33). Then we can get  
\[ \begin{split} R_{1}^{\prime}[k]\geq\log_{2}A_{0}[k]+& \frac{B_{0}[k]}{A_{0}[k]\ln 2}(u_{1}[k]-u_{1}^{(0)}[k])\\ &+\frac{C_{0}[k]}{A_{0}[k]\ln 2}(v_{1}[k]-v_{1}^{(0)}[k]),\end{split}  \tag{34}\]  
\[ \begin{split}-u_{1}^{2}[k]\leq(u_{1}^{(0)})^{2}[k]-2u_{1}^{(0)}u_{ 1}[k],\end{split}  \tag{35}\]  
\[ \begin{split}-u_{2}^{2}[k]\leq(u_{2}^{(0)})^{2}[k]-2u_{2}^{(0)}u_{ 2}[k],\end{split}  \tag{36}\]  
\[