MATLAB Answers

0

How to find the inverse of a 2x2 matrix using gaussian elimination (not using rref or lu)?

Asked by John Staine on 18 May 2018
Latest activity Commented on by Jim Riggs
on 18 May 2018

Thanks

  0 Comments

Sign in to comment.

2 Answers

Answer by Jim Riggs
on 18 May 2018
Edited by Jim Riggs
on 18 May 2018

The inverse of a 2x2 is very easy to calculate:

In terms of Matlab code:

detA = A(1,1)*A(2,2)-A(1,2)*A(2,1);
Ainv = (1/detA)*[A(2,2),-A(1,2);-A(2,1),A(1,1)];

(note that if detA is zero, the matrix has no inverse)

  2 Comments

And how would i code it so it uses Gaussian elimination process to find the inverse?

Gaussian elimination is not needed unless the matrix rank is greater than 3. For rank 2 and 3 there is a closed-form solution which is more efficient.

Sign in to comment.


Answer by the cyclist
on 18 May 2018

I found this answer by googling.

  0 Comments

Sign in to comment.