mrdivide - Solve systems of linear equations xA = B for

            x - MATLAB ([original](https://in.mathworks.com/help/matlab/ref/double.mrdivide.html)) ([raw](?raw))

Solve systems of linear equations xA = B for_x_

Syntax

Description

[x](#btg5p6j-x) = [B](#btg5p6j-A)/[A](#btg5p6j-A) solves the system of linear equations x*A = B forx. The matrices A andB 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.

example

[x](#btg5p6j-x) = mrdivide([B](#btg5p6j-A),[A](#btg5p6j-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×3

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.

MATLAB® issues a warning but proceeds with calculation.

Verify that x is not an exact solution.

Input Arguments

collapse all

Operands, specified as vectors, full matrices, or sparse matrices.A and B must have the same number of columns.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | logical | char
Complex Number Support: Yes

Output Arguments

collapse all

Solution, returned as a vector, full matrix, or sparse matrix. IfA is anm-by-n matrix andB is a p-by-n matrix, then x is ap-by-m matrix.

x is sparse only if both A andB are sparse matrices.

Tips

Extended Capabilities

expand all

This function supports tall arrays with the limitation:

For the syntax Z = X/Y, theY operand must be a scalar.

For more information, see Tall Arrays for Out-of-Memory Data.

Usage notes and limitations:

Usage notes and limitations:

The mrdivide function supports GPU array input with these usage notes and limitations:

For more information, see Run MATLAB Functions on a GPU (Parallel Computing Toolbox).

Usage notes and limitations:

For more information, see Run MATLAB Functions with Distributed Arrays (Parallel Computing Toolbox).

Version History

Introduced before R2006a