Sorry if this is really easy for you gurus. I'm trying to derive the reformulation of a weighted least square regression to a quadratic programming form. I understand there is a closed form solution under some assumptions. Just to clarify, it's not a homework question, it's a reduced form of a bigger problem faced in work. Tried to google but didn't find detailed steps.
More specifically, the weighted least square regression is $min_{f} ||W(Xf-r)||^2$ and the QP form is just the standard form
I've made some derivation as shown at bottom. I think I got $P$ but I'm not sure about $q$ due to the $f^T$ in the second term. Can you suggest if my $P$ is right and also how to get $q$?