THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.

# LinearSolve

 LinearSolve[m, b]finds an x which solves the matrix equation m.xb. 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.  »
• LinearSolve[m, b, ZeroTest->test] evaluates test[m[[i, j]]] to determine whether matrix elements are zero. The default setting is ZeroTest->Automatic.
• A Method option can also be given. Settings for exact and symbolic matrices include "CofactorExpansion", "DivisionFreeRowReduction" and "OneStepRowReduction". Settings for approximate numerical matrices include "Cholesky", and for sparse arrays "Multifrontal" and "Krylov". The default setting of Automatic switches among these methods depending on the matrix given.
 Scope   (3)
Find the solution x to m.x = b 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 m.x = b for x when b is a matrix:
When no right-hand side b for m.x = b is given, a LinearSolveFunction is returned:
This contains data to solve the problem quickly for a given value of b:
Sparse methods are used for sparse matrices:
 Options   (2)
s is a large sparse matrix:
Solve s.x = b using a direct multifrontal method:
Solve s.x = b using an iterative Krylov subspace method:
Find the solution x to m.x = b 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:
m is a 3×3 matrix:
A system of linear equations:
The solution computed by Solve:
The solution computed by LinearSolve:
Verify they are the same:
If m is nonsingular, the solution x of is the inverse of m when b 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: