Not clear on how a simple vector subtraction was opened up to a summation.

32 Views Asked by At

As part of a derivation, I have the following derivation. I understand the whole thing, but I do not understand how the author went from the first line here, to the second line. Can someone please elucidate how they did that?

He basically seems to have "opened up" the $\mathbf{x} - \mathbf{x}_i$ term, but I am not clear how that translates to what is written in the second line.

Context: The formula comes from a derivation here

Thanks

enter image description here

1

There are 1 best solutions below

6
On BEST ANSWER

Edit: Let's try this again. We have \begin{align*} \nabla f(\mathbf{x})&=\frac{2c}{nh^{d+2}}\sum_{i=1}^n(\mathbf{x_i}-\mathbf{x})g(\cdot)\\ &=\frac{2c}{nh^{d+2}}\sum_{i=1}^n\Big(\mathbf{x_i}g(\cdot)-\mathbf{x}g(\cdot)\Big)\;\;\text{distributing g}\\ &=\frac{2c}{nh^{d+2}}\left(\sum_{i=1}^n\mathbf{x_i}g(\cdot)-\sum_{i=1}^n\mathbf{x}g(\cdot)\right)\;\;\text{ break into two sums}\\ &=\frac{2c}{nh^{d+2}}\left(\sum_{i=1}^n\mathbf{x_i}g(\cdot)-\mathbf{x}\sum_{i=1}^ng(\cdot)\right)\;\;\text{pull out x}\\ &=\frac{2c}{nh^{d+2}}\left(\sum_{i=1}^ng(\cdot)\right)\left(\frac{\sum_{i=1}^n\mathbf{x_i}g(\cdot)}{\sum_{i=1}^ng(\cdot)}-\mathbf{x}\right)\;\;\text{ factor out the sum of just g} \end{align*}