Inverting a 2x2 matrix

Discussions related to mathematics, numerical methods, graph plotting etc.
Hated Moron

Inverting a 2x2 matrix

Post by Hated Moron »

In response to a query from a user, I have added this note to the documentation of PROC_invert():

Note that PROC_invert is suitable only for 3x3 matrices or larger. To invert a 2x2 matrix M() use:

Code: Select all

      M() = M(1,1),-M(0,1), -M(1,0),M(0,0)
      M() /= M(0,0)*M(1,1) - M(0,1)*M(1,0)