# Simple Online Matrix Calculator (2×2)

### Phone users

**NOTE:** If you're on a phone, you can scroll any **wide matrices** on this page to the right or left to see the whole expression.

This matrix calculator allows you to enter your own 2×2 matrices and it will add and subtract them, find the matrix multiplication (in both directions) and the inverses for you.

It shows you the steps for obtaining the answers.

You can enter any number (not letters) between −99 and 99 into the matrix cells.

## Output

Here are the results using the given numbers.

Our two matrices are:

A = |
−5 | −2 | ||

−4 | −2 |

and B = |
−1 | −1 | ||

2 | 6 |

## Matrix Addition

*A* + *B*

= | −5 | −2 | ||

−4 | −2 |

+ | −1 | −1 | ||

2 | 6 |

= | −6 | −3 | ||

−2 | 4 |

## Subtracting a Matrix

*A* − *B*

= | −5 | −2 | ||

−4 | −2 |

− | −1 | −1 | ||

2 | 6 |

= | −4 | −1 | ||

−6 | −8 |

## Matrix Multiplication

In general, if

X = |
a |
b |
||

c |
d |

and Y = |
e |
f |
||

g |
h |

then the product of the matrices *X* and *Y* is given by:

*XY*

= | a |
b |
||

c |
d |

e |
f |
||

g |
h |

= | (a × e + b × g) |
(a × f + b × h) |
||

(c × e + d × g) |
(c × f + d × h) |

Using this process, we multiply our 2 given matrices *A* and *B* as follows:

*AB*

= | −5 | −2 | ||

−4 | −2 |

−1 | −1 | ||

2 | 6 |

= | (−5 × −1 + −2 × 2) | (−5 × −1 + −2 × 6) | ||

(−4 × −1 + −2 × 2) | (−4 × −1 + −2 × 6) |

= | 1 | −7 | ||

0 | −8 |

Let's now multiply the matrices in reverse order:

*BA*

= | −1 | −1 | ||

2 | 6 |

−5 | −2 | ||

−4 | −2 |

= | (−1 × −5 + −1 × −4) | (−1 × −2 + −1 × −2) | ||

(2 × −5 + 6 × −4) | (2 × −2 + 6 × −2) |

= | 9 | 4 | ||

−34 | −16 |

#### Matrix multiplication is not commutative

In general, when we multiply matrices, *AB* does not equal *BA*. We say matrix multiplication is "not commutative".

Sometimes it does work, for example *AI = IA = A*, where *I* is the Identity matrix, and we'll see some more cases below.

## Inverse of a 2×2 matrix

In general, the inverse of the 2×2 matrix

X = |
a |
b |
||

c |
d |

is given by:

`X^-1 = 1/("det"(X))[(d,-b),(-c,a)]`

Recall that

det(*X*) = *ad − bc*

**Note:** This formula only works for 2 × 2 matrices.

So for matrices *A* and *B* given above, we have the following results.

The inverse of

A = |
−5 | −2 | ||

−4 | −2 |

is:

`A^-1 = 1/2[(-2,-(-2)),(-(-4),-5)]`

`=[(-1,1),(2,-2.5)]`

### Check

`A A^-1 =[(-5,-2),(-4,-2)] [(-1,1),(2,-2.5)]`

`=[(1,0),(0,1)]`

And the reverse also works:

`A^-1 A =[(-1,1),(2,-2.5)] [(-5,-2),(-4,-2)]`

`=[(1,0),(0,1)]`

The inverse of

B = |
−1 | −1 | ||

2 | 6 |

is:

`B^-1 = 1/-4[(6,-(-1)),(-(2),-1)]`

`=[(-1.5,-0.25),(0.5,0.25)]`

### Check

`B B^-1 =[(-1,-1),(2,6)] [(-1.5,-0.25),(0.5,0.25)]`

`=[(1,0),(0,1)]`

Multiplying in the reverse order also works:

`B^-1 B =[(-1.5,-0.25),(0.5,0.25)] [(-1,-1),(2,6)]`

`=[(1,0),(0,1)]`