## 3 The RIS-Aided UAV Secure Transmission
### BS's Beamforming Strategy  
In this paper, we evaluate the performance of the proposed algorithm against the Eavesdropping elimination method and the situation without beamforming through simulation. In our proposed algorithm, the beamforming of BS will track the channel state to enhance the signal power at UAV as much as possible. There are two strategies in beamforming vector optimization.  
(1) _Eavesdropping elimination method_  
The eavesdropping elimination method refers to the utilization of the orthogonality of the transmit signal and the eavesdropping channel to zero out the received signal at the EVE. To simplify the expression of the formulation, we set \(\overline{\mathbf{h}}=\mathbf{h}^{H}[n]\mathbf{\Phi}\mathbf{W}[n]\). For **P1**, the beamforming vector can be acquired as  
\[\begin{split}\underset{\mathbf{w}[n]}{\text{max}}\Big{\|}\mathbf{ w}^{\text{H}}[n]\mathbf{h}_{BU}[n]\Big{\|},\\ s.t.\mathbf{w}^{\text{H}}[n]\mathbf{h}_{BE}[n]=0\end{split} \tag{11}\]  
where \(\mathbf{h}_{BE}=\sqrt{\text{d}_{\text{BE}}^{-\kappa}[\mathbf{n}]}v_{\text{E}} \zeta_{\text{E}}\zeta_{\text{I}}\mathbf{a}(\phi_{\text{RS}})\) is the channel between BS and EVE. We suppose that \(\mathbf{\Gamma}_{BE}[n]\) is the projection matrix on the null space of \(\mathbf{h}_{BE}[n]\)[32] as  
\[\mathbf{\Gamma}_{BE}[n]=\mathbf{I}_{N_{p}}-\mathbf{h}_{BE}[n]\big{(}\mathbf{ h}_{BE}^{H}[n]\mathbf{h}_{BE}[n]\big{)}^{-1}\mathbf{h}_{BE}^{\text{H}}[n]. \tag{12}\]  
To satisfy \(\mathbf{w}^{\text{H}}[n]\mathbf{h}_{BE}[n]=0\), we need to satisfy \(\mathbf{\Gamma}_{BE}[n]\mathbf{w}[n]=0\). That is to say, the maximization of \(\mathbf{w}^{\text{H}}[n]\mathbf{h}_{BU}[n]\) is equivalent to the maximization of \(\big{\|}\mathbf{w}^{\text{H}}[n]\mathbf{\Gamma}_{BE}\mathbf{h}_{BU}[n]\big{\|}\). We can acquire the beamforming vector as [33]  
\[\mathbf{w}[n]=\frac{\mathbf{\Gamma}_{UE}[n]\mathbf{h}_{BU}[n]}{\|\mathbf{ \Gamma}_{UE}[n]\mathbf{h}_{BU}[n]\|}. \tag{13}\]  
By substituting (13) into (8), P1 can be rewritten as the following problem:  
\[\underset{\mathbf{\phi}[n],\mathbf{\sigma}[n]}{\text{max}}R_{S}[ n]=\text{log}_{2}\Bigg{(}1+\frac{\mathbf{A}_{G}[n]\frac{\mathbf{\Gamma}_{BE}[n] \mathbf{h}_{BU}[n]}{\|\mathbf{\Gamma}_{BE}[n]\mathbf{h}_{BU}[n]\|^{2}}}{ \sigma_{u}^{2}}\Bigg{)} \tag{14}\] \[-\text{log}_{2}\Bigg{(}1+\frac{\mathbf{A}_{E}[n]\mathbf{w}[ \mathbf{n}]^{2}}{\sigma^{2}}\Bigg{)},\]  
where \(\mathbf{A}_{G}[n]=\mathbf{h}_{UG}^{H}[n]\mathbf{\Phi}\mathbf{W}[n]\), and \(\mathbf{A}_{E}[n]=\mathbf{h}_{UE}^{H}[n]\mathbf{\Phi}\mathbf{W}[n]\).  
For the fixed position of UAV and \(\mathbf{w}[n]\), the optimal passive beamforming reflection elements are given to maximize the \(n\)th objective function of the problem. Set  
\[\begin{split}&\mathbf{a}_{t}(\phi_{RIS})^{H}\Phi\mathbf{\sigma}_{ r,n}(\phi_{r,n})\mathbf{\sigma}_{t,n}^{H}(\phi_{t,n})\mathbf{w}_{EE}=\\ &\exp(j(\varphi-\frac{2\pi}{\lambda}(d(L-1)\sin(\phi_{RIS})+d_{1} (N-1)\sin(\varphi)+d_{2}(M-1)\sin(\varphi))+w_{k})).\end{split} \tag{15}\]  
Based on this method, it can be observed that the optimal value of RIS to maximize (14) is given by  
\[\varphi=\frac{2\pi}{\lambda}(d(L-1)\sin(\phi_{RIS})-d_{1}(N-1)\sin(\varphi)-d_ {2}(M-1)\sin(\varphi))-w_{k}. \tag{16}\]  
(2) _Destination aiming method_  
The eliminate eavesdropping method generally performs well under the unblocked channel. However, when the building blocks the signal, this method does not work well. For the destination aiming method, its main lobe of beam is direct to the destination node. This means that the receiving power of the destination node reaches the maximum, which can improve the communication quality of legitimate channels [30]. In this way, \(\mathbf{w}[n]\) can be denoted as  
\[\mathbf{w}[n]=\frac{\mathbf{h}^{H}[n]\mathbf{\Phi}\mathbf{W}[n]}{\|\mathbf{ h}^{H}[n]\mathbf{\Phi}\mathbf{W}[n]\|}. \tag{17}\]