Science:Math Exam Resources/Courses/MATH152/April 2010/Question A 27/Solution 1

From UBC Wiki

If we have a linear system

then Matlab can solve this via the \ operator. Therefore if we type

x=A\b;

then the vector x produced by Matlab is the solution to the linear system. (Note that this is not a typo. The command is A\b and not b\A)

Note. Since A is invertible, it is possible to get the solution by typing

x=inv(A)*b;

but you are generally discouraged from using the inv() operation in Matlab to solve linear systems. (That's because calculating the inverse of a matrix A is an overkill here, there is faster ways of finding x that don't require the matrix inverse.)