# Evaluating partial derivative of a double summation

Suppose I am given a function $$f(x_i,y_j) = \sum_{i=1}^n\sum_{j=1}^m y_j\log(x_i)$$.

I want to evaluate $$\frac{\partial f}{\partial x_i}$$. Am I correct in assuming that

$$\frac{\partial f}{\partial x_i} = \frac{\sum_{j=1}^m y_j}{x_i}$$, as the partial derivative of all $$x_{i'}, i' \neq i$$ equals 0, so the summation drops out?

• Yes, you are correct. Aug 3, 2021 at 12:16
• Thank you! If $f(x_i,y_j)$ = $\sum_{i=1}^n \sum_{j=1}^m y_j x_i$ and I wanted to evaluate $\frac{\partial f}{\partial x_i}$, is it then simply $\sum_{j=1}^m y_j$ instead of $\sum_{j=1}^m y_j n$ right? Aug 3, 2021 at 12:21
• Yes, as writing out the terms explicitly, the only terms with $x_i$ in them are $x_iy_1+\ldots+x_iy_n$. Aug 3, 2021 at 12:28
• Thanks you! That makes sense. Aug 3, 2021 at 12:33

Just to visualize the problem (I think it can be useful) consider that your double sum is the sum of the elements of the following matrix

$$\left[ \begin{matrix} y_1\log x_1& y_1\log x_2 & \dots & y_1\log x_n \\ y_2\log x_1& y_2\log x_2 & \dots & y_2\log x_n \\ \dots & \dots & \dots &\dots \\ y_m\log x_1 & y_m\log x_2 & \dots & y_m\log x_n \\ \end{matrix}\right]$$

thus derivating w.r.t. $$x_i$$ the result is the sum of the elements of the following matrix

$$\left[ \begin{matrix} y_1/x_1& y_1/x_2 & \dots & y_1/x_n \\ y_2/x_1& y_2/x_2 & \dots & y_2/ x_n \\ \dots & \dots & \dots &\dots \\ y_m/x_1 & y_m/ x_2 & \dots & y_m/x_n \\ \end{matrix}\right]$$

That is

$$\frac{\partial f}{\partial x_i}=\frac{1}{x_i}\Sigma_{j=1}^m y_j$$

$$i=1,2,\dots,n$$

• Thank you! That is very instructive. Aug 3, 2021 at 12:32
• @Golem : you're welcome. Do not forget to upvote and accept my answer! Aug 3, 2021 at 12:35