**3. Algorithms**

In this section, we give two algorithms for finding the determinant and inverse of a periodic tridiagonal Toeplitz matrix with perturbed corners of type 1, which is called A. Besides, we analyze these algorithms to illustrate our theoretical results.

Firstly, based on Theorem 1, we give an algorithm for computing determinant of A as following: Based on Algorithm 1, we make a comparison of the total number operations for determinant of A between LU decomposition and Algorithm 1 in Table 1. Specifically, we ge<sup>t</sup> that the total number operation for the determinant of A is 2*n* + 11, which can be reduced to *O*(*logn*) (see, [41] pp. 226–227).

**Table 1.** Comparison of the total number operations for determinant of A.


**Algorithm 1:** The determinant of a periodic tridiagonal Toeplitz matrix with perturbed corners of type 1

Step 1: Input *α*1, *αn*, *γ*1, *γ<sup>n</sup>*, ¯*h*, order *n* and generate Mersenne numbers *Mi*(*i*=*n*−3,*n*−2,*n*−1)by(1).

 Step 2: Calculate and output the determinant of A by (4).

Next, based on Theorem 2, we give an algorithm for computing inverse of A as following:

**Algorithm 2:** The inverse of a periodic tridiagonal Toeplitz matrix with perturbed corners of type 1

Step 1: Input *α*1, *αn*, *γ*1, *γ<sup>n</sup>*, ¯*h*, order *n* and generate Mersenne numbers *Mi* (*i* = *n* − 3, *n* − 2, *n* − 1) by (1).

Step 2: Calculate *ψ* by (13) and six initial values *a*˘1,1, *a*˘1,2, *a*˘2,1, *a*˘2,2, *a*˘3,1, *a*˘3,2 by (12). Step 3: Calculate the remaining elements of the inverse:

$$\begin{split} \mathfrak{u}\_{2,3} &= 3\mathfrak{u}\_{2,2} - 2\mathfrak{u}\_{2,1} + \frac{1}{\hbar}, \\ \mathfrak{u}\_{3,4} &= 3\mathfrak{u}\_{3,2} - 2\mathfrak{u}\_{3,1} + \frac{1}{\hbar}, \\ \breve{\mathfrak{u}}\_{i,j} &= 3\breve{\mathfrak{u}}\_{i,j-1} - 2\breve{\mathfrak{u}}\_{i,j-2}, \ i \in \{1,2,3\}, i+2 \le j \le n\_{i}, \\ \breve{\mathfrak{u}}\_{i,j} &= 3\breve{\mathfrak{u}}\_{i,j-1} - 2\breve{\mathfrak{u}}\_{i,j-2}, \ i \in \{1,2,3\}, 3 \le j \le i \le n\_{i}, \\ \mathfrak{u}\_{i,j} &= \frac{3}{2}\mathfrak{u}\_{i-1,j} - \frac{1}{2}\mathfrak{u}\_{i-2,j}, \ j \in \{1,2\}, 4 \le i \le n\_{i} \\ \breve{\mathfrak{u}}\_{i,j} &= \frac{3}{2}\breve{\mathfrak{u}}\_{i-1,j} - \frac{1}{2}\breve{\mathfrak{u}}\_{i-2,j}, \ 4 \le i < j \le n. \end{split}$$

Step 4: Output the inverse A−<sup>1</sup> = (*a*˘*i*,*j*)*ni*,*j*=1.

To test the effectiveness of Algorithm 2, we compare the total number of operations for the inverse of A between LU decomposition and Algorithm 2 in Table 2. The total number operation of LU decomposition is 5*n*<sup>3</sup> 6 + 3*n*<sup>2</sup> + 91*n*6 − 21, whereas that of Algorithm 2 is 7*n*<sup>2</sup> 2 − 3*n*2 + 30.


**Table 2.** Comparison of the total number operations for inverse of A.

## **4. Discussion**

In this paper, explicit determinants and inverses of periodic tridiagonal Toeplitz matrices with perturbed corners are represented by the famous Mersenne numbers. This helps to reduce the total number of operations during the calculation process. Some recent research related to our present work can be found in [42–48]. Among them, Qi et al. presented some closed formulas for the Horadam polynomials in terms of a tridiagonal determinant and derived closed formulas for the generalized Fibonacci polynomials, the Lucas polynomials, the Pell-Lucas polynomials, and the Chebyshev polynomials of the first kind in terms of tridiagonal determinants.
