How to differentiate the following expression?

40 Views Asked by At

$$L_{\text{emp}}= \sum_{n=1}^N{ (y_n - w^T x_n})^2$$

where $w$ and $x_n$ are vectors. Taking the derivative of $L_{\text{emp}}$ with respect to $w$ and setting zero, we get

$$\sum_{i=1}^N { 2 \, (y_n - w^T x_n)} \frac{d}{dw} { (y_n - w^T x_n)} = 0 \tag{i}$$

Apparently, the next step is

$$\sum_{i=1}^N x_n { (y_n - x_n^T w)} = 0 \tag{ii}$$

Please suggest how to get to equation (ii) from equation (i). Also please mention the formula to be used on (i). Thank you.