The following derivation is taken from Chapter 5: Machine Learning Basics from the book titled Deep Learning (by Aaron Courville et al.)
I am facing difficulty in understanding the zero derivative related to minimizing gradient of mean squared error $\nabla_w \text{MSE}_{train} = 0$
$\nabla_w \text{MSE}_{train} = 0$
$\implies \nabla_w(Xw - y)^T(Xw-y) = 0$
$\implies \nabla_w(w^T X^T- y^T)(Xw-y) = 0$
$\implies \nabla_w(w^T X^T- y^T)(Xw-y) = 0$
$\implies \nabla_w(w^T X^TXw - w^T X^Ty -y^TXw+y^Ty) = 0$
$\implies \nabla_w(w^T X^TXw - 2 w^T X^Ty +y^Ty) = 0$
$\implies 2 X^TXw - 2 X^Ty = 0$
$\implies w = 2 (X^TX)^{-1} X^Ty = 0$
I have had difficulty in understanding the flow of the following two lines
$\implies \nabla_w(w^T X^TXw - w^T X^Ty -y^TXw+y^Ty) = 0$
$\implies \nabla_w(w^T X^TXw - 2 w^T X^Ty +y^Ty) = 0$
The first doubt is about in the first two lines, it is possible only if (which I feel is untrue)
$w^T X^Ty = y^TXw$
Note: $X,y$ here refers to input and outputs of train data