Can anyone help me to understand how the last line is derived from the following equation? I am new to matrix calculus.
\begin{equation} \begin{split} E(c) & = \parallel \textbf{R}_{3l}c -s \parallel^2 = (\textbf{R}_{3l}c -s)^{T}(\textbf{R}_{3l}c -s)\\ & = c^{T}\textbf{R}_{3l}^{T}\textbf{R}_{3l}c-2c^{T}\textbf{R}_{3l}^{T}s+s^{T}s \end{split} \end{equation}
Also, how the derivative of above equation with respect to coefficient vector c can be derived using matrix calculus as below:
\begin{equation} \frac{\partial E}{\partial c}= (\textbf{R}_{3l}^{T}\textbf{R}_{3l})c+(\textbf{R}_{3l}^{T}\textbf{R}_{3l})^{T}c-2\textbf{R}_{3l}^{T}s \end{equation}
Then, how the least square solution for c is obtained by setting the derivative equal to zero:
\begin{equation} c=\textbf{R}_{3l}^{\dagger}s=(\textbf{R}_{3l}^{T}\textbf{R}_{3l})^{-1}\textbf{R}_{3l}^{T}s \end{equation}
You need to know that $\frac{\partial c^TR^TRc}{\partial c} = 2R^TRc = (\textbf{R}_{3l}^{T}\textbf{R}_{3l})c+(\textbf{R}_{3l}^{T}\textbf{R}_{3l})^{T}c$.
Also, $\frac{\partial c^TR^T}{\partial c} = R^T = 2\textbf{R}_{3l}^{T}s$