# Dynamic Spectrum Access for Internet of Things Service in Cognitive Radio-Enabled LPWANs
## Appendix A  
In the matrix-geometric solution, a quasi-birth-and-death process, called a QBD process, is a Markov process on the state space \(E=\{(i,j),\ i\geq 0,\ 1\leq j\leq m\}\), with infinitesimal generator \(\widetilde{Q}\), given by  
\[\widetilde{Q}=\left[ \begin{array}{ccccccccc}B_{0}&A_{0}&&&&\\ B_{1}&A_{1}&A_{0}&&&&\\ A_{2}&A_{1}&A_{0}&&&&\\ &&A_{2}&A_{1}&A_{0}&&\\ &&&A_{2}&A_{1}&A_{0}&\\ &&&&A_{2}&A_{1}&\cdots\\ &&&&\vdots&\ddots\end{array} \right] \tag{1}\]  
where \(B_{0}e+A_{0}e=B_{1}e+A_{1}e+A_{0}e=(A_{0}+A_{1}+A_{2})e=0\). The generator \(\widetilde{Q}\) is also assumed to be irreducible. The matrix \(A=A_{0}+A_{1}+A_{2}\) is a finite generator. **Theorem**: _The process \(\widetilde{Q}\) is positive recurrent if and only if the minimal nonnegative solution \(R\) to the matrix-quadratic equation_  
\[R^{2}A_{2}+RA_{1}+A_{0}=0 \tag{2}\]  
_has all its eigenvalues inside the system and the finite system of equations_  
\[ \begin{split} x_{0}(B_{0}+RB_{1})&=0\\ x_{0}(I-R)^{-1}e&=1\end{split}  \tag{3}\]  
_has a (unique) positive solution \(x_{0}\)._  
Next, a computational procedure for the proposed dynamic spectrum access strategy is presented. In order to solve the minimal nonnegative matrix \(R\) of the matrix equation \(R^{2}B_{r}+RA_{r}+D=0\), the following recursive iteration can be used directly:  
\[R=-R^{2}B_{c_{1}}A_{c_{1}}^{-1}-DA_{c_{1}}^{-1}. \tag{4}\]  
When the dimension of matrix \(R\) is large, considerable computational errors due to truncation and round-off may be accumulated in the iteration process. Some accuracy may be gained by rewriting the matrix equation as  
\[R^{2}B_{c_{1}}+R(A_{c_{1}}-d(A_{c_{1}}))+D=-Rd(A_{c_{1}}) \tag{5}\]  
where \(d(A_{c_{1}})\) is a diagonal matrix with its diagonal elements equal to the diagonal elements in \(A_{c_{1}}\), respectively. Then the iteration equation becomes  
\[R=-R^{2}B_{c_{1}}d(A_{c_{1}}^{-1})-R[A_{c_{1}}d(A_{c_{1}}^{-1})-I]-Dd(A_{c_{1} }^{-1}) \tag{6}\]  
If the matrix \(B_{c_{1}}\) is nonsingular (i.e., \(m-nc_{2}\
eq 0\)), the following method can be also used, which converges more quickly than the above procedures. The matrix equation can be written as  
\[R^{2}=-RA_{c_{1}}B_{c_{1}}^{-1}-DB_{c_{1}}^{-1}=RA+B \tag{7}\]  
where \(A=-A_{c_{1}}B_{c_{1}}^{-1}\), \(\mathrm{B}=-DB_{c_{1}}^{-1}\). The _ij_ component of (7) is given by  
\[\sum_{k=0}^{c_{2}}r_{ik}r_{kj}=\sum_{k=0}^{c_{2}}r_{ik}a_{kj}+b_{ij} \tag{8}\]Then, this equation is used as an iteration procedure for \(r_{ij}\). Thus, for diagonal elements \(r_{ii}\), the following expression is obtained:  
\[r_{ii}^{2}-r_{ii}a_{ii}+\sum_{k=0,k\
eq i}^{c_{2}}r_{ik}(r_{ki}-a_{ki})-b_{ii}=0 \tag{11}\]  
Which yields the solution  
\[r_{ii}=\frac{1}{2}\left[a_{ii}-\left[a_{ii}^{2}-4\left(\sum_{k=0,k\
eq j}^{c_{2} }r_{ik}(r_{ki}-a_{ki})-b_{ii}\right)\right]^{\frac{1}{2}}\right] \tag{12}\]  
When a negative root is taken to obtain eigenvalues less than 1, for the off-diagonal elements, the corresponding equations are \(\left(r_{ii}+r_{jj}-a_{jj}\right)r_{ij}+\sum_{k=0,k\
eq i,j}^{c_{2}}r_{ik}r_{ kj}-\sum_{k=0,k\
eq j}^{c_{2}}r_{ik}a_{kj}-b_{ij}=0\) and  
\[r_{ij}=\frac{\left[\sum_{k=0,k\
eq j}^{c_{2}}r_{ik}a_{kj}+b_{ij}-\sum_{k=0,k \
eq i,j}^{c_{2}}r_{ik}r_{kj}\right]}{\left(r_{ii}+r_{jj}-a_{jj}\right)} \tag{13}\]  
For the obtained \(R\), the accuracy can be checked from the equality  
\[RB_{c_{1}}e-De=0 \tag{14}\]  
If \(c_{1}\) and \(c_{2}\) are large, the dimension of the matrix \(T\) for the boundary probabilities also becomes large. Consequently, it is difficult to have the desired accuracy in a direct solution of the linear system. An alternative technique that utilizes decomposition can be applied to reduce the dimension of the problem.