MatrixPolynomialValue[poly,m,x]
evaluates the polynomial poly in the variable x at the matrix m.
MatrixPolynomialValue[{c0,c1,…},m]
evaluates the polynomial whose coefficients are given by the ci at the matrix m.
MatrixPolynomialValue
MatrixPolynomialValue[poly,m,x]
evaluates the polynomial poly in the variable x at the matrix m.
MatrixPolynomialValue[{c0,c1,…},m]
evaluates the polynomial whose coefficients are given by the ci at the matrix m.
Details
- MatrixPolynomialValue evaluates a polynomial with square matrices as variables and scalar coefficients.
- MatrixPolynomialValue[c0+c1x+⋯+cnxn,m,x] gives
. » - MatrixPolynomialValue[{c0,c1,…,cn},m] also gives
. » - Matrix polynomials occur in the study of matrix algebra such as in the statement of the Cayley–Hamilton theorem, which asserts that MatrixPolynomialValue[CharacteristicPolynomial[m,x],m,x] is the zero matrix. »
Examples
open all close allBasic Examples (2)
Evaluate the polynomial
at the matrix
:
m = {{1, 2}, {3, 4}};
MatrixPolynomialValue[a + b x + c x^2, m, x]//MatrixFormConfirm using elementary operations:
% == a MatrixPower[m, 0] + b MatrixPower[m, 1] + c MatrixPower[m, 2]//SimplifyEvaluate the polynomial with coefficients
at the matrix
:
m = {{a, b}, {c, d}};
MatrixPolynomialValue[{0, 1, 2}, m]//MatrixFormConfirm that this equals the evaluation of
at
:
% == MatrixPower[m, 1] + 2MatrixPower[m, 2]//SimplifyScope (10)
Basic Uses (5)
Both the matrix and the polynomial coefficients can be symbolic:
MatrixPolynomialValue[{c, d, e}, {{a, a^2 + b}, {a b, b^2}}]//MatrixFormMatrix polynomial evaluation of a real matrix:
MatrixPolynomialValue[{1, -.5, 0, 2.7, 4.4}, (| | | | | |
| ---- | ---- | ---- | --- | ---- |
| -2.2 | -1.3 | 1.2 | 1.2 | 0.1 |
| -3. | -2.8 | -2.8 | 1.7 | 3.8 |
| -3.7 | 0.5 | 2.3 | 4. | -0.1 |
| 0.4 | -1.8 | -1.5 | 1.2 | 3.4 |
| 1.6 | 1.2 | -3.4 | 0.9 | -2.6 |)]//MatrixFormMatrix polynomial evaluation of a complex matrix:
MatrixPolynomialValue[x^3 + b x + 1, (| | |
| ----- | ----- |
| 1 + I | -I |
| I | 2 - I |), x]//MatrixFormMatrix polynomial evaluation of an exact matrix:
MatrixPolynomialValue[x^2 + c, (| | |
| ----------- | - |
| 1 + Sqrt[2] | π |
| Sqrt[π] | E |), x]//MatrixFormCompute a polynomial function—expressed as a list of coefficients—of a symbolic matrix:
mat = (| | |
| - | - |
| a | b |
| c | d |);
(mp1 = MatrixPolynomialValue[{-7, 4, -3, 1}, mat])//MatrixFormRecompute with the polynomial expressed in explicit form:
(mp2 = MatrixPolynomialValue[x ^ 3 - 3x ^ 2 + 4x - 7, mat, x])//MatrixFormVerify that both results are consistent with the definition:
mp3 = MatrixPower[mat, 3] - 3 * MatrixPower[mat, 2] + 4 * mat - 7 * IdentityMatrix[2];
mp1 == mp2 == mp3//SimplifySpecial Matrices (5)
Evaluate the polynomial of spare matrices; the result is also sparse:
MatrixPolynomialValue[{1, 2, 3, 4}, SparseArray[Automatic, {5, 5}, 0, {1, {{0, 1, 1, 1, 1, 3}, {{1}, {1}, {5}}}, {a, b, c}}]]%//MatrixFormEvaluate the polynomial of structured matrices including symmetrized arrays:
SymmetrizedArray[{{1, 1} -> a, {5, 1} -> b, {5, 5} -> c}, {5, 5}, Symmetric[{1, 2}]]MatrixPolynomialValue[x ^ 2 + 2x + 2, %, x]//MatrixFormFor quantity arrays, the coefficients must have units for the sum to be dimensionally consistent:
QuantityArray[{{1, 2}, {3, 4}}, "Meters"]MatrixPolynomialValue[{Quantity[2, "Meters" ^ 2], Quantity[1, "Meters"], 3}, %]//MatrixFormUse MatrixPolynomialValue with an identity matrix:
MatrixPolynomialValue[a x^2 + b x + c, IdentityMatrix[6], x]//MatrixFormThe result is equivalent to multiplying the identical matrix by the polynomial evaluated at the point
:
% == (a x^2 + b x + c /. x -> 1)IdentityMatrix[6]Use MatrixPolynomialValue with a diagonal matrix:
MatrixPolynomialValue[{1, 2, 3}, DiagonalMatrix[{a, b, 0, c}]]//Expand//MatrixFormThe result is equivalent to evaluating the polynomial at each of the diagonal entries:
% == DiagonalMatrix[3 x^2 + 2 x + 1 /. Thread[{ x -> {a, b, 0, c}}]]The polynomial value of JordanMatrix[λ,k] yields the polynomial on the diagonal plus a correction above the diagonal:
j = JordanMatrix[λ, 4]MatrixPolynomialValue[{a, b}, j]//Expand//MatrixFormEach additional power involves another superdiagonal:
MatrixPolynomialValue[{a, b, c}, j]//Expand//MatrixFormMatrixPolynomialValue[{a, b, c, d}, j]//Expand//MatrixFormApplications (2)
The Cayley–Hamilton theorem states that any matrix is a root of its characteristic polynomial:
m = (| | | |
| - | -- | -- |
| 0 | -1 | 1 |
| 1 | 2 | -1 |
| 1 | 1 | 0 |);Use CharacteristicPolynomial to find this polynomial:
cp = CharacteristicPolynomial[m, λ]The value of the polynomial evaluated at m is a zero matrix:
MatrixPolynomialValue[cp, m, λ]The lowest-degree polynomial of which m is a root is given by MatrixMinimalPolynomial:
mp = MatrixMinimalPolynomial[m, λ]MatrixPolynomialValue[mp, m, λ]The minimal polynomial always divides the characteristic polynomial:
PolynomialQuotientRemainder[cp, mp, λ]Approximate the cosine of a matrix with a degree-four power series:
mat = {{1., .5}, {-.5, 1}};
MatrixPolynomialValue[Normal[Series[Cos[x], {x, 0, 4}]], mat, x]Compare with the result returned by MatrixFunction:
MatrixFunction[Cos, mat]Properties & Relations (5)
MatrixPolynomialValue[c0+c1x+⋯+cnxn,m,x] gives
:
m = RandomInteger[{-10, 10}, {5, 5}];
Simplify[MatrixPolynomialValue[Underoverscript[∑, i = 0, 4]Subscript[c, i] x^i, m, x] == Underoverscript[∑, i = 0, 4]Subscript[c, i] MatrixPower[m, i]]MatrixPolynomialValue[{c0,c1,…,cn},m] gives
:
m = RandomInteger[{-10, 10}, {5, 5}];
MatrixPolynomialValue[Table[Subscript[c, i], {i, 0, 4}], m] == Sum[Subscript[c, i]MatrixPower[m, i], {i, 0, 4}]//SimplifyMatrixPolynomialValue[CharacteristicPolynomial[m,x],m,x] is zero by the Cayley–Hamilton theorem:
m = RandomInteger[{-10, 10}, {5, 5}];
MatrixPolynomialValue[CharacteristicPolynomial[m, x], m, x]MatrixPolynomialValue[MatrixMinimalPolynomial[m,x],m,x] is zero by definition:
m = RandomInteger[{-10, 10}, {5, 5}];
MatrixPolynomialValue[MatrixMinimalPolynomial[m, x], m, x]mat = {{3, -1}, {4, 1}};
pcoeffs = {3, 2, -1};
MatrixPolynomialValue[pcoeffs, mat]Recast as a sum of matrix powers:
pcoeffs.Map[MatrixPower[mat, #]&, Range[0, 2]]History
Text
Wolfram Research (2025), MatrixPolynomialValue, Wolfram Language function, https://reference.wolfram.com/language/ref/MatrixPolynomialValue.html.
CMS
Wolfram Language. 2025. "MatrixPolynomialValue." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/MatrixPolynomialValue.html.
APA
Wolfram Language. (2025). MatrixPolynomialValue. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/MatrixPolynomialValue.html
BibTeX
@misc{reference.wolfram_2026_matrixpolynomialvalue, author="Wolfram Research", title="{MatrixPolynomialValue}", year="2025", howpublished="\url{https://reference.wolfram.com/language/ref/MatrixPolynomialValue.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_matrixpolynomialvalue, organization={Wolfram Research}, title={MatrixPolynomialValue}, year={2025}, url={https://reference.wolfram.com/language/ref/MatrixPolynomialValue.html}, note=[Accessed: 12-June-2026]}