partial derivative with respect to a vector using chain rule

63 Views Asked by At

consider a vector $\mathbf{x}=[x_1\; x_2\; \ldots x_N]$ with fourier transform coefficients as $$X_k=\sum_{n=1}^{N} x_n e^{-i\frac{2\pi kn}{N}}$$ The vector $\mathbf{x}$ is an input to the system, with $L$ hidden variables $\mathbf{Z}_l$, giving a scaler output y

Now i want to compute the partial derivative of output w.r.t each frequency bin: $\frac{\partial y}{\partial X_k}$ but taking into account each hidden variable $\mathbf{Z}_l$, where the functional dependence is as follows:

\begin{align} y=f(\mathbf{x})=f(g(\mathbf{Z}_l)) \;\; \mbox{for some functions} \;\; f()\; \mbox{and} \; g() \end{align}


I can use chain rule as

\begin{align} \frac{\partial y}{\partial X_k}&=\sum_{l=1}^{L} \frac{\partial y}{\partial \mathbf{Z}_l} \frac{\partial \mathbf{Z}_l}{\partial X_k}\\ \;\;\;\;\;&= \sum_{l=1}^{L} \frac{\partial y}{\partial \mathbf{Z}_l} \sum_{n}\frac{\partial \mathbf{Z}_l}{\partial x_n} \frac{\partial x_n}{\partial X_k}\\ \;\;\;\;\;&= \frac{1}{N}\sum_{l=1}^{L} \frac{\partial y}{\partial \mathbf{Z}_l} \sum_{n}\frac{\partial \mathbf{Z}_l}{\partial x_n} e^{i2\pi kn/N} \end{align}

now how do I simplify the second term on R.H.S given the fact that I can compute $\frac{\partial y}{\partial \mathbf{Z}_l}$?