CompanionMatrix - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

# Online Help

###### All Products    Maple    MapleSim

Student[LinearAlgebra]

 CompanionMatrix
 construct the companion Matrix of a monic polynomial

 Calling Sequence CompanionMatrix(P, options)

Parameters

 P - monic polynomial options - (optional) parameters; for a complete list, see LinearAlgebra[CompanionMatrix]

Description

 • The CompanionMatrix(P) command returns the companion Matrix associated with the univariate polynomial $P\left(x\right)$.
 • If C := CompanionMatrix(P) and P is ${a}_{0}+{a}_{1}x+\cdots +{x}_{n}$ (a monic univariate polynomial), then C is an $nxn$ Matrix where $n$ is the degree of polynomial P, ${C}_{i,n}=-{a}_{i-1}\left(i=1..n\right)$, ${C}_{i,i-1}=1\left(i=2..n\right)$, and ${C}_{i,j}=0$ for all other values of $i$ and $j$.

Examples

 > $\mathrm{with}\left({\mathrm{Student}}_{\mathrm{LinearAlgebra}}\right):$
 > $p≔{x}^{4}+{x}^{3}+2{x}^{2}+3x$
 ${p}{≔}{{x}}^{{4}}{+}{{x}}^{{3}}{+}{2}{}{{x}}^{{2}}{+}{3}{}{x}$ (1)
 > $\mathrm{CompanionMatrix}\left(p\right)$
 $\left[\begin{array}{cccc}{0}& {0}& {0}& {0}\\ {1}& {0}& {0}& {-3}\\ {0}& {1}& {0}& {-2}\\ {0}& {0}& {1}& {-1}\end{array}\right]$ (2)
 > $q≔\left(z+2\right)\left(z-5\right)\left(z+3\right)$
 ${q}{≔}\left({z}{+}{2}\right){}\left({z}{-}{5}\right){}\left({z}{+}{3}\right)$ (3)
 > $\mathrm{CompanionMatrix}\left(q\right)$
 $\left[\begin{array}{ccc}{0}& {0}& {30}\\ {1}& {0}& {19}\\ {0}& {1}& {0}\end{array}\right]$ (4)

 See Also