This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.

# LinearSolve

 LinearSolvefinds an x which solves the matrix equation . LinearSolve[m]generates a LinearSolveFunction[...] which can be applied repeatedly to different b.
• The argument b can be either a vector or a matrix.  »
• The matrix m can be square or rectangular.  »
• For underdetermined systems, LinearSolve will return one of the possible solutions; Solve will return a general solution.  »
• A Method option can also be given. Settings for exact and symbolic matrices include , , and . Settings for approximate numerical matrices include , and for sparse arrays and . The default setting of Automatic switches among these methods depending on the matrix given.
With no right-hand side, a LinearSolveFunction is returned:
 Out[1]=

With no right-hand side, a LinearSolveFunction is returned:
 Out[1]=
 Out[2]=
 Out[3]=
 Scope   (3)
Find the solution to with exact arithmetic:
Find the solution using numerical methods with machine numbers:
Find the solution using numerical methods with 20-digit arithmetic:
Find a solution even when the matrix is singular:
In this case there is no solution:
Find a solution for a rectangular matrix:
Solve for when is a matrix:
When no right-hand side for is given, a LinearSolveFunction is returned:
This contains data to solve the problem quickly for a given value of :
Sparse methods are used for sparse matrices:
 Options   (2)
is a large sparse matrix:
Solve using a direct multifrontal method:
Solve using an iterative Krylov subspace method:
Find the solution to modulo 47:
Verify the solution:
 Applications   (2)
Newton's method for finding a root of a multivariate function:
Approximately solve the boundary value problem :
Show the error compared with the exact solution:
is a 3×3 matrix:
A system of linear equations:
The solution computed by Solve:
The solution computed by LinearSolve:
Verify that they are the same:
If is nonsingular, the solution of is the inverse of when is the identity matrix:
In this case there is no solution to :
Use LeastSquares to minimize :
Compare to general minimization:
There are multiple solutions to :
Use NullSpace to get the complete spanning set of solutions:
Solution found for an underdetermined system is not unique:
All solutions found by Solve:
With ill-conditioned matrices, numerical solutions may not be very good:
The solution is resolved better if sufficient precision is used:
Solve 100,000 equations using direct methods:
Solve a million equations using iterative methods: