  We introduce the method of path-sums which is a tool for exactly evaluating a
function of a discrete matrix with possibly non-commuting entries, based on the
closed-form resummation of infinite families of terms in the corresponding
Taylor series. If the matrix is finite, our approach yields the exact result in
a finite number of steps. We achieve this by combining a mapping between matrix
powers and walks on a weighted directed graph with a universal graph-theoretic
result on the structure of such walks. We present path-sum expressions for a
matrix raised to a complex power, the matrix exponential, matrix inverse, and
matrix logarithm. We show that the quasideterminants of a matrix can be
naturally formulated in terms of a path-sum, and present examples of the
application of the path-sum method. We show that obtaining the inversion height
of a matrix inverse and of quasideterminants is an NP-complete problem.
