I have to compute two relatively complicated partial derivatives - especially the second one - and I am not at all sure about my approach.
1st Problem: Let $\mathbf{h}_{k}^{\dagger}\in\mathbb{C}^{1\times M}$ be defined as
$$ \mathbf{h}_{k}^{\dagger}\triangleq\mathbf{f}_{k}^{\dagger}\prod_{l=L}^{1}\kappa\boldsymbol{\Theta}_{l}\mathbf{G}_{l}, $$
where $\left(\cdot\right)^{\dagger}$ denotes the complex conjugate transpose, $k\in\mathcal{K}\triangleq\left\{1,\dots,K\right\}$, $\mathbf{f}_{k}^{\dagger}\in\mathbb{C}^{1\times N}$, $\mathbf{G}_{l}\in\mathbb{C}^{N\times N}$, $l=2,\dots,L$,$\mathbf{G}_{1}\in\mathbb{C}^{N\times M}$, and $\boldsymbol{\Theta}_{l}\in\mathbb{C}^{N\times N}$ is defined as $\boldsymbol{\Theta}_{l}\triangleq\operatorname{diag}\left(e^{j\phi_{l,1}},\dots,e^{j\phi_{l,N}}\right)$, with $j\triangleq\sqrt{-1}$ and $\phi_{l,n}\in[0,2\pi)$, $l\in\mathcal{L}\triangleq\left\{1,\dots,L\right\}$, $n\in\mathcal{N}\triangleq\left\{1,\dots,N\right\}$, whereas $\kappa>0$. Let also define the function $f\left(\boldsymbol{\Theta}_{l}\right)$ as
$$ f\left(\boldsymbol{\Theta}_{l}\right)\triangleq\sum_{k\in\mathcal{K}}\frac{\widetilde{\alpha}_{k}\left|\mathbf{h}_{k}^{\dagger}\mathbf{w}_{k}\right|^{2}}{\sum\limits_{i\in\mathcal{K}}\left|\mathbf{h}_{k}^{\dagger}\mathbf{w}_{i}\right|^{2}+\sigma_{k}^{2}}, $$
where $\mathbf{w}_{k}\in\mathbb{C}^{M\times 1}$, $\widetilde{\alpha}_{k}\triangleq\alpha_{k}+1$, and $\alpha_{k}\geq 0$.
I want to compute the $LN$ partial derivatives $\frac{\partial f}{\partial \phi_{l,n}}$.
2nd Problem: This is actually an extension of the previous one, with higher dimensionality and complexity. Specifically, now we define $\mathbf{H}_{p,k}^{\dagger}\in\mathbb{C}^{U\times M}$ as
$$ \mathbf{H}_{p,k}^{\dagger}\triangleq\mathbf{F}_{p,k}^{\dagger}\prod_{l=L}^{1}\kappa_{p}\boldsymbol{\Theta}_{l}\mathbf{G}_{p,l}, $$
where $\mathbf{F}_{p,k}^{\dagger}\in\mathbb{C}^{U\times N}$. We also define the function $g\left(\boldsymbol{\Theta}_{l}\right)$ as
$$ g\left(\boldsymbol{\Theta}_{l}\right)\triangleq\sum_{p\in\mathcal{P}}\sum_{k\in\mathcal{K}}\widetilde{\rho}_{p,k}\mathbf{w}_{p,k}^{\dagger}\mathbf{H}_{p,k}\left(\sum_{i\in\mathcal{K}}\mathbf{H}_{p,k}^{\dagger}\mathbf{w}_{p,i}\mathbf{w}_{p,i}^{\dagger}\mathbf{H}_{p,k}+\sigma_{k}^{2}\mathbf{I}_{U}\right)^{-1}\mathbf{H}_{p,k}^{\dagger}\mathbf{w}_{p,k}, $$
where $\mathcal{P}\triangleq\left\{1,\dots,P\right\}$ and $\mathbf{I}_{U}$ denotes the identity matrix of size $U$.
I want to compute the $LN$ partial derivatives $\frac{\partial g}{\partial \phi_{l,n}}$. (I used so many times the chain and product rules and I got lost somewhere in the process...).
Any answer that shows also the calculation steps (because the objective of this question is not only to get the result but, more importantly, to get more familiar with computing in the future by myself such complicated partial derivatives), would be greatly appreciated!