Skip to content

mldivide

Solving Ax = B for x

x = mldivide(A, B)

x = A\B

  • It solves the system of linear equations Ax = B for x.
  • A and B should be matrices having the same numbers of rows; otherwise, elementwise division A.\B (or ldivide(A,B)) is performed if any of the following conditions is satisfied:
A B
Scalar Array of any size and any number of dimensions
n-dimensional array, n > 2 Scalar
Empty Empty
  • If A is a square matrix, LU decomposition is used. It returns an error if A is singular. It reports a warning, and proceeds to compute a solution anyway, if the reciprocal of the condition number of A is less than eps * norm(A), i.e., A nearly singular or badly conditioned.
  • If A is not square, QR decomposition is used to obtain a least square solution of Ax = B. It reports a warning, and proceeds to compute a solution anyway, if A is rank deficient.