It might make sense to skip this linear case, as the model functions we use for crystallography are anything but linear, but this case leads us into the case of non-linear least-squares minimization. A linear equation is one where each parameter contributes independently, so our model function, \(M(\mathbf {p},x)\) can be rewritten as \[M(\mathbf {p},x) = p_1 M_1(x) + p_2 M_2(x) + ... = \sum _k p_k M_k(x)\] where the \(M_k(x)\) terms are some function of \(x\) that we can evaluate.
We want to find the \(p_i\) values so that \[\chi ^2 = \sum _j w_j[y_{obs,j}-M(\mathbf {p},x_j)]^2\] is minimized. When that is true, then the derivative of \(\chi ^2\) with respect to each \(p_k\) value will be zero. That allows us to generate our system of \(m\) simultaneous equations (where k goes from 1 to \(m\) for each parameter value, \(p_k\)):
\[\frac {\partial \chi ^2}{\partial p_k} = -2\sum _j w_j[y_{obs,j}-M(\mathbf {p},x_j)]\frac {\partial M(\mathbf {p},x_j)}{\partial p_k} = 0\] Note that since \(M\) is a linear equation, \(\frac {\partial M(\mathbf {p},x_j)}{\partial p_k} = M_k(x_j) \) and substituting \(M(\mathbf {p},x_j) = \sum _i p_i M_i(x_j)\) we get: \[\sum _j w_j[y_{obs,j}-\{\sum _i p_i M_i(x_j)\}]M_k(x_j) = 0\] which can be rearranged as \[\sum _j w_jy_{obs,j}M_k(x_j) = \sum _i p_i \sum _j w_j M_i(x_j) M_k(x_j) \]
This can be cast as our previous equation, \[\sum _{k=1}^m A_{jk} p_k = b_j\] where \(b_j = \sum _j w_jy_{obs,j}M_k(x_j) \) and \(A_{jk} = \sum _j w_j M_i(x_j) M_k(x_j)\). Since we know the values of \(w_j\), \(y_{obs,j}\) and can compute \(M_k(x_j)\) we can solve for the \(p_k\) values by computing \(\mathbf {A}^{-1}\) as we did before in the previous section.