Adding & subtracting matrices

Learn how to find the result of matrix addition and subtraction operations.

What you should be familiar with before taking this lesson

A matrix is a rectangular arrangement of numbers into rows and columns. Each number in a matrix is referred to as a matrix element or entry.
The dimensions of a matrix give the number of rows and columns of the matrix in that order. Since matrix AA has 22 rows and 33 columns, it is called a 2×32\times 3 matrix.
If this is new to you, we recommend that you check out our intro to matrices.

What you will learn in this lesson

As long as the dimensions of two matrices are the same, we can add and subtract them much like we add and subtract numbers. Let's take a closer look!

Adding matrices

Given A=[4837]A=\left[\begin{array}{rr}{4} &8 \\ 3 & 7 \end{array}\right] and B=[1052]B=\left[\begin{array}{rr}{1} &0 \\ 5 & 2 \end{array}\right], let's find A+BA+B.
We can find the sum simply by adding the corresponding entries in matrices AA and BB. This is shown below.
A+B=[4837]+[1052]=[4+18+03+57+2]=[5889]\begin{aligned} {A}+{B} &= \left[\begin{array}{rr}{\blueD4} &\blueD{8} \\\blueD {3} & \blueD{7} \end{array}\right]+\left[\begin{array}{rr}{\goldD{1}} &\goldD{0} \\ \goldD{5} & \goldD{2} \end{array}\right] \\\\\\\\ &= \left[\begin{array}{rr}{\blueD4+\goldD{1}} &\blueD{8}+\goldD{0} \\\blueD{ 3}+\goldD{5} & \blueD7+\goldD2 \end{array}\right] \\\\\\\\ &= \left[\begin{array}{rr}{5} &8 \\ 8 & 9 \end{array}\right] \end{aligned}

Check your understanding

1) A=[520119]A=\left[\begin{array}{rr}{5} &2 \\ 0& 1 \\ 1 & 9 \end{array}\right] and B=[234102]B=\left[\begin{array}{rr}{2} &3 \\ 4& 1 \\ 0 & 2 \end{array}\right].
A+B=A+B=

A+B=[520119]+[234102]=[5+22+30+41+11+09+2]=[7542111]\begin{aligned}A+B&=\left[\begin{array}{rr}{5} &2 \\ 0& 1 \\ 1 & 9 \end{array}\right]+\left[\begin{array}{rr}{2} &3 \\ 4& 1 \\ 0 & 2 \end{array}\right]\\ \\\\\\ &=\left[\begin{array}{rr}{5+2} &2+3 \\ 0+4& 1+1 \\ 1+0 & 9+2 \end{array}\right]\\ \\\\ &=\left[\begin{array}{rr}{7} &5 \\ 4& 2 \\ 1 & 11 \end{array}\right]\\ \end{aligned}
2)
[101263]+[14227]={\left[\begin{array}{rr}{-10} &12 \\ -6& 3 \end{array}\right]}+\left[\begin{array}{rr}{-1} &4 \\ 22& 7 \end{array}\right]=

[101263]+[14227]=[10+(1)12+46+22    3+7]=[11161610]\begin{aligned}{\left[\begin{array}{rr}{-10} &12 \\ -6& 3 \end{array}\right]}+\left[\begin{array}{rr}{-1} &4 \\ 22& 7 \end{array}\right]&={\left[\begin{array}{rr}{-10+(-1)} &12+4 \\ -6+22~~~~& 3+7 \end{array}\right]} \\\\ &=\left[\begin{array}{rr}{-11} &16 \\ 16& 10 \end{array}\right]\\ \end{aligned}

Subtracting matrices

Similarly, to subtract matrices, we subtract the corresponding entries.
For example, let's consider C=[2809]C=\left[\begin{array}{rr}{2} &8 \\ 0 & 9 \end{array}\right] and D=[56113]D=\left[\begin{array}{rr}{5} &6 \\ 11 & 3 \end{array}\right].
We can find CDC-D by subtracting the corresponding entries in matrices CC and DD. This is shown below.
CD=[2809][56113]=[258601193]=[32116]\begin{aligned}C-D&=\left[\begin{array}{rr}{\blueD2} &\blueD8 \\ \blueD0 & \blueD{9} \end{array}\right]-\left[\begin{array}{rr}{\goldD5} &\goldD{6} \\\goldD{ 11} & \goldD{3} \end{array}\right]\\ \\\\\\ &=\left[\begin{array}{rr}{\blueD2-\goldD5} &\blueD{8}-\goldD{6} \\ \blueD{0}-\goldD{11} &\blueD{ 9}-\goldD3 \end{array}\right]\\ \\\\ &=\left[\begin{array}{rr}{-3} &2 \\ -11 & 6 \end{array}\right] \end{aligned}

Check your understanding

3) X=[4161022]X=\left[\begin{array}{rr}{4} &16 \\ 10& 22 \end{array}\right] and Y=[11563]Y=\left[\begin{array}{rr}{1} &15 \\ 6& 3 \end{array}\right].
XY=X-Y=

XY=[4161022][11563]=[411615106223]=[31419]\begin{aligned}X-Y&=\left[\begin{array}{rr}{4} &16 \\ 10& 22 \end{array}\right]-\left[\begin{array}{rr}{1} &15 \\ 6& 3 \end{array}\right]\\ \\\\\\ &=\left[\begin{array}{rr}{4-1} &16-15 \\ 10-6& 22-3 \end{array}\right]\\ \\\\ &=\left[\begin{array}{rr}{3} &1 \\ 4& 19 \end{array}\right] \end{aligned}
4)
[349686734][167642415]={\left[\begin{array}{rrr}{3} &4&9 \\ 6& 8&6 \\ 7& 3&4 \end{array}\right]}-\left[\begin{array}{rrr}{1} &6&7 \\ 6& 4&2 \\4&1&5 \end{array}\right]=

[349686734][167642415]=[314697668462743145]=[222044321]\begin{aligned}{\left[\begin{array}{rrr}{3} &4&9 \\ 6& 8&6 \\ 7& 3&4 \end{array}\right]}-\left[\begin{array}{rrr}{1} &6&7 \\ 6& 4&2 \\4&1&5 \end{array}\right]&={\left[\begin{array}{rrr}{3-1} &4-6&9-7 \\ 6-6& 8-4&6-2 \\ 7-4& 3-1&4-5 \end{array}\right]}\\ \\\\ &=\left[\begin{array}{rrr}{2} &-2&2 \\ 0& 4&4 \\3&2&-1 \end{array}\right]\\ \end{aligned}

Matrix equations

A matrix equation is simply an equation in which the variable stands for a matrix.
For example, the equation below is a matrix equation.
A+[3522]=[101012] A+{\left[\begin{array}{rr}{3} &5 \\ 2& 2 \end{array}\right]}={\left[\begin{array}{rr}{1} &0 \\ 10& 12 \end{array}\right]}
A variable substitution makes solving this matrix equation easy.
If we let B=[3522]{\greenD B= \greenD{ {\left[\begin{array}{rr}{3} &5 \\ 2& 2 \end{array}\right]}}} and C=[101012]{\purpleC C=\purpleC{{\left[\begin{array}{rr}{1} &0 \\ 10& 12 \end{array}\right]}}}, we obtain this equation:
A+B=CA=CBSubtract B\begin{aligned}A+\greenD B&=\purpleC C\\\\ A&=\purpleC C-\greenD B\qquad\text{Subtract B} \end{aligned}
We can now substitute matrices B{B} and C{C} and solve for AA.
A=CB=[101012][3522]=[1305102122]=[25810]\begin{aligned}A &=\purpleC{C}-\greenD{B}\\\\\\ &=\purpleC{{\left[\begin{array}{rr}{1} &0 \\ 10& 12 \end{array}\right]}}{-\greenD{\left[\begin{array}{rr}{3} &5 \\ 2& 2 \end{array}\right]}}\\\\\\ &=\left[\begin{array}{rr}{1-3} &0-5 \\ 10-2&12-2 \end{array}\right]\\\\\\ &=\left[\begin{array}{rr}{-2} &-5 \\ 8& 10 \end{array}\right]\\ \end{aligned}
In general, we solve a matrix equation just like we would solve any linear equation, except that the operations we perform are with matrices!

Check your understanding

5) Solve for BB.
   B[16193]=[4281]~~~B-{\left[\begin{array}{rr}{1} &6 \\ 19& 3 \end{array}\right]}={\left[\begin{array}{rr}{4} &2 \\ 8& 1 \end{array}\right]}
B=B=

If we let A=[16193]A={\left[\begin{array}{rr}{1} &6 \\ 19& 3 \end{array}\right]} and C=[4281]C={\left[\begin{array}{rr}{4} &2 \\ 8& 1 \end{array}\right]}, we can rewrite the matrix equation as BA=CB-A=C.
Solving for BB, we get B=C+AB=C+A
We can now substitute matrices C{C} and A{A} and solve for BB.
B=C+A=[4281]+[16193]=[4+12+68+191+3]=[58274]\begin{aligned} B&=C+A\\\\ &={\left[\begin{array}{rr}{4} &2 \\ 8& 1 \end{array}\right]}{+{\left[\begin{array}{rr}{1} &6 \\ 19& 3 \end{array}\right]}} \\\\\\&={\left[\begin{array}{}{4+1} &2+6 \\8+19& 1+3 \end{array}\right]}\\ \\\\ &=\left[\begin{array}{rr}{5} &8 \\ 27&4 \end{array}\right] \end{aligned}
6) Solve for CC.
   [511261317]+C=[01320414]~~~{\left[\begin{array}{rr}{5} &11 \\ -2& 6 \\13&-17 \end{array}\right]}+C={\left[\begin{array}{rr}{0} &1 \\ -3&20 \\4&14 \end{array}\right]}
C=C=

If we let A=[511261317]A={\left[\begin{array}{rr}{5} &11 \\ -2& 6 \\13&-17 \end{array}\right]} and B=[01320414]B={\left[\begin{array}{rr}{0} &1 \\ -3&20 \\4&14 \end{array}\right]}, we can rewrite the matrix equation as A+C=BA+C=B.
Solving for CC, we get C=BAC=B-A
We can now substitute matrices B{B} and A{A} and solve for CC.
C=BA=[01320414][511261317]=[   05  1113(2)206   41314(17)]=[510114931]\begin{aligned}C&=B-A\\\\ &={\left[\begin{array}{rr}{0} &1 \\ -3&20 \\4&14 \end{array}\right]}{-{\left[\begin{array}{rr}{5} &11 \\ -2& 6 \\13&-17 \end{array}\right]}}\\\\\\ &={\left[\begin{array}{}{~~~0-5} &~~1-11 \\ -3-(-2)&20-6 \\~~~4-13&14-(-17) \end{array}\right]}\\ \\\\ &={\left[\begin{array}{rr}{-5} &-10 \\ -1& 14 \\-9&31 \end{array}\right]} \end{aligned}
Loading