Solving system of equations using matrices: How would you solve this?

44 Views Asked by At

I'm trying to find a value that, when multiplied by matrix A produces matrix B, or $Ax=B$. I tried using substitution for $-0.5649 x1 + 1.0228 x2 = y$ and $-0.32 x1 + 0.58 x2 = y$, but when I checked it against the solution in R, they were completely different. The correct answer is $0.5669308$, using QR factorization. I'm not sure how to do this by hand if not by regular substitution. How would you solve this system of equations? Thank you!

\begin{equation} A= \begin{bmatrix} -0.5649\\ 1.0228 \end{bmatrix} \label{eq:aeqn} \end{equation}

\begin{equation} B= \begin{bmatrix} -0.32 \\ 0.58 \end{bmatrix} \label{eq:beqn} \end{equation}

1

There are 1 best solutions below

0
On

To solve the least square system, you just have to solve $$A^TAx=A^TB$$

$$x=\frac{A^TB}{A^TA}$$

octave:1> A = [-0.5649; 1.0228];
octave:2> B = [-0.32; 0.58];
octave:3> A'*B/ (A'*A)
ans =  0.56693