## 2 System Model  
Figure 1 demonstrates the RIS-aided UAV secure transmission model, which consists of a base station (BS), an RIS-aided UAV (U), an eavesdropper (EVE) and a ground user (GU). In this model, the RIS is equipped on the UAV. The BS securely transmits the confidential information to the GU assisted by the RIS on UAV. Owing to the obstacles blocking the LOS channel, EVE and GU can only obtain the signal from the RIS. The privacy information is threatened by the EVE. Assisted by the RIS, we optimally designed the phase shift, allocated the transmit power and the UAV's trajectory to maximized the secrecy rate. In the considering model, all channels experience quasi-static Rayleigh flat-fading. The BS is equipped with \(N_{t}\) antennas. GU and the eavesdropper are equipped with only one antenna. Assisted by the RIS, the system can create a programmable wireless environment with reconfigurable passive elements to reduce the signal to interference plus noise ratio (SINR) at the eavesdropping node, and enhance SINR of legitimate receiving users. It can be seen from [6; 28] that in order to optimize the phase shift of RIS, the system needs to obtain high-precision channel state information. This problem was solved by [29] through a large amount of statistical CSI data. Depending on the characteristics of the LoS link, the channel from BS to UAV at \(n\)th time slot is denoted as \(\mathbf{W}[n]\). \[\mathbf{W}[n]=\sqrt{N_{t}N_{t}d_{\mathrm{BU},n}^{-\kappa}}\eta\mathbf{\alpha}_{r, n}(\varphi_{r,n})\mathbf{\alpha}_{r,n}^{H}(\varphi_{t,n}), \tag{1}\]  
where \(N_{t}\) and \(N_{r}\) are the number of antennas for the BS and the GU, respectively; \(\eta\) is the fading coefficient of the LoS link [6]; \(\kappa\) is the corresponding path loss exponent related to the BS to RIS link; \(d_{\mathrm{BU}}[n]\) denotes the distance between BS and UAV in the \(n\)th time slot; \(\mathbf{\alpha}_{r,n}(\varphi_{r,n})\) is the array steering vector between the azimuth angles from BS to RIS; \(\mathbf{\alpha}_{t,n}(\varphi_{t,n})\)are the array steering vector between the azimuth angles from RIS to GU. Since we assume that the RIS is parallel to the uniform linear array (ULA) transmitting antenna, the effect of the incident electromagnetic wave on each row of reflected elements on the RIS are the same and \(\varphi_{t,n}=\varphi_{r,n}\). In addition, the array steering vector is denoted as follows:  
\[\mathbf{\alpha}_{r,n}(\varphi_{r,n})=\sqrt{\frac{1}{N}}\Big{[}1,e^{j\frac{2\pi}{M} d\sin(\varphi_{r,n})},\ldots,\;e^{j\frac{2\pi}{M}d(N-1)\sin(\varphi_{r,n})} \Big{]}^{T}.\]  
The array steering vector \(\mathbf{\alpha}_{t,n}\) is defined in the same way as \(\mathbf{\alpha}_{r,n}\)[30], where \(d\) is the distance between the antennas at the transmitter and \(\lambda\) is the electromagnetic wave wavelength. Due to UAV's high altitude location, the probability of the LoS path is increased. Since we set the transmitter to use directional beam tracking, and consider the large-scale fading of other paths, the process of electromagnetic wave emission and reflection can be regarded as the LoS link. We assume that the existing channel estimation techniques can allow us to obtain channel state information (CSI) [31]. The channel coefficient between the RIS unit and GU is given by  
\[\mathbf{h}_{\text{UG}}[n]=\sqrt{d_{\text{UG,n}}^{-\kappa}}\zeta_{\text{r}} \zeta_{\text{r}}\zeta_{\text{a}}\mathbf{\alpha}_{\text{t}}(\phi_{RIS}), \tag{2}\]  
where \(\zeta_{\text{r}}\) and \(\zeta_{\text{f}}\) represent the gain of the receiving and reflecting antenna elements; \(\upsilon\) is the fading coefficient between UAV and GU; the distance between UAV and GU is denoted as \(d_{\text{UG}}[n]=\sqrt{h^{2}+\left\lVert\mathbf{s}_{\text{U}}[n]-\mathbf{s}_ {\text{G}}\right\rVert^{2}}\). We denote the position of UAV as \(\mathbf{s}_{\text{U}}\) and denote the position of GU as \(\mathbf{s}_{\text{G}}\).