We can also express the problem this way: Let A be a matrix with the ni column as its first column and a column of all 1s for its second column. Let x be the column vector containing x1 and x2 and b be a column vector of the yi values.
We want to find the x that minimizes (Ax-b)2.
In this general form, we can also consider fitting other
functions. For example, can
be expressed by putting ni2 values in the first column of A,
ni in the second column of A, and 1s in the third column.