# Why we sum up the derivatives of the loss w.r.t. Weights at each time step in RNN back-propagation?

I am reading a paper explaining the derivations of the back-propagation equations in RNNs. There I read 'Note that the Weight Matrix remains the same across all time sequence so we can differentiate to it at each time step and sum all together.'

My question is why this statement is correct. What is its mathematical derivation?

• If your objective function is $|f(t_{end})-y|^2$ where $x$ is the input, $f_t(x)$ the output at time $t$, and $y$ the desired output then it means you don't care of the output at $t < t_{end}$, but you do care of the partial derivative $\frac{\partial f(t_{end})}{\partial z_{j,t}}$ where $z_{j,t}$ is output of $j$-th neuron at time $t$. Also your RNN will be quite similar to a $t_{end}$-layer non-recurrent NN, and it is not really possible to train a NN with too many layers. The alternative is to choose objective function $\sum_t|f_t(x)-y_t|^2$ possibly with constant $y_t = y_0$. – reuns Apr 20 at 8:46
• The weights don't depend on $t$ so you'll have $\frac{\partial E}{\partial w_{i,j}} = \sum_t \sum_{t'\le t} \frac{\partial |f_t(x)-y_t|^2 }{\partial z_{j,t'}(x)}$ – reuns Apr 20 at 8:49