In matrix theory, **Sylvester's formula** or **Sylvester's matrix theorem** (named after J. J. Sylvester) or **Lagrange−Sylvester interpolation** expresses an analytic function *f*(*A*) of a matrix A as a polynomial in A, in terms of the eigenvalues and eigenvectors of A. It states that

where the *λ*_{i} are the eigenvalues of A, and the matrices A_{i} are the corresponding Frobenius covariants of A, which are (projection) matrix Lagrange polynomials of A.

Sylvester's formula (1883) is only valid for diagonalizable matrices; an extension due to A. Buchheim (1886) covers the general case.

Sylvester's formula applies for any diagonalizable matrix A with k distinct eigenvalues, λ_{1}, …, *λ*_{k}, and any function f defined on some subset of the complex numbers such that *f*(*A*) is well defined. The last condition means that every eigenvalue *λ*_{i} is in the domain of f, and that every eigenvalue *λ*_{i} with multiplicity m_{i} > 1 is in the interior of the domain, with f being (*m*_{i} — 1) times differentiable at *λ*_{i}.

Consider the two-by-two matrix:

A
=
[
1
3
4
2
]
.
This matrix has two eigenvalues, 5 and −2. Its Frobenius covariants are

A
1
=
c
1
r
1
=
[
3
4
]
[
1
/
7
1
/
7
]
=
[
3
/
7
3
/
7
4
/
7
4
/
7
]
=
A
+
2
I
5
−
(
−
2
)
A
2
=
c
2
r
2
=
[
1
/
7
−
1
/
7
]
[
4
−
3
]
=
[
4
/
7
−
3
/
7
−
4
/
7
3
/
7
]
=
A
−
5
I
−
2
−
5
.

Sylvester's formula then amounts to

f
(
A
)
=
f
(
5
)
A
1
+
f
(
−
2
)
A
2
.
For instance, if f is defined by *f*(*x*) = *x*^{−1}, then Sylvester's formula expresses the matrix inverse *f*(*A*) = *A*^{−1} as

1
5
[
3
/
7
3
/
7
4
/
7
4
/
7
]
−
1
2
[
4
/
7
−
3
/
7
−
4
/
7
3
/
7
]
=
[
−
0.2
0.3
0.4
−
0.1
]
.