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!