\r\n Matrices can be added together, subtracted from each other, and multiplied with each other. In this lesson, we will learn how to add two matrices.\r\n
\r\n\r\n Two matrices may only be added if they have exactly the same layout, i.e.,\r\n the number of rows must match between the matrices to be added\r\n and the number of columns must also match. The resultant matrix has the same number\r\n of rows and columns as the input matrices.\r\n For example — consider the following two matrices.\r\n $$\r\n \\mathbf{A} = \\begin{bmatrix}\r\n 1 & 4 \\\\\r\n -1 & 1 \\\\\r\n \\end{bmatrix}\r\n \\qquad\r\n \\mathbf{B} = \\begin{bmatrix}\r\n 10 & 2 \\\\\r\n 5 & 7 \\\\\r\n \\end{bmatrix}\r\n $$\r\n These matrices can be added together since they have same number of rows and columns.
\r\n Next, consider the following two matrices.\r\n $$\r\n \\mathbf{C} = \\begin{bmatrix}\r\n 7 & 6 & 1 \\\\\r\n 4 & 1 & 8 \\\\\r\n \\end{bmatrix}\r\n \\qquad\r\n \\mathbf{D} = \\begin{bmatrix}\r\n 3 & 2 \\\\\r\n 7 & 1 \\\\\r\n 3 & -11 \\\\\r\n \\end{bmatrix}\r\n $$\r\n These matrices, while they are valid on their own, cannot be added\r\n together because they don't have the same number of rows and columns.\r\n
\r\n In order to add matrices together, we look at the corresponding elements\r\n of each matrix and add those together to produce the result.\r\n\r\n Let's add matrix \\( \\mathbf{A} \\) and \\( \\mathbf{B} \\) together to form\r\n the matrix \\( \\mathbf{S} \\). In other words,\r\n\r\n $$\r\n \\mathbf{S} = \\mathbf{A} + \\mathbf{B}\r\n $$\r\n\r\n Let's start from the top-left. The top-left component of matrix \\( \\mathbf{A} \\) is\r\n \\( A_{11} \\). The top-left component of matrix \\( \\mathbf{B} \\) is \\( B_{11} \\). The top-left\r\n component of the resultant matrix, \\( S_{11} \\), is simply the sum of the top-left\r\n components of \\( \\mathbf{A} \\) and \\( \\mathbf{B} \\):\r\n\r\n $$\r\n S_{11} = A_{11} + B_{11}\r\n $$\r\n\r\n This is true for each component (so the top-right component of \\(\r\n \\mathbf{S} \\) is simply the sum of the top-right components of \\(\r\n \\mathbf{A} \\) and \\( \\mathbf{B} \\) and so on).\r\n\r\n Therefore the sum is:\r\n $$\r\n \\begin{aligned}\r\n \\mathbf{S} &= \\mathbf{A} + \\mathbf{B} \\\\\r\n \\mathbf{S} &= \\begin{bmatrix}\r\n 1 & 4 \\\\\r\n -1 & 1 \\\\\r\n \\end{bmatrix}\r\n +\r\n \\begin{bmatrix}\r\n 10 & 2 \\\\\r\n 5 & 7 \\\\\r\n \\end{bmatrix} \\\\\r\n \\mathbf{S} &= \\begin{bmatrix}\r\n 1 + 10 & 4 + 2 \\\\\r\n -1 + 5 & 1 + 7 \\\\\r\n \\end{bmatrix} \\\\\r\n \\mathbf{S} &= \\begin{bmatrix}\r\n 11 & 6 \\\\\r\n 4 & 8 \\\\\r\n \\end{bmatrix} \\\\\r\n \\end{aligned}\r\n $$\n
\r\n
\r\n
\r\n This MagicGraph offers a visually interactive illustration that explains how matrix addition works.\r\n You are given two matrices \\(\\mathbf A\\) and \\(\\mathbf B\\). These matrices have the same number of rows and the same number of columns.\r\n Matrix \\(\\mathbf M\\) is the sum of matrices \\(\\mathbf A\\) and \\(\\mathbf B\\).\n
\r\n\r\n This MagicGraph offers a visually interactive exercise to test your knowledge of matrix addition.\r\n You are given two matrices \\(\\mathbf A\\) and \\(\\mathbf B\\).\r\n These matrices have the same number of rows and the same number of columns.\r\n Your goal is to determine matrix \\(\\mathbf M\\) which is the sum of matrices \\(\\mathbf A\\) and \\(\\mathbf B\\).\r\n
\r\n