Derivative of an eigenvalue dependent on a parameter
In numerical applications it is often the case that we have to differentiate a eigenvalue which is a function of some parameter. Let be a non-singular matrix dependent on a real parameter . Let the eigenvalues be and let the right and left eigenvectors be and , respectively. Let us further assume that in expressions the eigenvectors are already normalized. Now suppose we want to calculate . The naive way to do this is via finite differences:
but this requires doing two eigendecompositions. Instead, we can appeal to the definition of the th eigenvalue:
Differentiate both sides w.r.t :
Now using the orthogonality relations between the right and left eigenvectors, i.e. we can see that because the derivatives are orthogonal to the vectors by normalization (the eigenvectors live on a -dimensional unit hypersphere, where is the dimension of , and we can just throw away any changes that would bring us off the sphere). So the formula is
If nothing else you can get the derivative of by automatic differentiation.
Degenerate Eigenvalues
What if is degenerate with another eigenvalue for some range of the parameter ? Then we are no longer guaranteed the orthogonality from before since we have a two dimensional subspace in which we are free rotate our eigenvectors. Suppose we reorthogonalize and inside the degenerate subspace. Reviewing the steps, we find that the derivative may rotate inside the degenerate subspace, acquiring components in the direction . Then we get
where and are functions that measure the magnitude of the derivative in the direction of and , respectively. Then what we need to do is clear: we need to construct and such that they are orthogonal to and , respectively.
Eigenvectors
To get the derivatives of the eigenvectors of a Hermitian matrix with distinct eigenvalue and normalized eigenvector , we differentiate
noting that the inverse is justified because the nullspace of is spanned by , which is the direction that is subtracted from . Hence the action of is unambiguous. We may use the Moore-Penrose pseudo inverse to write: