# Why this linear equations are not giving proper results

Let $XYZ$ be a matrix: $$XYZ = \left(\begin{matrix} 200.0&1.05&-0.0021\\ 400.0&2.16&-0.0043 \\ 600&3.32&-0.0067\\ 800&4.55&-0.0092\\ \end{matrix}\right)$$

I am trying to express 3rd column($Z$) in terms of corresponding first($X$) and second($Y$) column coefficients using the equation:

$$z = ax + b\sin(ky)x + cx^2 + d\sin(ky)y^2 \qquad\qquad\qquad(1)$$

where $k = 9.816250011216700\times 10^{-04}$ a constant.

I want to know the values of $a,b,c$ and $d$.

To this end, I have formed four linear equations by substituting the values of $x$ and $y$.

The matrix-vector equations will be $Ap = q$, where $A$ is the coefficient matrix, $p$ is vector $[a,b,c,d]'$ and $q$ is the third column of matrix $XYZ$.

I have solved these equations using LU-factorization as well as matrix inverse method. $A$ is nonsingular in this case.

$$A = \left(\begin{matrix} 0.000991554& -2.42414\times10^{-5}& -0.000292566& 0.000108656\\ -36.893& 53.7078& -34.7174& 8.4074\\ 0.000182553& -0.000269718& 0.000176237& -4.29571\times10^{-5}\\ 0.00496607& -0.00673969& 0.00402018& -0.000886811\\ \end{matrix}\right)$$

I have got the coefficients ($p$) as:

$$\left(\begin{matrix} -1.01747\times 10^{-6} \\ 0.00179026\\ -9.15726\times 10^{-9}\\ -2.24656\times 10^{-7}\\ \end{matrix}\right)$$

With these coefficients, I have reconstructed the third column of $XYZ$ using equation (1). I got the values:

$$\left(\begin{matrix} -0.00201115\\ -0.00356892\\ -0.00417168\\ -0.00303998\\ \end{matrix}\right)$$

which are different from the third column of $XYZ$. Why this happen? What would be the proper way to solve these type of equations?

-
I haven't checked the numerical stability of your method in this particular case, but I'd speculate that it is poor, which may mean that the discrepancy you've observed is the result of precision problems in the computation, rather than some algebraic screw-up on your part. –  Alex Becker Dec 27 '11 at 5:29
Your three columns are very close to parallel. Suggesting that you need to think about the mechanism that produced the data. –  Will Jagy Dec 27 '11 at 5:37