I am trying to in inverse of a 3x3 symbolic matrix and i keep getting FAIL. it works fine with a 2x2 but how do i get the inverse of a symbolic 3x3 matrix

15 views (last 30 days)
A = [ k1, -k1, 0] [ -k1, k1 + k2, -k2] [ 0, -k2, k2]
>> inv(A)
ans = FAIL

Answers (2)

Steven Lord
Steven Lord on 20 Sep 2016
Your matrix is singular. It does not have an inverse.
syms k1 k2
A = [k1, -k1, 0; -k1, k1+k2, -k2; 0, -k2, k2];
issingular = isequal(-A(1, :)-A(3, :), A(2, :))
If you're trying to invert the matrix to solve a system of equations, DO NOT USE INV. Use the backslash operator instead.
b = [1; -2; 1];
x = A\b
isAlways(A*x == b)
You'll receive a warning when you use backslash indicating your system is rank deficient.

James Tursa
James Tursa on 20 Sep 2016
Edited: James Tursa on 20 Sep 2016
The rows are dependent, so the matrix is singular, hence the FAIL.
row1 + row2 = -row3
I.e., det(A) = 0

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!