I have the following system of equations that I wanted to solve:
$ 2x_1+12x_2+16x_3=24\\ 7x_1+6x_2+4x_3=18\\ 3x_1+2x_2+8x_3=32\\ 9x_1+5x_2+10x_3=14 $
I tried arranging into matrix form:
$ AX=b $
where
$ A= \left[ \begin{array}{ccc} 2 & 12 & 16\\ 7 & 6 & 4\\ 3 & 2 & 8\\ 9 & 5 & 10 \end{array} \right] ,X = \left[ \begin{array}{c} x_1\\ x_2\\ x_3\\ \end{array} \right] ,b= \left[ \begin{array}{c} 24\\ 18\\ 32\\ 14 \end{array} \right] $
I then tried to solve for $X$ using:
$ X=A^+b $
where $A^+$ is the pseudoinverse of $A$, and obtained
$ X= \left[ \begin{array}{c} \frac{43146}{52789}\\ \frac{-49025}{52789}\\ \frac{235293}{105578}\\ \end{array} \right] = \left[ \begin{array}{c} 0.817329368\\ -0.928697267\\ 2.228617704\\ \end{array} \right] $
Just to check my solution, I tried solving the system in another way using an iterative method on the computer and obtained the solution:
$ X^*= \left[ \begin{array}{c} 0.8173293681\\ -0.9286972669\\ 2.228617705\\ \end{array} \right] $
I thought that since both methods gave pretty much the same answer for the unknown matrix, it would be correct, however, $AX^*$ (or $AX$) is not even close to b:
$ AX^*= \left[ \begin{array}{c} 26.1481747999999996\\ 9.06359279399999984\\ 18.4235351999999999\\ 24.9986550200000010 \end{array} \right] $
Normally, any of these methods work for me but in this case, I'm not sure. I always thought that iterative methods would yield the best possible solution while the analytic solution for $X$ in $AX=b$ would give a more-or-less "exact" solution. So I would understand if $X^*$ is as close to the proper solution as an iterative method can get but I don't understand why the analytic solution for $AX=b$ would be as equally off the mark.
I'm not good at being able to just "look" at equations and tell if or what kind of solution exists, so I was hoping if someone can tell me if I'm doing something wrong and/or if there is a more proper solution. Like if there is actually no solution, is this the sort of thing that happens when you try to solve $AX=b$ either analytically or numerically?
Thanks!