How do calculate the derivative of $\text{det } $? Define $\text{det}:M(n)\rightarrow \mathbb{R}$ as the map that sends $A$ to its determinant. This map is clearly smooth and I want to calculate its differential at $I$ (the identity matrix). 
I did this for a very special case. Suppose that every eigenvalue of $A$ is real, and call them $\lambda_1,\dots, \lambda_n$, now lets calculate its derivative. 
$d(\text{det})_I(A)=\lim_{s\rightarrow 0}\displaystyle\frac{\text{det}(I-sA)-\text{det}(I)}{s}=\lim_{s\rightarrow 0}\displaystyle\frac{(1-s\lambda_1)\cdots(1-s\lambda_n)-1}{s}=\lambda_1+\cdots+\lambda_n$
Now this calculation do not hold if $A$ has some complex eigenvalue. How can I prove that $d(\text{det})_I(A)=\text{tr}(A)$ in general?

The determinant of an $n$-by-$n$ matrix $A=(a_{i,j})$ is 
$$\sum_{\sigma\in S_n}\text{sgn}(\sigma)\prod_{i=1}^{n} a_{i,\sigma(i)},$$
where $S_n$ is the set of permutations of $\{1,\ldots, n\}$, and $\text{sgn}$ is the signature of a permutation. 
For fixed $A = (a_{i,j})$, $\det(\text{id}+tA)$ is a polynomial in $t$. 
Summands corresponding to non-identity permutations in the formula for the determinant yield terms of order at least $t^2$ in $\det(\text{id}+tA)$, so they don't contribute to
$\frac{d}{dt}|_{t=0}\det(I+tA)$. Thus,
$$
d(det)_{I}(A)=\frac{d}{dt}|_{t=0}\det(I+tA) = \frac{d}{dt}|_{t=0}\left[\prod_{i=1}^n(1+ta_{i,i})\right]= \sum_{i=1}^n a_{i,i} = \text{tr}(A).
$$
So OP's argument works even if $A$ is not diagonal.  
