0
$\begingroup$

How do I solve such an eqation? (I know how to solve Mx=n using gaussian elimination but I don't know how to handle 2 variables.

Thanks

  • 0
    This link provides some ideas: http://www.cs.mtu.edu/~shene/COURSES/cs3621/NOTES/INT-APP/CURVE-linear-system.html2012-02-27

2 Answers 2

1

It seems to me like you're trying to solve the least squares problem Mx-Ny=0, in other words find the vectors x,y that minimize the euclidean norm of the vector (Mx-Ny). Let's assume that your matrices are of dimensions M[rowsM][columnsM] and N[rowsN][columnsN],then your vectors would be of dimension x[columnsM] and y[columnsN]. Because the obvious solution to your problem is the trivial solution where y=x=0 you have to give either to x or y vector some constant value in order to compute the best approximation of the other one. This paper contains the basic about least squares approximation: Least squares approximation

Basically all you need is (assuming you initialize vector y): $\vec{x}=(M^{T}M)^{-1}M^{T}(N\vec{y})$ So by finding the inverse of $M^{T}M$ and performing some matrix computations you're done.

  • 0
    Think of the simple 3 equations following: a1*x+b1*y=0 a2*x+b2*y=0 a3*x+b3*y=0 where a,b random constants.The only exact solution of this system is the trivial one x=y=0. When you assign y a constant value then, you can "compute" 3 different "solutions" for x by solving one of the 3 equations.Instead of that you compute one x value tha minimizes the sum of the quadratic errors in each equation so you find the best solution for the WHOLE system and not only one of the equations. It's the same principle with multiple variables->vectors..2012-02-27
0

I presume you know either $x$ or $y$. If $M$ and $N$ are large, then you should use the conjugate gradient method. Otherwise you can directly invert (or pseudo-invert) $M$ or $N$ as appropriate.