Given that $$h(a) = (\mathbb E[a \bar X - \mu])^2 + \text{Var} (a \bar X).$$
I was asked to find the first and second derivative of the function $h(a)$ in respect to $a$.
I did break the function into multiple of pieces: $$h(a) = f(g[a]) + z(a).$$
Thus, $$h'(a) = f'(g[a])g'(a) + z'(a).$$
I only have found the first part of the derivative $f'(g[a])g'(a)$, but I couldn't find the other part $z'(a)$. What I am stuck on is the derivative of $\text{Var}(a)$.
Any hints?

Observe that $$ \textrm{Var}(X)=EX^2-(EX)^2. $$ It follows that $$ \begin{align} h(a) &= ( E[a \overline{X} - \mu])^2 + \textrm{Var} (a \overline{X})\\ &= ( E[a \overline{X} - \mu])^2 + \textrm{Var}(a \overline{X} - \mu)\\ &= E([a \overline{X} - \mu]^2)\\ &= E(a^2\overline{X}^2+\mu^2-2a\mu\overline{X})\\ &= a^2E(\overline{X}^2)+\mu^2-2a\mu E(\overline{X}) \end{align} $$ which implies that $$ h'(a)=2aE(\overline{X}^2)-2\mu E(\overline{X}). $$