/

Right division operator: a / b divides, or solves x*B = A for matrices.

Category: Language Fundamentals > Operators and Elementary Operations

Syntax

C = A / B

For a scalar B, divides each element of A by it. For matrices, solves C*B = A. Same as mrdivide(A, B).

Description

With a scalar denominator, / behaves like ./. With a square matrix B it solves the linear system C*B = A and is equivalent to (B' \ A')'. If B is not square, the least-squares solution is returned.

Prefer A/B to A*inv(B): it is faster and more accurate.

Input arguments

A
Numeric array. With a matrix B, A must have as many columns as B.
B
Scalar, or matrix whose number of columns equals that of A.

Output arguments

C
The quotient. For matrices it equals A * inv(B), computed by a more accurate solver.

Example

[2 4 6] / 2
A = [1 2; 3 4];
X = [5 6] / A
X * A
Output
ans = 1×3

     1     2     3
X = 1×2

    -1     2
ans = 1×2

     5     6

See also

mrdivide \ ./ inv mldivide