Function Repository Resource:

# TridiagonalCompanionMatrix

Generate the tridiagonal companion matrix of a univariate polynomial

Contributed by: Jan Mangaldan
 ResourceFunction["TridiagonalCompanionMatrix"][poly,x] gives a tridiagonal companion matrix of poly, treated as a polynomial in x.

## Details

ResourceFunction["TridiagonalCompanionMatrix"] produces a tridiagonal matrix whose characteristic polynomial is a scalar multiple of the original polynomial.
ResourceFunction["TridiagonalCompanionMatrix"] returns a SparseArray object.

## Examples

### Basic Examples (2)

Generate a tridiagonal companion matrix:

 In[1]:=
 Out[1]=

The characteristic polynomial of this matrix is a constant multiple of the original polynomial:

 In[2]:=
 Out[2]=

### Scope (2)

Tridiagonal companion matrix of a polynomial with complex coefficients:

 In[3]:=
 Out[3]=

Tridiagonal companion matrix of a polynomial with symbolic coefficients:

 In[4]:=
 Out[4]=

### Applications (2)

Numerically find the roots of a polynomial by computing the eigenvalues of its tridiagonal companion matrix:

 In[5]:=
 Out[5]=

Compare with the result of NSolve:

 In[6]:=
 Out[6]=

### Properties and Relations (4)

A polynomial with real coefficients whose roots are all real has a symmetric tridiagonal companion matrix:

 In[7]:=
 Out[7]=
 In[8]:=
 Out[8]=

If the polynomial has repeated roots, then the companion matrix is symmetric and block diagonal:

 In[9]:=
 Out[9]=
 In[10]:=
 Out[10]=

A polynomial with real coefficients and complex roots will have a tridiagonal companion matrix with negative entries in its superdiagonal:

 In[11]:=
 Out[11]=
 In[12]:=
 Out[12]=

If the polynomial has repeated roots, the superdiagonal will also have zero entries:

 In[13]:=
 Out[13]=
 In[14]:=
 Out[14]=

## Version History

• 1.0.0 – 04 February 2021