  We develop a noncommutative analogue of the spectral decomposition with the
quasideterminant defined by I. Gelfand and V. Retakh. In this theory, by
introducing a noncommutative Lagrange interpolating polynomial and combining a
noncommutative Cayley-Hamilton's theorem and an identity given by a
Vandermonde-like quasideterminant, we can systematically calculate a function
of a matrix even if it has noncommutative entries. As examples, the
noncommutative spectral decomposition and the exponential matrices of a
quaternionic matrix and of a matrix with entries being harmonic oscillators are
given.
