Derivative of eigenpair with respect to matrix Suppose that $A$ is real and symmetric matrix (or tensor) of dimension $3 \times 3$, with its spectral decomposition
$$A = \sum_{i=1}^3 \lambda_i\ n_i\otimes n_i$$
where $\lambda_i$, $n_i$ and $\otimes$ denote the eigenvalues, eigenvectors and dyadic product, respectively. Further, let $a$ be a vector of the form
$$ a = \sum_{i=1}^3 f(\lambda_i)\ n_i$$
with an at least twice-differentiable function $f(\lambda_i)$.
I need to compute the derivative (third-order tensor) $B$ with its components
$$B_{ijk}=\frac{\partial a_i}{\partial A_{jk}}$$
also in the case that the eigenvalues are not distinct (e.g. $\lambda_1=\lambda_2\neq \lambda_3$ or even $\lambda_1=\lambda_2= \lambda_3$).
I know that this is possible for a matrix $C$
$$C = \sum_{i=1}^3 f(\lambda_i)\ n_i\otimes n_i$$
In this case, the derivative $\partial C/\partial A$ (fourth order tensor) is always computable, also if the eigenvalues are not distinct (see e.g. R.W. Ogden, Non-Linear Elastic Deformations, 1997, p. 162)
 A: If the eigenvalues are distinct you simply fill in the first order perturbation answer for the eigenvalues and eigenvectors,
$$\frac{\partial\lambda_i}{\partial A_{jk}}=(n_i)_{j}(n_i)_{k}(2-\delta_{jk}),$$
$$\frac{\partial n_{i}}{\partial A_{jk}}=\sum_{p\neq i}n_p\frac{(n_p)_j(n_i)_k(2-\delta_{jk})}{\lambda_i-\lambda_p},$$
and then
$$\frac{\partial a}{\partial A_{jk}}=\sum_i f'(\lambda_i)n_i\frac{\partial\lambda_i}{\partial A_{jk}}+\sum_i f(\lambda_i)\frac{\partial n_{i}}{\partial A_{jk}}.$$
If two (or more) eigenvalues are identical the eigenvectors $n_i$ are not uniquely determined by the matrix $A$, and neither is the quantity $a=\sum_i f(\lambda_i)n_i$. Now you may choose a particular set of eigenvectors and ask for the derivative $\partial a/\partial A_{jk}$ for that particular choice, this will in general diverge when two eigenvalues $\lambda_p$ and $\lambda_q$ coincide, unless $(n_p)_j (n_q)_k=0$.
Note that this complication does not appear if you consider instead the quantity $C=\sum_i f(\lambda_i)n_i\otimes n_i$, because $C=f(A)$ is uniquely defined by $A$, even if the eigenvalues are not distinct.
