## 3 Optimal Power Allocation for FD Mode
In summary, the \(\min\)SEP in (18) is given by  
\[\min\text{SEP} =\min\Bigg{(}\frac{a}{2}-\frac{a\sqrt{b}}{2\sqrt{2\pi}}\sum_{i=0}^ {N_{\text{R}}-1}\sum_{j=0}^{N_{\text{D}}-1}\frac{\Gamma(i+j+\frac{1}{2})}{i!j! \hat{\gamma}_{\text{R}}^{i}\hat{\gamma}_{\text{D}}^{j}(\frac{1}{\mathcal{T}_ {\text{R}}}+\frac{1}{\mathcal{T}_{\text{D}}}+\frac{b}{2})^{i+j+\frac{1}{2}}} \Bigg{)}\] \[\text{SEP}=\underbrace{\frac{a}{2}}_{\text{SEP}_{1}}-\underbrace{\frac{a\sqrt {b}}{2\sqrt{2\pi}}\sum_{i=0}^{N_{\rm R}-1}\sum_{j=0}^{N_{\rm D}-1}\frac{\Gamma (i+j+\frac{1}{2})}{i!j!\gamma_{\rm R}^{i}\gamma_{\rm D}^{j}(\frac{1}{\gamma_{ \rm R}}+\frac{1}{\gamma_{\rm D}}+\frac{b}{2})^{i+j+\frac{1}{2}}}}_{\text{SEP}_{ 2}}, \tag{19}\]0  
Denote \(P_{\text{R}}=\alpha P_{\text{S}}\) and \(f(\alpha)=\hat{\gamma}_{\text{R}}^{i}\hat{\gamma}_{\text{D}}^{j}(\frac{1}{ \mathcal{T}_{\text{R}}}+\frac{1}{\mathcal{T}_{\text{D}}}+\frac{b}{2})^{i+j+ \frac{1}{2}}\). Now we need to find \(\alpha^{*}\), which is the optimal value of \(\alpha\). Then for this given \(\alpha^{*}\), we can obtain \(P_{\text{R}}^{*}\). The procedure for obtaining \(\alpha^{*}\) and \(P_{\text{R}}^{*}\) is summarized in the following Algorithm 1. ```
1:Solve \(\frac{\partial f(\alpha)}{\partial\alpha}=0\) for \(\alpha=\alpha_{0}\);
2:if\(\left\{\frac{\partial f(\alpha)}{\partial\alpha}<0\text{ for }\alpha<\alpha_{0}\right.\)
3:then
4: Output optimal value of \(\alpha\) \(\alpha^{*}=\alpha_{0}\);
5:\(P_{\text{R}}^{*}=\alpha^{*}P_{\text{S}}\)
6:else
7: Output optimal value \(\alpha^{*}=\emptyset\);
8:end
```  
**Algorithm 1** Calculation of optimal \(\alpha^{*}\) and \(P_{\text{R}}^{*}\)  
We will explain step-by-step the process of Algorithm 1 as follows. * **Step 1:** We take the derivative of \(\frac{\partial f(\alpha)}{\partial\alpha}\) with respect to \(\alpha\) and solve \(\frac{\partial f(\alpha)}{\partial\alpha}=0\) to obtain the stationary point \(\alpha_{0}\). Specifically, after some basic algebra calculations, we obtain the following equation  
\[\text{SEP}=\underbrace{\frac{a}{2}}_{\text{SEP}_{1}}-\underbrace{\frac{a\sqrt {b}}{2\sqrt{2\pi}}\sum_{i=0}^{N_{\rm R}-1}\sum_{j=0}^{N_{\rm D}-1}\frac{\Gamma (i+j+\frac{1}{2})}{i!j!\gamma_{\rm R}^{i}\gamma_{\rm D}^{j}(\frac{1}{\gamma_{ \rm R}}+\frac{1}{\gamma_{\rm D}}+\frac{b}{2})^{i+j+\frac{1}{2}}}}_{\text{SEP}_{ 2}}, \tag{19}\]1Then, \(\alpha_{0}\) can be calculated as \[\text{SEP}=\underbrace{\frac{a}{2}}_{\text{SEP}_{1}}-\underbrace{\frac{a\sqrt {b}}{2\sqrt{2\pi}}\sum_{i=0}^{N_{\rm R}-1}\sum_{j=0}^{N_{\rm D}-1}\frac{\Gamma (i+j+\frac{1}{2})}{i!j!\gamma_{\rm R}^{i}\gamma_{\rm D}^{j}(\frac{1}{\gamma_{ \rm R}}+\frac{1}{\gamma_{\rm D}}+\frac{b}{2})^{i+j+\frac{1}{2}}}}_{\text{SEP}_{ 2}}, \tag{19}\]2 (29)
* **Step 2:** We check whether \(\frac{\partial f(\alpha)}{\partial\alpha}\) is negative or positive in a specific interval to determine maximum or minimum point. If \(\frac{\partial f(\alpha)}{\partial\alpha}\) is negative when \(\alpha<\alpha_{0}\) and positive when \(\alpha>\alpha_{0}\), an optimal transmission power \(P_{\mathrm{R}}^{*}\) exits and it is given by \[\text{SEP}=\underbrace{\frac{a}{2}}_{\text{SEP}_{1}}-\underbrace{\frac{a\sqrt {b}}{2\sqrt{2\pi}}\sum_{i=0}^{N_{\rm R}-1}\sum_{j=0}^{N_{\rm D}-1}\frac{\Gamma (i+j+\frac{1}{2})}{i!j!\gamma_{\rm R}^{i}\gamma_{\rm D}^{j}(\frac{1}{\gamma_{ \rm R}}+\frac{1}{\gamma_{\rm D}}+\frac{b}{2})^{i+j+\frac{1}{2}}}}_{\text{SEP}_{ 2}}, \tag{19}\]3 (30) It is worth noting that (30) is the bounded optimal transmission power at the FD relay node and it is often used for the systems with complex mathematical expressions. * **Step 3:** Otherwise, if \(\alpha^{*}=\emptyset\), depending on whether \(\frac{\partial f(\alpha)}{\partial\alpha}\) is less or greater than 0, we can select an appropriate value of \(\alpha^{*}\) to get \(P_{\mathrm{R}}^{*}\).