Derivative of an iterative vector function? I am trying to solve the following problem
I have some vector-matrix product of the form $\textbf{y} = \textbf{w} \cdot \textbf{X}(\textbf{x})$. Here, $\textbf{x}=[x_1, x_2, ... , x_N]$ and the matrix $ \textbf{X}(\textbf{x}) $ takes the form:
$$
\textbf{X}(\textbf{x}) = \begin{bmatrix}
1 & 1 & ... & 1 \\
x_1 & x_2 & ... & x_N \\
u^{(1)}_1 & u^{(2)}_1 & ... & u^{(N)}_1 \\
\vdots & \vdots & & \vdots \\
u^{(1)}_n & u^{(2)}_n & ... & u^{(N)}_n
\end{bmatrix} = 
\begin{bmatrix}
1 & 1 & ... & 1 \\
x_1 & x_2 & ... & x_N \\
\textbf{u}^{(1)} & \textbf{u}^{(2)} & ... & \textbf{u}^{(N)} 
\end{bmatrix}
$$
The vectors $\textbf{u}$ are found iteratively: $$\textbf{u}^{(i)} = f(x_{i-1},\textbf{u}^{(i-1)})$$
with $\textbf{u}^{(1)} = \textbf{0}$. The row-vector $\textbf{w}$ is a vector of constants and does not depend on $\textbf{x}$. I am wanting to find $$\frac{d\textbf{y}}{d\textbf{x}} = \frac{d}{d\textbf{x}} \left( \textbf{w} \cdot \textbf{X}(\textbf{x}) \right)$$
but am troubled on how one should handle the vectors $\textbf{u}$ since they are iterative. Any help would be greatly appreciated. If I am not making sense and should clarify anything please do let me know haha.
Thanks!
 A: As you have defined,
$$\mathbf{X(x)} = \begin{bmatrix}
1 & 1 & ... & 1 \\
x_1 & x_2 & ... & x_N \\
\textbf{u}^{(1)} & \textbf{u}^{(2)} & ... & \textbf{u}^{(N)} 
\end{bmatrix}.$$
We note that $$\frac{d\mathbf y}{d\mathbf x} = \mathbf{w}\cdot \frac{d\mathbf {X(x)}}{d\mathbf x}.$$
Now, by definition, $$\frac{d\mathbf {X(x)}}{d\mathbf x} = \begin{bmatrix}
\dfrac{d}{d\mathbf x}(1) & \dfrac{d}{d\mathbf x}(1) & \cdots & \dfrac{d}{d\mathbf x}(1) \\ \\
\dfrac{d}{d\mathbf x}(x_1) & \dfrac{d}{d\mathbf x}(x_2) & \cdots & \dfrac{d}{d\mathbf x}(x_n) \\ \\
\dfrac{d}{d\mathbf x}(\textbf{u}^{(1)}) & \dfrac{d}{d\mathbf x}(\textbf{u}^{(2)}) & \cdots & \dfrac{d}{d\mathbf x}(\textbf{u}^{(N)}) 
\end{bmatrix} = \begin{bmatrix}
0 & 0 & \cdots & 0 \\ \\
\dfrac{d}{d\mathbf x}(x_1) & \dfrac{d}{d\mathbf x}(x_2) & \cdots & \dfrac{d}{d\mathbf x}(x_n) \\ \\
\dfrac{d}{d\mathbf x}(\textbf{u}^{(1)}) & \dfrac{d}{d\mathbf x}(\textbf{u}^{(2)}) & \cdots & \dfrac{d}{d\mathbf x}(\textbf{u}^{(N)}) 
\end{bmatrix},$$
where in the second row, $\dfrac{d}{d\mathbf x}(x_i) = \mathbf{e}_i$ and in the last row, $\dfrac{d}{d\mathbf x}(\textbf{u}^{(i)}) = \textbf{u}^{(i+1)}$,
where $\textbf{u}^{(i+1)}$ is in fact the Jacobian Matrix (or the pushforward operator) and can be expressed in matrix form as follows:
$$\dfrac{d}{d\mathbf x}(\textbf{u}^{(i)}) = \begin{bmatrix}
    \frac{\partial u^{(i)}_1}{\partial x_1} & \frac{\partial u^{(i)}_1}{\partial x_2} & \cdots & \frac{\partial u^{(i)}_1}{\partial x_N}\\
    \frac{\partial u^{(i)}_2}{\partial x_1} & \frac{\partial u^{(i)}_2}{\partial x_2} & \cdots & \frac{\partial u^{(i)}_2}{\partial x_N}\\
    \vdots & \vdots & \ddots & \vdots\\
    \frac{\partial u^{(i)}_n}{\partial x_1} & \frac{\partial u^{(i)}_n}{\partial x_2} & \cdots & \frac{\partial u^{(i)}_n}{\partial x_N}\\
  \end{bmatrix}.$$
