Taking a simple derivative I have the following function that I wish to take the derivative of
$$
z(\omega)=\frac{1-C_{c}L_{r}\omega^{2}-\frac{\omega^{2}}{\omega_{r}^{2}}}{i\omega C_{c}\left(1-\frac{\omega^{2}}{\omega_{r}^{2}}\right)}
$$
where $i$ is the imaginary unit. I wish to take the derivative $\frac{dz(\omega)}{d\omega_{r}}$. However, $\omega_{r}$ is also dependent on $L_{r}$ such that
$$
\omega_{r} = \frac{1}{\sqrt{L_{r}C_{r}}}
$$
I understand that there should be some chain-rule that happens when I take the derivative of $z$ with respect to $\omega_{r}$. But since $L_{r}$ is also dependent on $\omega_{r}$, how should I take the derivative properly?
 A: First, I'd rearrange the expression by plugging $\omega_r$ in terms of $L_r$, that is:
$$z(\omega)=\dfrac{1-C_c\frac{1}{\sqrt{C_r}\omega_r^2}-\frac{\omega^2}{\omega_r^2}}{i\omega C_c\Big(1-\frac{\omega^2}{\omega^2_r}\Big)}$$
You can further simplify by separating the terms in the numerator as follows:
$$z(\omega)=\dfrac{1}{i\omega C_c\Big(1-\frac{\omega^2}{\omega^2_r}\Big)}-\dfrac{\frac{1}{\omega_r^2}\Big(\frac{1}{\sqrt{C_r}}+\omega^2\Big)}{i\omega C_c \Big(1-\frac{\omega^2}{\omega^2_r}\Big)}=\dfrac{1}{i\omega C_c\Big(1-\frac{\omega^2}{\omega^2_r}\Big)}-\dfrac{\frac{1}{\sqrt{C_r}}+\omega^2}{i\omega C_c(\omega_r^2+\omega^2)}=x-y$$
where $x$ and $y$ are defined as above.
You can rewrite $y$, as a function of $\omega_r$ as $y(\omega_r)=f(g(\omega_r))$, where $g(\omega_r)=\omega_r^2+\omega^2$, and $f(g)=\dfrac{\frac{1}{\sqrt{C_r}}+\omega^2}{i\omega C_cg}$. You can verify that $y(\omega_r)=f(g(\omega_r))$. Then to calculate the derivative with respect to $\omega_r$ we can use the chain rule as follows: $\dfrac{d y(\omega_r)}{d\omega_r}=\dfrac{df}{dg}\dfrac{dg}{d\omega_r}=f'(g(\omega_r))g'(\omega_r)$. Note that the $f'$ is evaluated at $g(\omega_r)$, not $\omega_r$.
In your case, that would be $g'(\omega_r)=2\omega_r$ and $f'(g(\omega_r))=-\dfrac{\frac{1}{\sqrt{C_r}}+\omega^2}{i\omega C_c(g(\omega_r))^2}=-\dfrac{\frac{1}{\sqrt{C_r}}+\omega^2}{i\omega C_c(\omega_r^2+\omega^2)^2}$. Then you put together those expressions and simplify if necessary. I'll let you do $x$.
