# Trace of Matrix

Given $A$ is an $n \times n$ matrix over the field $F$ with characteristic polynomial

$$f = (x - a_1) ^{d_1} (x-a_2)^{d_2} (x-a_3)^{d_3}...(x-a_k)^{d_k}$$

I have to find the trace of A.

I am thinking:

$$\text{trace of A }= d_1 a_1 + d_2 a_2+...+ d_k a_k$$

Your formula is correct, as the trace of a matrix is the sum of its eigenvalues, counted with multiplicity. To prove this, you can note that $\operatorname{tr}(A)=\operatorname{tr}(P^{-1}AP)$ for any invertible $P$, and that there exists an invertible matrix $P$ such that $P^{-1}AP$ is in Jordan normal form, so the diagonal entries are the eigenvalues, with multiplicity.