The companion matrix to a monic polynomial a(x) = a_0 + a_1 x + ... + a_(n - 1) x^(n - 1) + x^n is the n×n square matrix A = [0 | 0 | ... | 0 | -a_0 1 | 0 | ... | 0 | -a_1 0 | 1 | ... | 0 | -a_2 ⋮ | ⋮ | ⋱ | ⋱ | ⋮ 0 | 0 | ... | 1 | -a_(n - 1)] with ones on the subdiagonal and the last column given by the coefficients of a(x). Note that in the literature, the companion matrix is sometimes defined with the rows and columns switched, i.e., the transpose of the above matrix.