In this section, new closed-form expressions for the ergodic rate of D2D link aided by two-way DF relay are derived firstly. Symmetric (where the received power at the relay from the two source users is the same) and asymmetric (where the received power is different) cases are considered. We assume channel reciprocity and that the relay node can decode *S*
_{1} and *S*
_{2} without errors. According to the definition in [26], the ergodic rate of the DF protocol is then given by

$$ R_{sum}^{DF} = \min \left({{R_{mac}},{R_{1}(\beta)} + {R_{2}(1 - \beta)}} \right), $$

(11)

where

$$ {}\begin{aligned} {R_{mac}} = \frac{1}{2}E\left\{{{{\log}_{2}}\left({1+{\gamma_{mac}}}\right)}\right\}, \end{aligned} $$

(12)

$$ {}\begin{aligned} {R_{1}(\beta)} = \frac{1}{2}\min\! \left({E\! \left\{{{{\log}_{2}}(1 + {\gamma_{1r}})} \right\},E\left\{ {{{\log }_{2}}\left(1 + {\gamma_{r2}}\left(\beta \right)\right)} \right\}} \right), \end{aligned} $$

(13)

$$ {}\begin{aligned} {R_{2}(\beta)} =\! \frac{1}{2}\min\! \left({E\! \left\{ {{{\log }_{2}}\left(1 \,+\, {\gamma_{2r}}\right)}\! \right\}\!,E\! \left\{ {{{\log }_{2}}\left(1 \,+\, {\gamma_{r1}}\! \left({1 \,-\, \beta} \right)\right)} \right\}}\! \right). \end{aligned} $$

(14)

We are now ready to derive an analytical expression of (11).

### 3.1 Exact analysis

With the above analysis, we now investigate the closed-form expression for the ergodic rate. The case of *P*
_{1r
}≠*P*
_{2r
} is referred to as the asymmetric case. For the symmetric case, since the received power at relay node from UED_{1} is equal to that from UED_{2}, we use *P*
_{
dr
} to indicate the received power at the relay node from the D2D users. The ergodic rate of the D2D link under the two cases are derived and presented in the following theorem.

###
**Theorem 1**

The ergodic rate of the D2D communication aided by a DF relay is given by

$$ R_{sum}^{DF} =\frac{1}{2} \min \left({{R_{mac}},{R_{1}} + {R_{2}}} \right), $$

(15)

where *R*
_{1}= min(*R*
_{1r
},*R*
_{
r2}), *R*
_{2}= min(*R*
_{2r
},*R*
_{
r1}) with

$$ {}\begin{aligned} {R_{1r}}&=\frac{{{P_{1r}}}}{{{P_{1r}} - {P_{cr}}}} \left[{{e^{\frac{{{N_{0}}}}{{{P_{1r}}}}}}{E_{1}}\left({\frac{{{N_{0}}}}{{{P_{1r}}}}} \right) - {e^{\frac{{{N_{0}}}}{{{P_{cr}}}}}}{E_{1}}\left({\frac{{{N_{0}}}}{{{P_{cr}}}}}\right)}\right], \end{aligned} $$

(16)

$$ {}\begin{aligned} {R_{r2}}&=\frac{{{\beta P_{r2}}}}{{{\beta P_{r2}}-{P_{b2}}}}\left[{{e^{\frac{{{N_{0}}}}{{{\beta P_{r2}}}}}}{E_{1}}\left({\frac{{{N_{0}}}}{{{\beta P_{r2}}}}}\right)-{e^{\frac{{{N_{0}}}}{{{P_{b2}}}}}}{E_{1}}\left({\frac{{{N_{0}}}}{{{P_{b2}}}}}\right)}\right], \end{aligned} $$

(17)

$$ {}\begin{aligned} {R_{2r}}&=\frac{{{P_{2r}}}}{{{P_{2r}}-{P_{cr}}}}\left[{{e^{\frac{{{N_{0}}}}{{{P_{2r}}}}}}{E_{1}}\left({\frac{{{N_{0}}}}{{{P_{2r}}}}} \right)-{e^{\frac{{{N_{0}}}}{{{P_{cr}}}}}}{E_{1}}\left({\frac{{{N_{0}}}}{{{P_{cr}}}}}\right)}\right], \end{aligned} $$

(18)

$$ {{}{\begin{aligned} {R_{r1}}&=\frac{{{(1 - \beta)P_{r1}}}}{{{(1 \,-\, \beta)P_{r1}} - {P_{b1}}}}\! \left[\! {{e^{\frac{{{N_{0}}}}{{{(1 - \beta)P_{r1}}}}}}{E_{1}}\left(\! {\frac{{{N_{0}}}}{{{(1 - \beta)P_{r1}}}}}\! \right)\! - {e^{\frac{{{N_{0}}}}{{{P_{b1}}}}}}{E_{1}}\! \left(\! {\frac{{{N_{0}}}}{{{P_{b1}}}}}\! \right)}\! \right], \end{aligned}}} $$

(19)

and

$$ {R_{mac}}= \left\{ {\begin{array}{cl} {R{{_{mac}^{Asy}}}} & \text{for the asymmetric case},\\ {R{{_{mac}^{Sym}}}} & \text{for the symmetric case}, \end{array}} \right. $$

(20)

with

$$ {}\begin{aligned} R_{mac}^{Asy}&= \frac{{P_{1r}^{2}}}{{\left({{P_{2r}} - {P_{1r}}} \right)\left({{P_{cr}} - {P_{1r}}} \right)}}{e^{\frac{{{N_{0}}}}{{{P_{1r}}}}}}{E_{1}}\left({\frac{{{N_{0}}}}{{{P_{1r}}}}} \right) \\ &\quad - \frac{{P_{2r}^{2}}}{{\left({{P_{2r}} - {P_{1r}}} \right)\left({{P_{cr}} - {P_{2r}}} \right)}}{e^{\frac{{{N_{0}}}}{{{P_{2r}}}}}}{E_{1}}\left({\frac{{{N_{0}}}}{{{P_{2r}}}}} \right) \\ &\quad - \frac{{{P_{1r}}{P_{2r}} - {P_{cr}}\left({{P_{1r}} + {P_{2r}}} \right)}}{{\left({{P_{cr}} - {P_{1r}}} \right)\left({{P_{cr}} - {P_{2r}}} \right)}}{e^{\frac{{{N_{0}}}}{{{P_{cr}}}}}}{E_{1}}\left({\frac{{{N_{0}}}}{{{P_{cr}}}}} \right) \end{aligned} $$

(21)

and

$$\begin{array}{*{20}l} R_{mac}^{Sym}&= \frac{{P_{dr}^{2} + {N_{0}}{P_{cr}} - {N_{0}}{P_{dr}} - 2{P_{dr}}{P_{cr}}}}{{{{\left({{P_{cr}} - {P_{dr}}} \right)}^{2}}}}{e^{\frac{{{N_{0}}}}{{{P_{dr}}}}}}{E_{1}}\left({\frac{{{N_{0}}}}{{{P_{dr}}}}} \right) \\ &~~~~+ \frac{{{P_{dr}}\left({2{P_{cr}} - {P_{dr}}} \right)}}{{{{\left({{P_{cr}} - {P_{dr}}} \right)}^{2}}}}{e^{\frac{{{N_{0}}}}{{{P_{cr}}}}}}{E_{1}}\left({\frac{{{N_{0}}}}{{{P_{cr}}}}} \right) - \frac{{{P_{dr}}}}{{{P_{cr}} - {P_{dr}}}}. \end{array} $$

(22)

Note that the the exponential integral of first order is defined as

$$\begin{array}{*{20}l} {E_{1}}\left(z \right) = \int_{z}^{\infty} {\frac{{{e^{- t}}}}{t}dt}. \end{array} $$

(23)

###
*Proof*

See Appendix 1. □

According to *Theorem 1* in [41], we find that the function

$$\begin{array}{*{20}l} h\left(x \right) \buildrel \Delta \over = \exp \left({\frac{1}{x}} \right){E_{1}}\left({\frac{1}{x}} \right) \end{array} $$

(24)

is a monotonically increasing function with *x*. Based on this result, if *a*>*b*, it leads to

$$\begin{array}{*{20}l} {e^{\frac{{{N_{0}}}}{{{a}}}}}{E_{1}}\left({\frac{{{N_{0}}}}{{{a}}}} \right) > {e^{\frac{{{N_{0}}}}{{{b}}}}}{E_{1}}\left({\frac{{{N_{0}}}}{{{b}}}} \right). \end{array} $$

(25)

Then we have

$$\begin{array}{*{20}l} \frac{{{a}}}{{{a} - {b}}}\left[ {{e^{\frac{{{N_{0}}}}{{{a}}}}}{E_{1}}\left({\frac{{{N_{0}}}}{{{a}}}} \right) - {e^{\frac{{{N_{0}}}}{{{b}}}}}{E_{1}}\left({\frac{{{N_{0}}}}{{{b}}}} \right)} \right] > 0. \end{array} $$

(26)

The same result can be obtained for the case *a*<*b*. That is, the values of the expressions in (16)–(19) are always positive.

Our result in *Theorem 1*, in contrast, presents the exact closed-form expression which is applicable for arbitrary system parameters, and is given in closed-form expressions involving standard functions which can be easily evaluated using Matlab or Mathematics softwares. We note that this theorem presents an exact expression for the ergodic rate of the D2D communication aided by a DF relay node. In prior works, separate alternative expressions were only obtained for the traditional D2D communication scenarios without considering the different interference level in different time slots. Moreover, based on *Theorem 1*, we have the following observations. Since *e*
^{1/x}
*E*
_{1}(1/*x*) is a monotonically increasing function, *Theorem 1* implies that *P*
_{1r
}>*P*
_{
cr
}, *β*
*P*
_{
r2}>*P*
_{
b2}, *P*
_{2r
}>*P*
_{
cr
}, and (1−*β*)*P*
_{
r1}>*P*
_{
b1} should hold to transmit the message between different nodes reliably. These conditions also mean that the interferences from the BS and the cellular user play a negative role in the ergodic rate.

#### 3.1.1 Weak interference case

In this subsection, we examine the scenario that the D2D communication occurs at the cell edge where the D2D users reuse the resources of the cellular user far away. Hence, the interference at D2D users is weak enough compared to the noise which means *P*
_{
cr
}→0, *P*
_{
bi
}→0, *N*
_{0}/*P*
_{
cr
}→*∞* and *N*
_{0}/*P*
_{
bi
}→*∞*. According to these, the ergodic rate of the D2D link can be described in the following corollary.

###
**Corollary 1**

When *N*
_{0}/*P*
_{
cr
}→*∞* and *N*
_{0}/*P*
_{
bi
}→*∞*, we have

$$\begin{array}{*{20}l} R_{sum}^{WI} = \frac{1}{2}\min \left({R_{mac}^{WI},R_{1}^{WI} + R_{1}^{WI}} \right), \end{array} $$

(27)

where

$$\begin{array}{*{20}l} R_{1}^{WI} = \min \left({R_{1r}^{WI},R_{r2}^{WI}} \right), \end{array} $$

(28)

$$\begin{array}{*{20}l} R_{2}^{WI} = \min \left({R_{2r}^{WI},R_{r1}^{WI}} \right), \end{array} $$

(29)

with

$$\begin{array}{*{20}l} R_{1r}^{WI} &= {e^{\frac{{{N_{0}}}}{{{P_{1r}}}}}}{E_{1}}\left({\frac{{{N_{0}}}}{{{P_{1r}}}}}\right), \end{array} $$

(30)

$$\begin{array}{*{20}l} R_{r2}^{WI} &= {e^{\frac{{{N_{0}}}}{{\beta {P_{r2}}}}}}{E_{1}}\left({\frac{{{N_{0}}}}{{\beta {P_{r2}}}}} \right), \end{array} $$

(31)

$$\begin{array}{*{20}l} R_{2r}^{WI} &= {e^{\frac{{{N_{0}}}}{{{P_{2r}}}}}}{E_{1}}\left({\frac{{{N_{0}}}}{{{P_{2r}}}}} \right), \end{array} $$

(32)

$$\begin{array}{*{20}l} R_{r1}^{WI} &= {e^{\frac{{{N_{0}}}}{{\left({1 - \beta} \right){P_{r1}}}}}}{E_{1}}\left({\frac{{{N_{0}}}}{{\left({1 - \beta} \right){P_{r1}}}}} \right) \end{array} $$

(33)

and

$$\begin{array}{*{20}l} R_{mac}^{WI} = \left\{ \begin{array}{ll} R_{mac}^{WI,Asy} & {\mathrm{~~~~for~the~asymmetric~case}},\\ R_{mac}^{WI,Sy} & {\mathrm{~~~~for~the~symmetric~case}}, \end{array} \right. \end{array} $$

(34)

with

$$\begin{array}{*{20}l} R_{mac}^{WI,Asy} &= \frac{{{P_{1r}}}}{{{P_{1r}} - {P_{2r}}}}{e^{\frac{{{N_{0}}}}{{{P_{1r}}}}}}{E_{1}}\left({\frac{{{N_{0}}}}{{{P_{1r}}}}} \right) \\ &\quad + \frac{{{P_{2r}}}}{{{P_{2r}} - {P_{1r}}}}{e^{\frac{{{N_{0}}}}{{{P_{2r}}}}}}{E_{1}}\left({\frac{{{N_{0}}}}{{{P_{2r}}}}} \right) \end{array} $$

(35)

and

$$\begin{array}{*{20}l} R_{mac}^{WI,Sy} = \frac{{{P_{dr}} - {N_{0}}}}{{{P_{dr}}}}{e^{\frac{{{N_{0}}}}{{{P_{dr}}}}}}{E_{1}}\left({\frac{{{N_{0}}}}{{{P_{dr}}}}} \right) + 1. \end{array} $$

(36)

###
*Proof*

Based on the properties of exponential integral function,we can get

$$\begin{array}{*{20}l} \frac{1}{2}\ln \left({1 + \frac{2}{x}} \right) < {e^{x}}{E_{1}}\left(x \right) < \ln \left({1 + \frac{1}{x}} \right). \end{array} $$

(37)

For *x*→*∞*, we have

$$\begin{array}{*{20}l} {\left. {{e^{x}}{E_{1}}\left(x \right)} \right|_{x \to \infty }} \approx 0. \end{array} $$

(38)

Having these results, we can easily obtain the approximations in *Corollary 1*. □

*Corollary 1* provides approximate results of ergodic rate for the weak interference scenario. Clearly, the expressions in *Corollary 1* are simpler than the ergodic rate expressions given in *Theorem 1*. Note that the ergodic rate only depends on the desired signal for the weak interference scenario. Since *h*(*x*) in (24) is a monotonically increasing function with *x*, \(R_{sum}^{WI}\) can be improved by increasing *P*
_{
ir
} and *P*
_{
ri
}. That is to say, enhancing the power of desired signals can improve the performance of D2D link when the locations of D2D users are fixed.

#### 3.1.2 High SNR case

Here, we consider the fact that the communicating users in D2D communication systems are relatively close to each other. Here we will present new asymptotic ergodic rate expressions when the receive SNR at the D2D users goes to infinity which means *P*
_{
ir
}/*N*
_{0}→*∞* and *P*
_{
ri
}/*N*
_{0}→*∞*. This will be useful in deriving the optimal power allocation for the ergodic rate at high SNR later in this section. For this case, the ergodic rate of D2D communication aided by the relay node are given in the following corollary.

###
**Corollary 2**

When *P*
_{
ir
}/*N*
_{0}→*∞* and *P*
_{
ri
}/*N*
_{0}→*∞*, the asymptotic ergodic rate is given by

$$ R_{sum}^{HS} = \frac{1}{2}\min \left({R_{mac}^{HS},R_{1}^{HS} + R_{2}^{HS}} \right), $$

(39)

where

$$\begin{array}{*{20}l} R_{1}^{HS} = \min \left({R_{1r}^{HS},R_{r2}^{HS}} \right), \end{array} $$

(40)

$$\begin{array}{*{20}l} R_{2}^{HS} = \min \left({R_{2r}^{HS},R_{r1}^{HS}} \right), \end{array} $$

(41)

with

$$\begin{array}{*{20}l} R_{1r}^{HS}& = {\ln \left({\frac{{{P_{1r}}}}{{{N_{0}}}}} \right) - \lambda - {e^{\frac{{{N_{0}}}}{{{P_{cr}}}}}}{E_{1}}\left({\frac{{{N_{0}}}}{{{P_{cr}}}}} \right)}, \end{array} $$

(42)

$$\begin{array}{*{20}l} R_{r2}^{HS} &= {\ln \left({\frac{{\beta {P_{r2}}}}{{{N_{0}}}}} \right) - \lambda - {e^{\frac{{{N_{0}}}}{{{P_{b2}}}}}}{E_{1}}\left({\frac{{{N_{0}}}}{{{P_{b2}}}}} \right)}, \end{array} $$

(43)

$$\begin{array}{*{20}l} R_{2r}^{HS}& = {\ln \left({\frac{{{P_{2r}}}}{{{N_{0}}}}} \right) - \lambda - {e^{\frac{{{N_{0}}}}{{{P_{cr}}}}}}{E_{1}}\left({\frac{{{N_{0}}}}{{{P_{cr}}}}} \right)}, \end{array} $$

(44)

$$\begin{array}{*{20}l} R_{r1}^{HS} &= {\ln \left({\frac{{\left({1 - \beta} \right){P_{r1}}}}{{{N_{0}}}}} \right) - \lambda - {e^{\frac{{{N_{0}}}}{{{P_{b1}}}}}}{E_{1}}\left({\frac{{{N_{0}}}}{{{P_{b1}}}}} \right)}, \end{array} $$

(45)

and

$$ R_{mac}^{HS} = \left\{ {\begin{array}{cl} R_{mac}^{HS,Asy} & \text{for the asymmetric case},\\ R_{mac}^{HS,Sy} & \text{for the symmetric case}, \end{array}} \right. $$

(46)

with

$$ {}\begin{aligned} R_{mac}^{HS,Asy} &= \frac{{P_{2r}^{2}\left({\ln \left({{P_{2r}}/{N_{0}}} \right) \,-\, \lambda} \right)}}{{\left({{P_{2r}} \,-\, {P_{1r}}} \right)\left({{P_{2r}} - {P_{cr}}} \right)}} - \frac{{P_{1r}^{2}\left({\ln \left({{P_{1r}}/{N_{0}}} \right) \,-\, \lambda} \right)}}{{\left({{P_{2r}} - {P_{1r}}} \right)\left({{P_{1r}} \,-\, {P_{cr}}} \right)}}\\ &~~~- \!\frac{{{P_{1r}}{P_{2r}} \,-\, {P_{cr}}\left({{P_{1r}} +\! {P_{2r}}} \right)}}{{\left({{P_{cr}} - {P_{1r}}} \right)\left({{P_{cr}} - {P_{2r}}} \right)}}{e^{\frac{\!{{N_{0}}}}{{{P_{cr}}}}}}{E_{1}}\!\left({\frac{{{N_{0}}}}{{{P_{cr}}}}} \right) \end{aligned} $$

(47)

and

$$ {}\begin{aligned} R_{mac}^{HS,Sy} &= \frac{{2{P_{dr}}{P_{cr}} - P_{dr}^{2}}}{{{{\left({{P_{cr}} - {P_{dr}}} \right)}^{2}}}} \times \! \left[\! {{e^{\frac{{{N_{0}}}}{{{P_{cr}}}}}}{E_{1}}\left(\! {\frac{{{N_{0}}}}{{{P_{cr}}}}}\! \right) - \ln \left({\frac{{{P_{dr}}}}{{{N_{0}}}}} \right) + \lambda} \right] \\ &\quad+ \frac{{{N_{0}}}}{{{P_{cr}} -{P_{dr}}}}\left({\ln \left({\frac{{{P_{cr}}}}{{{N_{0}}}}} \right) - \lambda} \right) - \frac{{{P_{dr}}}}{{{P_{cr}} - {P_{dr}}}}. \end{aligned} $$

(48)

where *λ*≈0.577 is the Euler-Mascheroni constant.

###
*Proof*

We use the following asymptotic expansion of the exponential integral in obtaining the limiting form as SNR→*∞*,

$$ {\left. {{E_{1}}\left(x \right)} \right|_{x \to 0}} \approx \ln \left({\frac{1}{x}} \right) - \lambda. $$

(49)

□

For the case the relay has some statistical channel state information (CSI) about the system parameters, *β* may be chosen such that the ergodic rate is maximized. In this paper, we investigate the power allocation scheme that maximizes the ergodic rate based on the network geometry and the statistical CSI which include the second-order statistics and the interference level. For simplicity, we consider a linear network topology and assume that the relay node has only the path-loss coefficients of all the channels. We assume the transmit power at each user is *P*
_{
T
}. Since the D2D communication always occurs far from the BS and the distance between D2D users is short, we can get the approximation that *d*
_{
b1}≈*d*
_{
b2} which leads to *P*
_{
b1}≈*P*
_{
b2}≈*P*
_{
b
}.

###
**Corollary 3**

The power allocation strategy that maximizes the ergodic rate (39) is given by

$$ {{}\selectfont{\begin{aligned} {\beta^{*}} =\! \left\{ \begin{array}{l} A~~\text{if}~~\left({{G_{1}} < 0,A < 1} \right)~\text{or}~\left({{G_{1}} > 0,0.5 < B \le A < 1,{g_{2r}} > {g_{1r}}} \right)\\ ~~~~~~~~~~\text{or}~\left({{G_{1}} > 0,B \le A < 0.5,{g_{2r}} > {g_{1r}}} \right)\\ B~~\text{if}~~\left({{G_{1}} > 0,0.5 < B \le A < 1,{g_{1r}} > {g_{2r}}} \right)~\text{or}~ \!\left({{G_{1}}\! > 0,0.5\! < B\! < 1 \le A} \right)\\ ~~~~~~~~~~\text{or}~\left({{G_{1}} > 0,B \le A < 0.5,{g_{1r}} > {g_{2r}}} \right)\\ 1~~\text{if}~~\left({{G_{1}} < 0,A > 1} \right)\\ 0.5~~\text{if}~~\left({{G_{1}} > 0,B \le 0.5 \le A} \right) \end{array} \right. \end{aligned}}} $$

(50)

where

$$\begin{array}{*{20}l} A = \frac{{{g_{1r}}{e^{\theta} }}}{{{g_{2r}}}}, \end{array} $$

(51)

$$\begin{array}{*{20}l} B = 1 - \frac{{{g_{2r}}{e^{\theta} }}}{{{g_{1r}}}}, \end{array} $$

(52)

and

$$\begin{array}{*{20}l} {G_{1}} = \left({g_{1r}^{2} + g_{2r}^{2}} \right){e^{\theta}} - g_{1r}^{}{g_{2r}}, \end{array} $$

(53)

with \({g_{st}} = d_{st}^{- \alpha }(s,t = 1,2,r;s \ne t)\).

###
*Proof*

See Appendix 2. □

From the power allocation scheme in (50), we find that the power allocation coefficient is determined by the location of the relay node on the D2D link when the interference from cellular link is fixed. Instead, the interference level of the cellular link leads to difference power allocation coefficient for the fixed location of relay node. Note that the power allocation strategy in (50) uses only the second-order statistics and the interference levels from the cellular link. It means that the derived power allocation strategy can be easily implemented in practice. It is interesting that there exists some region for the optimal coefficient which equals to 0.5.