While a matrix is a mathematical representation of the network, taking the matrix and performing mathematical operations on the matrix can actually unveil patterns or features about the social world that we are trying to understand through the network. While the matrices we’ve worked with so far are simple, recall that in reality networks can be as complicated as the social world they represent. Facebook’s friendship networks, the connections between servers on the World Wide Web, and airline transportation networks have millions of nodes and edges. It’s important to understand some of the fundamentals of how to manipulate a matrix if we were to ever look at networks beyond many of the simple examples in this book.
Adding two matrices together is a relatively straightforward matter. By taking two matrices of the same dimension nXm, add up each corresponding cell i,j in the two matrices, and return the result into the same cell i,j in a new matrix size nxm.
\[ \begin{equation} \begin{bmatrix} 4 & 2 & 6\\ 3 & -1 & 3\\ \end{bmatrix} +\begin{bmatrix} 5 & 3 & 7\\ 7 & 3 & 4\\ \end{bmatrix} =\begin{bmatrix} 9 & 8 & 13\\ 10 & 2 & 7\\ \end{bmatrix} \end{equation} \] In the above example, cell 1,1 in the first matrix is 4, while in the second matrix the value of cell 1,1 is 5. Adding them together, 9 is returned and placed in cell 1,1 in the resulting new matrix. Similarly, cell 2,3 in the first matrix is 3 and 4 in the second matrix. Cell 2,3 in the summed matrix is thus 7.
Note that we are unable to add together matrices of different dimensions. Only matrices with the same dimenstion nxm are capable of being summed together, as would become easily apparent if you tried. Subtraction of two matrices works in the same way as addition.
Scalar multiplication is essentially the type of multiplication you are familiar with. Taking a single scalar, one can shape the original matrix into an essentially larger or smaller version of itself, the scale changing based on the size of the scalar.
\[ \begin{equation} 3 \begin{bmatrix} 5 & 6 & 3\\ 3 & 2 & 4\\ \end{bmatrix} = \begin{bmatrix} 15 & 18 & 9\\ 9 & 6 & 12\\ \end{bmatrix} \end{equation} \] In the example above, one simply multiplies each cell by the scalar term, in this case 3. Thus, the resulting cell 1,1 is simply the scalar multiplied by cell 1,1 in the original matrix. In this case, 3x5 returns 15, which becomes cell 1,1 of the resulting matrix. This is similarly done for each cell, such that the final cell 2,3 multipled by 3, returns 12, which then is the cell 2,3 in the resulting matrix.
Multiplying matrices is a type of multiplication that you are likely unfamiliar with unless you’ve studied some linear alegebra. One thing that will help in learning matrix multiplication is that you should not rely on your prior understanding of multiplication to a large degree.
When we multiply two matrices together, we are fundamentally multipling along rows in the first matrix, and columns in the second matrix. Matrix multiplication is not commutative in the same way normal multiplication is. Multiplying two matrices together, in different orders, will not give the same results.
\[ \begin{equation} {[n_1*m_1][n_2*m_2]} \end{equation} \]
\[ \begin{equation} \begin{bmatrix} 5 & 6 & 3\\ 3 & 2 & 2\\ \end{bmatrix} \begin{bmatrix} 5 & 6 \\ 5 & 6 \\ 5 & 6\\ \end{bmatrix} = \begin{bmatrix} 70 & 88 \\ 35 & 42\\ \end{bmatrix} \end{equation} \]
Left to Right Right Down