BioStart Logo

Matrix Algebra and Definitions: Learning Objectives 5, 6

Question 1: Let \[A = \begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix}, B = \begin{bmatrix} 1 & 2\\3&4\\5&6\\7&8 \end{bmatrix}, C= \begin{bmatrix} 1 & 4 & 7\\ 2 & 5 & 8 \end{bmatrix} \] Find the transpose of each matrix.

The transpose of a matrix is found by interchanging its rows and columns. The first row becomes the first column, the second row becomes the second column, and so on. An $m \times n$ matrix becomes an $n \times m$ matrix.

a) $A^T = \begin{bmatrix} 1 & 3 \\ 2 & 4 \end{bmatrix}$

b) $B^T = \begin{bmatrix} 1 & 3 & 5 & 7\\ 2 & 4 & 6 & 8 \end{bmatrix}$

c) $C^T = \begin{bmatrix} 1 & 2 \\ 4 & 5 \\ 7 & 8 \end{bmatrix}$

Question 2: Let \[ A = \begin{bmatrix} -4 & 9 & 4\\ -3 & 10 & -4 \\ 1 & 0 & 6 \end{bmatrix}, B= \begin{bmatrix} -3 &-8 & 10\\ 1 & -5 & -9 \\ -10 & 2 & 4 \end{bmatrix}, C= \begin{bmatrix} -1 & 5 & 4\\ 8 & 1 & 9 \\ -6 & 8 & -3 \end{bmatrix}\] Evaluate the following:
  1. $(A+B)^T$
  2. $(AB)^T$
  3. $(C^TA)^T$

You can either perform the operations inside the parentheses first and then take the transpose, or use the properties of transposes, such as $(X+Y)^T = X^T+Y^T$ and $(XY)^T = Y^TX^T$.

  1. $\begin{bmatrix} -7 & -2 & -9\\ 1 & 5 & 2 \\ 14 & -13 & 10 \end{bmatrix}$
  2. $\begin{bmatrix} -19 & 59 & -63\\ -5 & -34 & 4 \\ -105 & -136 & 34 \end{bmatrix}$
  3. $\begin{bmatrix} -26 & 71 & -72\\ -15 & 55 & 64 \\ -46 & 126 & -38 \end{bmatrix}$

a) $A+B = \begin{bmatrix} -7 & 1 & 14\\ -2 & 5 & -13 \\ -9 & 2 & 10 \end{bmatrix}$. So, $(A+B)^T = \begin{bmatrix} -7 & -2 & -9\\ 1 & 5 & 2 \\ 14 & -13 & 10 \end{bmatrix}$.

b) $AB = \begin{bmatrix} -19 & -5 & -105 \\ 59 & -34 & -136 \\ -63 & 4 & 34 \end{bmatrix}$. So, $(AB)^T = \begin{bmatrix} -19 & 59 & -63\\ -5 & -34 & 4 \\ -105 & -136 & 34 \end{bmatrix}$.

c) Using the property $(XY)^T = Y^TX^T$, we have $(C^TA)^T = A^T(C^T)^T = A^TC$. \[ A^TC = \begin{bmatrix} -4 & -3 & 1\\ 9 & 10 & 0 \\ 4 & -4 & 6 \end{bmatrix} \begin{bmatrix} -1 & 5 & 4\\ 8 & 1 & 9 \\ -6 & 8 & -3 \end{bmatrix} = \begin{bmatrix} 4-24-6 & -20-3+8 & -16-27-3 \\ -9+80 & 45+10 & 36+90 \\ -4-32-36 & 20-4+48 & 16-36-18 \end{bmatrix} = \begin{bmatrix} -26 & -15 & -46\\ 71 & 55 & 126 \\ -72 & 64 & -38 \end{bmatrix} \]

Question 3: Let $X$ and $Y$ be $n\times n$ matrices. For each of the following equalities, show that the given property is true or provide a counterexample.
  1. $(X+Y)^T = X^T +Y^T$
  2. $(XY)^T = X^TY^T$
  3. $(XY)^T = Y^TX^T$
  4. $(cX)^T = c(X^T)$
  5. $(cX)^T = \frac{1}{c}X^T$

You can prove the true properties using an element-wise argument. For the false ones, try to construct a simple $2 \times 2$ counterexample.

  1. True.
  2. False.
  3. True.
  4. True.
  5. False.

a) True. The transpose of a sum is the sum of the transposes. $[(X+Y)^T]_{ij} = (X+Y)_{ji} = X_{ji}+Y_{ji} = (X^T)_{ij}+(Y^T)_{ij} = [X^T+Y^T]_{ij}$.

b) False. The order of multiplication is reversed. Let $X = \begin{bmatrix} 1 & 2 \\ 0 & 1 \end{bmatrix}$ and $Y = \begin{bmatrix} 2 & 0 \\ 1 & 1 \end{bmatrix}$. Then $(XY)^T = \begin{bmatrix} 4 & 1 \\ 2 & 1 \end{bmatrix}$, but $X^TY^T = \begin{bmatrix} 1 & 0 \\ 2 & 1 \end{bmatrix}\begin{bmatrix} 2 & 1 \\ 0 & 1 \end{bmatrix} = \begin{bmatrix} 2 & 1 \\ 4 & 3 \end{bmatrix}$.

c) True. This is the correct property for the transpose of a product. Let $Z = XY$. Then $Z_{ij} = \sum_k X_{ik}Y_{kj}$. The element in row $j$, column $i$ of $Z^T$ is $Z_{ji} = \sum_k X_{jk}Y_{ki}$. Now consider $Y^TX^T$. The element in row $j$, column $i$ is $\sum_k (Y^T)_{jk}(X^T)_{ki} = \sum_k Y_{kj}X_{ik}$, which is the same.

d) True. A scalar can be factored out of the transpose operation. $[(cX)^T]_{ij} = (cX)_{ji} = c \cdot X_{ji} = c \cdot (X^T)_{ij} = [c(X^T)]_{ij}$.

e) False. Let $X$ be the $2 \times 2$ identity matrix ($I_2$) and $c = 2$. Since $X$ is symmetric $X^T = X$. However $(cX)^T = 2 I_2 \neq \frac{1}{2} I_2 = \frac{1}{c}X^T$.

Question 4: Let \( M = \begin{bmatrix} 3 & -1 & 2\\ 0 & 4 & 5 \\ -2 & 1 & 6 \end{bmatrix} \). The trace of a square matrix is defined as the sum of the elements on its main diagonal.
  1. Use this definition to compute $tr(M)$, the trace of the matrix $M$.
  2. Let $N = 2M$, compute tr($N$).
  3. Show that in general $tr(kM)=k\cdot tr(M)$ for any scalar $k$.
  4. Without computing $M^T$, explain why tr($M^T$) = tr($M$).

The main diagonal runs from the top-left to the bottom-right. The linearity property of trace means $tr(cA) = c \cdot tr(A)$. The transpose operation swaps off-diagonal elements.

  1. 13
  2. 26
  3. The proof follows from the definitions of scalar multiplication and trace.
  4. The diagonal elements remain unchanged by the transpose operation.

a) The elements on the main diagonal are 3, 4, and 6. \[ tr(M) = 3 + 4 + 6 = 13 \] b) $N = 2M = \begin{bmatrix} 6 & -2 & 4\\ 0 & 8 & 10 \\ -4 & 2 & 12 \end{bmatrix}$. \[ tr(N) = 6 + 8 + 12 = 26 \] c) Let $M$ be an $n \times n$ matrix. \[ tr(kM) = \sum_{i=1}^n (kM)_{ii} = \sum_{i=1}^n k \cdot M_{ii} = k \sum_{i=1}^n M_{ii} = k \cdot tr(M) \] d) The transpose of a matrix swaps elements across the main diagonal (i.e., it swaps $m_{ij}$ and $m_{ji}$). The elements on the main diagonal ($m_{ii}$) are not affected by this operation. Since the trace is the sum of only the diagonal elements, and these elements are unchanged, the trace remains the same.

Question 5: Let $X$ and $Y$ be $n \times n$ matrices.
  1. Show that tr($X+Y$) = tr($Y+X$).
  2. Show that tr($XY$) = tr($YX$).

For part (a), use the property that $tr(A+B)=tr(A)+tr(B)$ and the commutativity of scalar addition. For part (b), write out the formula for a diagonal element of a matrix product, $(AB)_{ii}$, using summation notation. Then write out the formula for the trace and see if you can manipulate the summations.

a) We use two properties of the trace: $tr(A+B) = tr(A)+tr(B)$ and the fact that the trace is a scalar. \[ tr(X+Y) = tr(X) + tr(Y) \] Since addition of real numbers is commutative, $tr(X)+tr(Y) = tr(Y)+tr(X)$. \[ tr(Y)+tr(X) = tr(Y+X) \] Therefore, $tr(X+Y) = tr(Y+X)$.

b) The element on the diagonal of the product $XY$ is given by: \[ (XY)_{ii} = \sum_{k=1}^n x_{ik}y_{ki} \] The trace of $XY$ is the sum of these diagonal elements: \[ tr(XY) = \sum_{i=1}^n (XY)_{ii} = \sum_{i=1}^n \sum_{k=1}^n x_{ik}y_{ki} \] Now, let's look at the trace of $YX$. The element on the diagonal of $YX$ is: \[ (YX)_{kk} = \sum_{i=1}^n y_{ki}x_{ik} \] The trace of $YX$ is the sum of these diagonal elements: \[ tr(YX) = \sum_{k=1}^n (YX)_{kk} = \sum_{k=1}^n \sum_{i=1}^n y_{ki}x_{ik} \] Since the order of summation can be interchanged and scalar multiplication is commutative ($y_{ki}x_{ik} = x_{ik}y_{ki}$), the two expressions are equivalent: \[ \sum_{i=1}^n \sum_{k=1}^n x_{ik}y_{ki} = \sum_{k=1}^n \sum_{i=1}^n x_{ik}y_{ki} \] Therefore, $tr(XY) = tr(YX)$.
©