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*)



Derivative of eigenpair with respect to matrix
If the eigenvalues are distinct you simply fill in the [first order perturbation answer](https://en.wikipedia.org/wiki/Eigenvalue_perturbation) 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.


