function w = lin_sol(x,y)
% w = lin_sol(x,y) solves the linear system w'*x = y
% it assumes that there is no BIAS term w_0 - rather we can have a column
% of ones as the first dimension of x. This addition should be done in the
% pre-processing stage.
% obtaining the data sizes.
[dim,Num] = size(x);
% solving w = argmin ( (w'*x-y)^T(w'*x-y) )
a = sum(diag(y)*x,1);
X = x'*x;
w = X \ a';
% task: construct a system for solving for
% y = w_0 + w_1'*x + x' *w_2* x
% You should:
% 1. write the system in terms of an expanded vector
% V=[w_0,w_1(1),...,w_1(d),w_2(11),..,w_2(dd)]
% 2. construct a corresponding set of inputs:
% X=[1 ,x_1,...,x_d,x_1^2,x_1*x_2,...,x_d^2]
% 3. write the LINEAR system that solves the problem.
% 4. make a summary table that illustrates the fit of different models.