I just came across this seemingly simple question, but i am stumped.
Say I have this $ \sum u_n ^2 $ I know I can write this as u.u but what happens if I have $\sum a_nu_n ^2$ ? Is there a simple way to write this as a dot product?
To give some context, I was in a machine learning lecture and we were trying to calculate the weights for the linear regression, so minimizing $\sum (y_n - w^Tx_n)^2$. This went all fine and I got it correctly. Now the question I was posed was what happens when you want to add a cost to each weight so the function now becomes $ \sum c_n(y_n - w^Tx_n)^2$, and now suddenly I cannot write this in matrix notation.
Any help?
You have \begin{align} A = \begin{pmatrix} a_1 & 0 &\ldots & 0\\ 0 & a_2 & \ldots & 0\\ \vdots & \ldots & \ddots &\vdots\\ 0 & \ldots & \ldots & a_n \end{pmatrix} \ \ \text{ and } \ \ u = \begin{pmatrix} u_1 \\ u_2 \\ \vdots \\ u_n \end{pmatrix} \end{align} then it follows \begin{align} \sum^n_{i=1}a_nu_n^2=u^TAu. \end{align}