# Miscellaneous Matrix Operations and Definitions

Printer-friendly version

### Review: The following material reviews basic matrix definitions and operations.

#### Transpose of a Matrix

Definition: The transpose of a matrix $$A$$ is a matrix in which the rows of the transpose are the columns of $$A$$ (so the columns of the transpose are the rows of $$A$$). The transpose of $$A$$ is denoted as $$A'$$.

Example 3: For the matrix 4 ×2 matrix, $$A=\left(\begin{array}{ll}3 & 6\\ 2 & 5\\ 3 & 7\\ 1 & 8\end{array}\right)$$

the transpose is the 2 ×4 matrix $$A' =\left(\begin{array}{llll}3 & 2 & 3 & 1\\6 & 5 & 7 & 8\end{array}\right)$$

#### Symmetric Matrices

Definition: A square matrix $$\textbf{A}$$ is symmetric if $$a_{ij}=a_{ji}$$ for all i and jThat is throughout the matrix, the element in the ith row and jth column equals the element in the jth row and ith column. Said another way, a matrix is symmetric when, $$\textbf{A}'$$ = $$\textbf{A}$$. Important examples of symmetric matrices in multivariate statistics include the variance-covariance matrix and the correlation matrix. These shall be defined when we consider descriptive statistics.

Example 4:  Following is an example of a symmetric matrix. Notice that the first row and the first column are identical, the second row and the second column are the same, and that the third row is the same as the third column.

$$\left(\begin{array}{lll}4&2&1\\2&3&0\\1&0&5\end{array}\right)$$

Two matrices may be added if and only if they have the same dimensions (same number of rows and also same number of columns as each other. To add two matrices, add corresponding elements (in terms of location).

Example 5:

$$\left(\begin{array}{ll}2&4\\6&8\end{array}\right)+\left(\begin{array}{ll}1&3\\5&7\end{array}\right)=\left(\begin{array}{ll}2+1&4+3\\6+5&8+7\end{array}\right)=\left(\begin{array}{ll}3&7\\11&15\end{array}\right)$$

Note: One matrix is subtracted from another in the same way that matrices are added. To do the subtraction, subtract each element of the first matrix from the corresponding (in location) element of the first matrix

#### Multiplying a Matrix by a Scalar

Definition: The word scalar is a synonym for a numerical constant. (In matrix terms, a scalar is a matrix with one row and one column.)

To multiply a matrix by a scalar, multiply each element in the matrix by the scalar.

Example 6:  In this example, we multiply a matrix by the value 3.

$$3\left(\begin{array}{ll}2&4\\6&8\end{array}\right)=\left(\begin{array}{ll}3\times 2&3\times 4\\3\times 6&3\times 8\end{array}\right)=\left(\begin{array}{ll}6&12\\18&24\end{array}\right)$$

#### Multiplication of Matrices

To be able to perform the matrix multiplication$$\textbf{C}=\textbf{A}\times \textbf{B}$$, the number of columns in the matrix $$\textbf{A}$$ must equal the number of rows in the matrix $$\textbf{B}$$.

The element in the ith row and jth column of the answer matrix $$\textbf{C}$$, is the cross product sum of the ith row of the matrix $$\textbf{A}$$ and the jth column of the matrix $$\textbf{B}$$. This is done of all combinations of rows of $$\textbf{A}$$ and columns of $$\textbf{B}$$.

Example 7

We’ll carry out the multiplication $$\textbf{A}\times \textbf{B} = \left(\begin{array}{ll}1&2\\2&3\\4&3\end{array}\right) \times \left(\begin{array}{ll}4&2\\1&3\end{array}\right)$$.

The answer is $$\textbf{C}= \left( \begin{array}{ll}1 \times 4+2 \times 1 & 1 \times 2 + 2 \times 3\\ 2 \times 4 +3 \times 1 & 2 \times 2 + 3 \times 3 \\ 4 \times 4 + 3 \times 1 & 4 \times 2+ 3 \times 3\end{array}\right) = \left( \begin{array}{ll}6 &8\\11&13\\19&17\end{array}\right)$$.

Notice, for instance, that the element in the 1st row and 1st column of the answer $$\textbf{C}$$ is the cross product sum of the 1st row of $$\textbf{A}$$ and the 1st column of $$\textbf{B}$$. As another example, the 2nd row, 1st column element of $$\textbf{C}$$ is the cross product sum of the 2nd row of $$\textbf{A}$$ and the 1st column of $$\textbf{B}$$.

#### The Identity Matrix

Definition; An  identity matrix is a square matrix that has the value one in each main diagonal position (from upper left to bottom right) and has the value 0 in all other locations.

As an example of an identity matrix, the 3×3 identity matrix is $$\textbf{I}=\left(\begin{array}{lll}1&0&0\\0&1&0\\0&0&1\end{array}\right)$$.

$$\textbf{I}$$ is called the identity matrix because multiplication of any square matrix $$\textbf{A}$$ by the identity matrix yields the original matrix $$\textbf{A}$$ as the answer. That is

$$\textbf{AI}=\textbf{IA}=\textbf{A}$$

#### Matrix Inverse

An inverse (in the traditional sense) can be found only for square matrices.

Defintion: The inverse of a square matrix $$\textbf{A}$$ is the matrix $$\textbf{A}^{-1}$$ such that $$\textbf{A}^{-1}\textbf{A}=\textbf{A}\textbf{A}^{-1}=\textbf{I}$$.

The calculation of an inverse for large matrices is a laborious process that we’ll leave to the computer. For 2 x 2 matrices, however, the formula is relatively simple.

For

$$\textbf{A}=\left(\begin{array}{ll}a_{11}&a_{12}\\a_{21}&a_{22}\end{array}\right)$$,

the inverse is

$$\textbf{A}^{-1}=\frac{1}{a_{11}a_{22}-a_{12}a_{21}}\left(\begin{array}{rr}a_{22} & -a_{12}\\-a_{21}&a_{11}\end{array}\right)$$

Example 8:

We’ll determine the inverse of $$\textbf{A}=\left(\begin{array}{ll}10 & 6\\8&5\end{array}\right)$$  .

The inverse is $$\textbf{A}^{-1}=\frac{1}{10 \times 5 - 6 \times 8}\left(\begin{array}{rr}5 & -6\\-8 & 10\end{array}\right) = \frac{1}{2}\left(\begin{array}{rr}5 & -6\\-8 & 10\end{array}\right) = \left(\begin{array}{rr}2.5 & -3\\-4 & 5\end{array}\right)$$.

You might want to check that $$\textbf{A}^{-1}\textbf{A}=\textbf{I}$$.  (It does!)