In matlab, I defined


both a and b are not square matrix.

and execute a\b will return 2.2857

From various sources, we understand that a\b ~= inv(a)*b, but in my case, a is not a square matrix, thus we can't perform an inverse operation on it.

I am actually translating matlab code to c#, and I need to know how do left division between non-square matrix calculated.



In Matlab $a $\ $b =(a'a)^{-1}a'b$, i.e. $b$ is projected onto $a$.

A little bit more information: Consider, $$ b \approx ax $$ where $x$ is unknown and there are no exact solutions i.e. $b$ and $a$ have many rows and few columns, then the typical way to solve this problem is to solve for $x$ by projecting $b$ onto $a$ or by taking the point on the space $a$, which is closest to be i.e. $b \approx P_ab=a(a'a)^{-1}a'b=ax$.

  • $\begingroup$ wow, how do you found this? Is it like any source we can view? Sorry, my matlab knowledge is only about 1 hour. $\endgroup$
    – VHanded
    Jan 28 '15 at 12:23
  • $\begingroup$ Unfortunately, I don't have a source... I use this operation a lot for linear regressions so I have to know what it does. $\endgroup$
    – user103828
    Jan 28 '15 at 12:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.