5

I am trying to find the characteristic polynomial of a $6\times 6$ block matrix $A$, where each block is a $\ell\times\ell$ matrix, resulting in a $6\ell\times 6\ell$ matrix. The matrix $A$ is defined as: $$A= \begin{bmatrix} U & L & L & L & U & U\\ L & U & L & L & U & U\\ L & L & U & L & U & L\\ L & L & L & U & L & U\\ U & U & U & L & U & U\\ U & U & L & U & U & U\\ \end{bmatrix},$$ where the parameter $\ell$ is a positive integer and the blocks are defined as follows: $$U= \begin{bmatrix} 0 & 1 & 0 & \cdots & 0 & 0\\ 0 & 0 & 1 & 0 & \cdots & 0\\ 0 & \ddots & 0 & \ddots & 0 & 0\\ 0 & 0 & \cdots & 0 & 1 & 0\\ 0 & 0 & 0 & \ddots & 0 & 1\\ 0 & 0 & 0 & 0 & \cdots & 0\\ \end{bmatrix}_{\ell\times\ell}, \quad L= \begin{bmatrix} 1 & 0 & 0 & \cdots & 0 & 0\\ 1 & 0 & \ddots & 0 & 0 & 0\\ \vdots & 0 & 0 & \ddots & 0 & 0\\ 1 & 0 & 0 & 0 & \vdots & 0\\ 1 & 0 & 0 & 0 & 0 & \vdots\\ 1 & 0 & 0 & \cdots & 0 & 0\\ \end{bmatrix}_{\ell\times\ell}.$$ Here, $U$ is the nilpotent matrix with $1$s on the superdiagonal and $0$s elsewhere, and $L$ is the idempotent matrix with $1$s in the first column and $0$s elsewhere.

Goal: Compute the characteristic polynomial (the minimal polynomial corresponding to the largest real eigenvalue) of $A$.

Source: It actually comes from calculating the capacity for DNA composite $\texttt{A}, \texttt{T}, \texttt{C}, \texttt{G}, \texttt{M}: \texttt{A}|\texttt{T}|\texttt{C}, \texttt{K}: \texttt{A}|\texttt{T}|\texttt{G}$ (still unknown general equation for its largest real eigenvalue). Since I want to prove that the DNA composite $\texttt{A}, \texttt{T}, \texttt{C}, \texttt{G}, \texttt{M}: \texttt{A}|\texttt{T}, \texttt{K}: \texttt{C}|\texttt{G}$ is better (already known the general equation for its largest real eigenvalue), after that, the work is comparing those largest eigenvalues. Here is another approach using Wang–Chin partial order framework.

Below is the python code for computational results:

import numpy as np
import sympy as sp

def create_transition_matrix(ell, flavors): q = len(flavors) # Number of flavors n = q * ell # Matrix size A = np.zeros((n, n), dtype=int)

# Matrix for ell = 1
A1 = np.zeros((q, q), dtype=int)
for m in range(q):
    for n in range(q):
        if not flavors[m].intersection(flavors[n]):  # No intersection
            A1[m, n] = 1

if ell == 1:
    return A1

# Matrix for general ell
for m in range(q):
    for n in range(q):
        row_start = m * ell
        col_start = n * ell
        if A1[m, n] == 1:
            # First column filled with 1s
            for i in range(ell):
                A[row_start + i, col_start] = 1
        else:
            # Super-diagonal filled with 1s
            for i in range(ell - 1):
                A[row_start + i, col_start + i + 1] = 1
return A

Set of flavors

flavors = { 0: {'A'}, 1: {'T'}, 2: {'C'}, 3: {'G'}, 4: {'A', 'T', 'C'}, 5: {'A', 'T', 'G'} }

Input maximum ell value

max_ell = int(input("Enter the maximum ell value: "))

Iterate through all ell from 1 to max_ell

for ell in range(1, max_ell + 1): print(f"\n=== ell = {ell} ===") # Create the matrix A = create_transition_matrix(ell, flavors) print("Adjacency matrix A:") print(A)

# Compute eigenvalues
eigenvalues = np.linalg.eigvals(A)
max_eigenvalue = max(abs(eigenvalues))
print(f"Maximal eigenvalue for ell = {ell} (composite):", max_eigenvalue)

# Compute characteristic polynomial with integer coefficients
A_sym = sp.Matrix(A)
x = sp.symbols('x')
char_poly = A_sym.charpoly(x).as_expr()
factored_char_poly = sp.factor(char_poly)

print("\nCharacteristic Polynomial:")
print(sp.sstr(char_poly))
print("\nFactored Characteristic Polynomial:")
print(sp.sstr(factored_char_poly))

Only observation:

  • For $\ell= 1$, the factored characteristic polynomial is: $$(x + 1)(x^{2} + x - 1)(\bbox[5px, #F0FFF0]{x^{3} - 2x^{2}} - 4x + 1)$$

  • For $\ell= 2$, the factored characteristic polynomial is: $$(x^{2} + x + 1)(x^{4} + x^{3} + 2x^{2} - x + 1)(\bbox[5px, #F0FFF0]{x^{6} - 2x^{5} - 8x^{4}} - 14x^{3} - 6x^{2} - 3)$$

  • For $\ell= 3$, the factored characteristic polynomial is: $$(x + 1)(x^{2} + 1)(x^{2} + x - 1)(x^{4} + 3x^{2} + 1)(\bbox[5px, #F0FFF0]{x^{9} - 2x^{8} - 8x^{7} - 35x^{6}} - 56x^{5} - 36x^{4} - 39x^{3} + 12x^{2} + 9)$$

  • For $\ell= \cdots$

  • For $\ell= 13$, the factored characteristic polynomial is:

$$(x + 1)(x^{2} + x - 1)(x^{6} - x^{5} + x^{4} - x^{3} + x^{2} - x + 1)(x^{6} + x^{5} + x^{4} + x^{3} + x^{2} + x + 1)(x^{12} - x^{11} + 2x^{10} - 3x^{9} + 5x^{8} - 8x^{7} + 13x^{6} + 8x^{5} + 5x^{4} + 3x^{3} + 2x^{2} + x + 1)(x^{12} + x^{11} + 2x^{10} + 3x^{9} + 5x^{8} + 8x^{7} + 13x^{6} - 8x^{5} + 5x^{4} - 3x^{3} + 2x^{2} - x + 1)(\bbox[5px, #F0FFF0]{x^{39} - 2x^{38} - 8x^{37} - 35x^{36} - 134x^{35} - 512x^{34} - 1943x^{33} - 7370x^{32} - 27944x^{31} - 105947x^{30} - 401678x^{29} - 1522880x^{28} - 5773679x^{27} - 21889682x^{26}} - 34414340x^{25} - 24503727x^{24} - 32345862x^{23} - 26140428x^{22} - 31050531x^{21} - 27164538x^{20} - 30236868x^{19} - 27795879x^{18} - 29689902x^{17} - 28049004x^{16} - 28808379x^{15} - 26163810x^{14} - 20508228x^{13} + 4392225x^{12} - 2904336x^{11} + 2869344x^{10} - 1699299x^{9} + 1915812x^{8} - 944784x^{7} + 1318761x^{6} - 472392x^{5} + 944784x^{4} - 177147x^{3} + 708588x^{2} + 531441)$$ Edited:
I followed up on my observation about the recurrence for the first coefficients of the degree-$3\ell$ factor of the characteristic polynomial ($\bbox[5px, #F0FFF0]{c_{n}= 1, -2, -8, -35, -134, -512, -1943, \ldots}$), and I’ve realized the recurrence is as: $$c_{n}= \left ( -1 \right )^{n}\left ( -4c_{n- 1}+ c_{n- 2}- c_{n- 3}+ c_{n- 4}- c_{n- 5}+ c_{n- 6}+ \left ( -1 \right )^{n+ 1}\cdot 5 \right ),$$

However, it does not fully capture the pattern of coefficients as computed by the Faddeev-LeVerrier algorithm, as outlined in the trace-based coefficient generation (please see dharr's answer below). That's why we may need a different algorithm to derive the coefficients accurately. I need your help. Thanks a real lot!

Dang Dang
  • 320

1 Answers1

2

Let $K$ be the $6\times 6$ "pattern of U" matrix, with entry $1$ where a $U$ block appears in $A$, i.e., $$ K= \begin{bmatrix} 1 & 0 & 0 & 0 & 1 & 1 \\ 0 & 1 & 0 & 0 & 1 & 1 \\ 0 & 0 & 1 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 & 0 & 1 \\ 1 & 1 & 1 & 0 & 1 & 1 \\ 1 & 1 & 0 & 1 & 1 & 1 \end{bmatrix} $$

Then the "pattern of L" matrix is $J-K$, where $J$ is the matrix of ones, and the matrix $A$ may be written as $$ A=K\otimes U+(J-K)\otimes L=K\otimes (U-L)+J\otimes L $$ where $\otimes $ is the Kronecker product. Let $C$ be the $6\times 6$ matrix with entries of $1$ on the diagonal, $-1$ on the superdiagonal and $0$ elsewhere. Then $$ C^{-1}KC=% \begin{bmatrix} 3 & 0 & -1 & 0 & 3 & 0 \\ 2 & 1 & -1 & 0 & 2 & 0 \\ 2 & 0 & 0 & 0 & 1 & 0 \\ 2 & 0 & -1 & 1 & 0 & 1 \\ 2 & 0 & -1 & 0 & 1 & 0 \\ 1 & 0 & -1 & 1 & 0 & 0 \end{bmatrix},\\~C^{-1}JC= \begin{bmatrix} 6 & 0 & 0 & 0 & 0 & 0 \\ 5 & 0 & 0 & 0 & 0 & 0 \\ 4 & 0 & 0 & 0 & 0 & 0 \\ 3 & 0 & 0 & 0 & 0 & 0 \\ 2 & 0 & 0 & 0 & 0 & 0 \\ 1 & 0 & 0 & 0 & 0 & 0 \end{bmatrix} $$ It is convenient to permute rows and columns to the new order $[1,3,5,4,6,2]$ with permutation matrix $P$ giving

$$ K^{\prime }=PC^{-1}KCP^{-1}= \begin{bmatrix} 3 & -1 & 3 & 0 & 0 & 0 \\ 2 & 0 & 1 & 0 & 0 & 0 \\ 2 & -1 & 1 & 0 & 0 & 0 \\ 2 & -1 & 0 & 1 & 1 & 0 \\ 1 & -1 & 0 & 1 & 0 & 0 \\ 2 & -1 & 2 & 0 & 0 & 1 \end{bmatrix} ,~J^{\prime }=PC^{-1}JCP^{-1}= \begin{bmatrix} 6 & 0 & 0 & 0 & 0 & 0 \\ 4 & 0 & 0 & 0 & 0 & 0 \\ 2 & 0 & 0 & 0 & 0 & 0 \\ 3 & 0 & 0 & 0 & 0 & 0 \\ 1 & 0 & 0 & 0 & 0 & 0 \\ 5 & 0 & 0 & 0 & 0 & 0 \end{bmatrix} $$

We apply a similarity to $A$ to give $A_{2}$ \begin{array} \,A_{2} &=(PC^{-1}\otimes I_{\ell })A(CP^{-1}\otimes I_{\ell })=PC^{-1}KCP^{-1}\otimes (U-L)+PC^{-1}JCP^{-1}\otimes L \\ &=K^{\prime }\otimes (U-L)+J^{\prime }\otimes L \end{array} Loosely, the matrices $K^{\prime }$ and $J^{\prime }$ determine the block location and scaling, and the $6\times 6$ block contents are $U-L$ or $L$.

First factor

The second term of $A_{2}$ has nonzero entries only in the first column and so aside from this column, the block structure is determined by $K^{\prime }$. The last entry of $K^{\prime }$ is one of its eigenvalues since the last column is otherwise zero. Therefore the corresponding $6\times 6$ block in $ A_{2}$ is just $U-L$ and may be factored out of the characteristic matrix, i.e., one factor in the characteristic polynomial of $A$ is the characteristic polynomial of $U-L$. Now $U-L$ is in companion matrix form with the $-1$ entries in the first column indicating its characteristic polynomial is the degree $\ell $ polynomial with all coefficients $1$, e.g., for $\ell =9$ $$ f_{1}=x^{9}+x^{8}+x^{7}+x^{6}+x^{5}+x^{4}+x^{3}+x^{2}+x+1. $$ These polynomials have roots on the unit circle, $\lambda _{k}=\exp (2\pi ik/(\ell +1))$, $k=1,\ldots ,\ell $. A useful property of $U-L$ is that its powers $(U-L)^{k}$ have trace $-1,$ except when $k$ is a multiple of $\ell +1 $, when the power is the identity with trace $\ell $.

Second factor

The next factor comes from the blocks arising from the 4th and 5th rows/columns of $K^{\prime }$, i.e., the characteristic polynomial of $$ X\otimes (U-L)\text{,}~X= \begin{bmatrix} 1 & 1 \\ 1 & 0 \end{bmatrix} $$ The eigenvalues of a Knonecker product are all products of the eigenvalues of the two factors. The characteristic polynomial of $X$ is $x^{2}-x-1$ and its eigenvalues are $\varphi _{\pm }=\left( 1\pm \sqrt{5}\right) /2$, the golden ratio and its conjugate. The eigenvalues of $U-L$ are given above, and so the eigenvalues of $X\otimes (U-L)$ are $\varphi _{\pm }\lambda _{k}$ , $k=1,\ldots ,\ell $. The coefficients of the characteristic polynomial are (up to sign) the elementary symmetric polynomials of the eigenvalues (Vieta's formulas). Since the traces of the powers of $X\otimes (U-L)$ are easy to calculate, I use the Faddeev-LeVerrier algorithm to facilitate this.

Let $F_{0}=0,$ $F_{1}=1,$ $F_{n}=F_{n-1}+F_{n-2}$ be the Fibonacci sequence. Then by the mechanics of matrix multiplication, the $X^{k}$, $k\geq 1$ are given by $$ X^{k}= \begin{bmatrix} F_{k+1} & F_{k} \\ F_{k} & F_{k-1} \end{bmatrix} ,~\operatorname{tr}(X^{k})=F_{k+1}+F_{k-1} $$ For square matrices, $\operatorname{tr}(A\otimes B)=\operatorname{tr}(A)\operatorname{tr}(B)$ and therefore for $k=1,\ldots ,\ell $ $$ \operatorname{tr}\left( [X\otimes (U-L)]^{k}\right) =\operatorname{tr}\left( X^{k}\otimes (U-L)^{k}\right) =-(F_{k+1}+F_{k-1}) $$ The characteristic polynomial has degree $2\ell $; the leading coefficient is $c_{2\ell }=1,$ the next coefficient is minus the trace of the matrix or $ c_{2\ell -1}=F_{2}+F_{0}=1$. The Faddeev-LeVerrier algorithm gives the general coefficient $c_{n-k}$ of $x^{n-k}$ in terms of the previous ones, $$ c_{n-k}=-\frac{1}{k}\left( c_{n}\operatorname{tr}A^{k}+c_{n-1}\operatorname{tr} A^{k-1}+\ldots c_{n-k+1}\operatorname{tr}A\right) $$ where $A$ is the matrix of interest and $n$ is the degree of the polynomial. Therefore the next coefficient is $$ c_{2\ell -2}=-\frac{1}{2}\left( c_{2\ell }\operatorname{tr}A^{2}+c_{2\ell -1}\operatorname{tr}A\right) =-\frac{1}{2}\left( 1\cdot \left[ -(F_{3}+F_{1})\right] +(F_{2}+F_{0})\cdot \left[ -(F_{2}+F_{0})\right] \right) =2 $$ and one continues similarly to $k=\ell $ finding that the coefficients are just the Fibonacci sequence. For $k=\ell +1$ the pattern changes, since $(U-L)^{\ell +1}=I_{\ell }$, $(U-L)^{\ell +2}=U-L$, etc. One finds that the coefficients after $k=\ell $ are the Fibonacci sequence in reverse, with alternating signs, though I did not complete the proof of this. We expect the last term to be the determinant, $\det \left( X\otimes (U-L)\right) =\det (X)^{2}\det (U-L)^{\ell }=(-1)^{2}(\pm 1)^{\ell }=\pm 1$ with top signs for $\ell $ even and bottom signs for $\ell $ odd.

For example, for $\ell =9$ the second factor is

$$ f_{2}=x^{18}+x^{17}+2x^{16}+3x^{15}+5x^{14}+8x^{13}+13x^{12}+21x^{11}+34x^{10}+55x^{9}\\-34x^{8}+21x^{7}-13x^{6}+8x^{5}-5x^{4}+3x^{3}-2x^{2}+x-1 $$

Third factor

The third factor arises from the submatrices of $K^{\prime }$ and $J^{\prime }$ lying in rows/columns 1,2,3 $$ K_{3}:=K^{\prime }[1,2,3]=% \begin{bmatrix} 3 & -1 & 3 \\ 2 & 0 & 1 \\ 2 & -1 & 1 \end{bmatrix} ,~J_{3}:=J^{\prime }[1,2,3]= \begin{bmatrix} 6 & 0 & 0 \\ 4 & 0 & 0 \\ 2 & 0 & 0 \end{bmatrix} ,~K_{3}J_{3}= \begin{bmatrix} 20 & 0 & 0 \\ 14 & 0 & 0 \\ 10 & 0 & 0 \end{bmatrix} $$ but is more complicated as we cannot write it as a single Kronecker product. We want the characteristic polynomial of $B$, and proceed by calculating traces of powers as before. $$ B := K_{3}\otimes (U-L)+J_{3}\otimes L \\ \operatorname{tr}B =\operatorname{tr}(K_{3})\operatorname{tr}(U-L)+\operatorname{tr}(J_{3})\operatorname{tr} (L)=4\cdot (-1)+6\cdot 1=2 $$ For $B^{2}$ the fact that $\operatorname{tr}((U-L)L)=0$ means that the cross terms do not contribute to the trace. $$ B^{2} = \left[ K_{3}\otimes (U-L)+J_{3}\otimes L\right] \left[ K_{3}\otimes (U-L)+J_{3}\otimes L\right] \\ =K_{3}^{2}\otimes (U-L)^{2}+K_{3}J_{3}\otimes (U-L)L+J_{3}K_{3}\otimes L(U-L)+J_{3}^{2}\otimes L^{2} \\ \operatorname{tr}B^{2} =\operatorname{tr}\left( K_{3}^{2}\right) \operatorname{tr}(U-L)^{2}+2\operatorname{tr}(K_{3}J_{3})\operatorname{tr}(U-L)L+\operatorname{tr}\left( J_{3}^{2}\right) \operatorname{tr} L^{2} \\ =16\cdot (-1)+2\cdot 20\cdot 0+36\cdot 1=20 $$ Applying the Faddeev-LeVerrier algorithm $$ c_{2\ell -2}=-\frac{1}{2}\left( c_{2\ell }\operatorname{tr}B^{2}+c_{2\ell -1}\operatorname{tr}B\right) =-\frac{1}{2}\left( 1\cdot 20-2\cdot 2\right) =-8 $$ so the third factor begins $x^{2\ell }-2x^{2\ell -1}-8x^{2\ell -2}-\ldots $.

These calculations are facilitated by the following simplifications (for $ m\geq 1$; see above for $m=0$) $$ \operatorname{tr}(L^{k}) =1,~\operatorname{tr}\left( J_{3}^{k}\right) =6^{k} \\ \operatorname{tr}\left( (U-L)^{k}L^{m}\right) =\operatorname{tr}\left( L^{m}(U-L)^{k}\right) =0,~k=1,\ldots ,\ell -1,\ell +2,\ldots 2\ell -1,\ldots \\ \operatorname{tr}\left( (U-L)^{\ell }L^{m}\right) =\operatorname{tr}\left( L^{m}(U-L)^{\ell }\right) =-1 \\ \operatorname{tr}\left( (U-L)^{\ell +1}L^{m}\right) =\operatorname{tr}\left( L^{m}(U-L)^{\ell +1}\right) =1 $$

The calculation is non-trivial and perhaps not simpler than a direct calculation on the full matrix. However it does make the origin of the coefficients clear, and it does explain why the first $\ell +1$ coefficients are common.

The first and second factors may typically be further factored, but the third factor appears to be irreducible, except for $\ell =2$ where $$ x^{6}-2x^{5}-8x^{4}-14x^{3}-6x^{2}-3=(x+1)(x^{5}-3x^{4}-5x^{3}-9x^{2}+3x-3) $$

dharr
  • 578
  • 1
    Agreed. But probably there are faster algorithms; Maple can find the characteristic polynomial of B for $\ell = 200$ in about 6 seconds. At this point the coefficients are already enormous, ca. 100 digits. – dharr May 07 '25 at 04:45