Find $\frac{d}{dx} \left( \lVert u - M^{-1}(x)u\rVert_2^2 \right)$, where $M(x) = \left(B + xA \right)$ and $M^H(x) = M(x)$ 
Problem:
Let $x \in \mathbb{R}$, $u \in \mathbb{C}^{n \times 1}$, $B \in \mathbb{C}^{n \times n}; B^H = B$, and $A \in \mathbb{C}^{n \times n}; A^H = A$.
Find 
  \begin{align}
\frac{d}{dx} f(x) = \frac{d}{dx} \left\{ \left\| u - M^{-1}(x)u \right\|_2^2 \right\} \ ,
\end{align}
  where
  \begin{align}
M(x) = \left(B + xA \right) \ \Rightarrow M^H(x) = M(x).
\end{align}


 A: Incorporating feedback from greg, here is the answer (please no need to give credits). 

Answer: 
  \begin{align}
\frac{d}{dx} \left\{ \left\| u - M^{-1}(x)u \right\|_2^2 \right\}
&= 2 \ \Re \left\{ u^H M^{-1}(x) \ A \ M^{-1}(x) \left[ u - M^{-1}(x) u \right] \right\} \ .
\end{align}

Solution:
Notation clarification: Complex conjugate of $u$ is denoted by $u^*$, and the conjugate transpose (or Hermitian) of $A$ is denoted by $A^H$.
I have utilized the following identities 


*

*Trace and Frobenius product relation $${\rm tr}(A^H B) = A^* : B$$ or $${\rm tr}(AB) = A^H : B = (A^*)^T : B$$

*Cyclic property of Trace/Frobenius product 
\begin{align}
 A : B C  
 &= AC^T : B   \\
 &=  B^T A :  C  \\
 &= {\text{etc.}} \cr
\end{align}


So, we compute the differential first, and then the gradient.
Firstly, we compute the differential of $M^{-1}(x)$, i.e., $dM^{-1}(x)$,
\begin{align}
& I = M(x) M^{-1}(x) \\
& \Rightarrow 0 = dM(x) M^{-1}(x) + M(x)dM^{-1}(x) \\
& \Leftrightarrow dM^{-1}(x) = -M^{-1}(x) \ \underbrace{dM(x)}_{= A dx} M^{-1}(x) = - M^{-1}(x) \ A \ M^{-1}(x) \ dx \ .
\end{align}
Since 
\begin{align}
f(x) 
&= \left\| u^* - M^{-1}(x) u \right\|_2^2 \\
&= \underbrace{\left[ u^* - M^{-*}(x) u^* \right]}_{= \left[ u^* - M^{-1}(x) u^* \right]} :  \left[ u - M^{-1}(x) u \right] \\
&= \left[ u^* - M^{-1}(x) u^* \right] : \left[ u - M^{-1}(x) u \right] 
\end{align}
the differential of $f(x)$ reads
\begin{align}
df(x) 
&= d \left\{ \left[ u^* - M^{-1}(x) u^* \right] : \left[ u - M^{-1}(x) u \right] \right\} \\
&=  - dM^{-1}(x) u^* : \left[ u - M^{-1}(x) u \right] + \left[ u^* - M^{-1}(x) u^* \right] : -dM^{-1}(x) \ u \\
&= \left[ u - M^{-1}(x) u \right] : - dM^{-1}(x) u^* + \left[ u^* - M^{-1}(x) u^* \right] : -dM^{-1}(x) \ u \\
&= \left[ u - M^{-1}(x) u \right] : - \left[ - M^{-1}(x) \ A \ M^{-1}(x) \ dx \right] u^* \\ 
&  + \left[ u^* - M^{-1}(x) u^* \right] : - \left[ - M^{-1}(x) \ A \ M^{-1}(x) \ dx \right] \ u \\
&= \left[  M^{-1}(x) \ A \ M^{-1}(x) \ u^*  \right]^T \left[ u - M^{-1}(x) u \right] :  dx \\ 
&  + \left[ M^{-1}(x) \ A \ M^{-1}(x) \ u \right]^T \left[ u^* - M^{-1}(x) u^* \right] :  dx  \\
&=  2 \ \Re \left\{ u^H M^{-1}(x) \ A \ M^{-1}(x) \left[ u - M^{-1}(x) u \right] \right\} : dx .
\end{align}
The gradient is 
\begin{align}
\frac{d}{dx} f(x) 
&= \frac{d}{dx} \left\{ \left\| u - M^{-1}(x)u \right\|_2^2 \right\} \\
&= 2 \ \Re \left\{ u^H M^{-1}(x) \ A \ M^{-1}(x) \left[ u - M^{-1}(x) u \right] \right\} \ .
\end{align}
