# Documentation

### This is machine translation

Translated by
Mouse over text to see original. Click the button below to return to the English verison of the page.

# mrdivide, /

Solve systems of linear equations xA = B for x

## Description

example

x = B/A solves the system of linear equations x*A = B for x. The matrices A and B must contain the same number of columns. MATLAB® displays a warning message if A is badly scaled or nearly singular, but performs the calculation regardless.

• If A is a scalar, then B/A is equivalent to B./A.

• If A is a square n-by-n matrix and B is a matrix with n columns, then x = B/A is a solution to the equation x*A = B, if it exists.

• If A is a rectangular m-by-n matrix with m ~= n, and B is a matrix with n columns, then x = B/A returns a least-squares solution of the system of equations x*A = B.

x = mrdivide(B,A) is an alternative way to execute x = B/A, but is rarely used. It enables operator overloading for classes.

## Examples

collapse all

Solve a system of equations that has a unique solution, x*A = B.

A = [1 1 3; 2 0 4; -1 6 -1];
B = [2 19 8];
x = B/A
x =

1.0000    2.0000    3.0000

Solve an underdetermined system, x*C = D.

C = [1 0; 2 0; 1 0];
D = [1 2];
x = D/C
Warning: Rank deficient, rank = 1, tol =  1.332268e-15.

x =

0    0.5000         0

MATLAB® issues a warning but proceeds with calculation.

Verify that x is not an exact solution.

x*C-D
ans =

0    -2

## Input Arguments

collapse all

Coefficient matrix, specified as a vector, full matrix, or sparse matrix. If A has n columns, then B must have n columns.

Data Types: single | double
Complex Number Support: Yes

Right-hand side, specified as a vector, full matrix, or sparse matrix. If B has n columns, then A must have n columns.

Data Types: single | double
Complex Number Support: Yes

## Output Arguments

collapse all

Solution, returned as a vector, full matrix, or sparse matrix. If A is an m-by-n matrix and B is a p-by-n matrix, then x is a p-by-m matrix.

x is sparse only if both A and B are sparse matrices.

collapse all

### Tall Array Support

This function supports tall arrays with the limitation:

For the syntax Z = X/Y, the array Y must be a non-tall scalar.

### Tips

• The operators / and \ are related to each other by the equation B/A = (A'\B')'.

• If A is a square matrix, B/A is roughly equal to B*inv(A), but MATLAB processes B/A differently and more robustly.