Left division vs Right Matrix division – Matlab

There are two operators allowing to divide in Matlab:

  • The right division represented by the symbol / (slash)
  • The left division represented by the symbol \ (Backslash)

These two operators differ from each other

Using numbers, the right division will be the conventional division we all day make use of, so

matrix-division-matlab

Contrary to the right division, the left division reverse the division, meaning

matrix-division-matlab

Matrix division in Matlab

The right Matrix divide

Let’s consider two Matrices A and B

matrix-division-matlab

Using the right division

matrix-division-matlab

Matlab code

A=[1 2 ; 2 2];
B=[3 2 ; 1 1];
A/B % You can also use A*inv(B)

which returns

matrix-division-matlab

rewritten, it will look like this

matrix-division-matlab

The left Matrix divide

The right matrix divide is roughly the same as

matrix-division-matlab

Which leads to a complete different result from the preceding operator.

This technique can be used to quickly compute the solution of the equation

matrix-division-matlab

So, using our early defined matrices

matrix-division-matlab

will be written

A=[1 2 ; 2 2];
B=[3 2 ; 1 1];
A\B % You can also use inv(A)*B

which returns

matrix-division-matlab

Which rewritten will look like

matrix-division-matlab

The Matrix division, element by element

We thought it will be also necessary you have a grip on the element-by-element Matrix division in Matlab

To divide Matrices, element-by-element, the following formula is useful

matrix-division-matlab

Where

matrix-division-matlab

The code

A./B

Content you might like:

tchouken2

Related Posts