The subtraction of matrices is basically like
matrix addition. You just subtract them instead of adding. For example:
[3 7
5] [5 2 9]
A = [2
0 6] B = [4 7 1]
[8 9
1] [3 2 6]
Where we have to solve A - B.
The solution is simply
[ 3 - 5 7 - 2
5 - 9 ]
[ 2 - 4 0 - 7
6 - 1 ]
[ 8 - 3 9 - 2
1 - 6 ]
[ -2
5 -4 ]
= [ -2 -7
5 ]
[ 5 7 -5 ]
Like
addition, we also cannot subtract matrices that have different sizes such as
[ 7 ]
A = [
2 ] and B = [ 3 4 6 ]
[ 4 ]