Main Content

mldivide, \

Solve systems of linear equations Ax = B for x when A is a Galois array



x = A\B divides the Galois array A into B to produce a particular solution of the linear equation Ax = B. In the special case when A is a nonsingular square matrix, x is the unique solution A–1B.

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


collapse all

Specify the Galois field GF(2^4). Create two matrices with entries in this field.

m = 4;
A = gf([8 1 6;3 5 7;4 9 2],m);
B = gf(2*eye(size(A)),m);

Calculate the solution of the equation Ax=B.

x = A \ B;

Check that the obtained solution works.

ans = logical

Input Arguments

collapse all

Galois matrix to divide by, specified as an array with Galois field entries.

Data Types: gf

Array to be divided, specified as an integer matrix or a matrix with Galois field entries. If you specify this argument with entries in a Galois field GF(2m), A must have entries in the same field.

Data Types: single | double | gf

Output Arguments

collapse all

Solution, returned as a vector or matrix with Galois field entries.

Data Types: gf


The matrix A must be one of these types:

  • A nonsingular square matrix

  • A matrix with more rows than columns such that A'*A is nonsingular

  • A matrix with more columns than rows such that A*A' is nonsingular


If A is an M-by-N matrix where M > N, A\B is the same as (A'*A)\(A'*B).

If A is an M-by-N matrix where M < N, A\B is the same as A'*((A*A')\B). This solution is not unique.

Version History

Introduced before R2006a