ekiim's blog

## Exercises

1. Compute the products

 $\begin{bmatrix} 4 & 0 & 1 \\ 0 & 1 & 0 \\ 4 & 0 & 1 \\ \end{bmatrix} \begin{bmatrix} 3 \\ 4 \\ 5 \end{bmatrix}$ And $\begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \\ \end{bmatrix} \begin{bmatrix} 5 \\ -2 \\ 3 \end{bmatrix}$ And $\begin{bmatrix} 2 & 0 \\ 1 & 3 \end{bmatrix} \begin{bmatrix} 1 \\ 1 \end{bmatrix}$

Draw a pair of perpendicular axes and mark off the vectors two the points $x=2, y=1$, and $x=0, y=3$. Add the two vectors by completng the parallelogram.

2. Working a column at a time, compute the products

 $\begin{bmatrix} 4 & 1 \\ 5 & 1 \\ 6 & 1 \\ \end{bmatrix} \begin{bmatrix} 1 \\ 3 \end{bmatrix}$ And $\begin{bmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \\ \end{bmatrix} \begin{bmatrix} 0 \\ 1 \\ 0 \end{bmatrix}$ And $\begin{bmatrix} 4 & 3 \\ 6 & 6 \\ 8 & 9 \end{bmatrix} \begin{bmatrix} \frac{1}{2} \\ \frac{1}{3} \end{bmatrix}$
3. Find two inner products and a matrix product:

 $\begin{bmatrix} 1 & -2 & 7 \end{bmatrix} \begin{bmatrix} 1 \\ -2 \\ 7 \end{bmatrix}$ And $\begin{bmatrix} 1 & -2 & 7 \end{bmatrix} \begin{bmatrix} 3 \\ 5 \\1 \end{bmatrix}$ And $\begin{bmatrix} 1 \\ -2 \\ 7 \end{bmatrix} \begin{bmatrix} 3 & 5 &1 \end{bmatrix}$

The first gives the lengths of the vector (squared).

4. If an $m$ by $n$ matrix $A$ multiplies an $n$-dimensional vector $x$, how many eparate multiplications are involved? What if $A$ multiplies an $n$ by $p$ matrix $B$?

5. Compute the product $Ax = \begin{bmatrix} 3 & -6 & 0 \\ 0 & 2 & -2 \\ 1 & -1 & -1 \\ \end{bmatrix} \begin{bmatrix} 2 \\ 1 \\ 1 \end{bmatrix}$ For this matrix $A$, find a solution vector to the system $Ax=0$, which zeros on the right side of all three equations. Can you find more than one solution?

6. Write down the 3 by 2 matrices $A$ and $B$ which have entries $a_{ij} = i + j$ and $b_{ij} = (-1)^{i+j}$.

7. Express the inner product of the row vector $y=\begin{bmatrix} y_1 & y_2 & \dots & y_n \end{bmatrix}$, and the column vector $x$ in summation notation.

8. Give a 3 by 3 example (not just $A=0$) of

1. a diagonal matrix: $a_{ij} = 0 if $i \neq j$; 2. a symetric matrix: $a_{ij} = a_{ji}$ for all $i$ and $j$; 3. a upper triangular matrix: $a_{ij} = 0$ if $i > j$; 4. a skew-symmetric matrix: $a_{ij} = -a_{ji}$ for all $i$ and $j$. 9. Do the following subroutines multiply $Ax$ by rows or columns?  DO $10I = 1, N$ DO $10J = 1, N$ 10 $B(I) = B(I) + A(I,J) * X(J)$ DO $10J = 1, N$ DO $10I = 1, N$ 10 $B(I) = B(I) + A(I,J) * X(J)$ The result are mathematically equivalent, assuming that initially all $B(I) = 0$, but the structure of FORTRAN makes the second code slightly more efficient (Appendix C). It is much more efficient on a vector machine like the CRAY, since the inner loop can change many$B(I) at once — where the first code makes any changes to a single B(I) and does not vectorize.

10. If the entries of $A$ are $a_{ij}$, use subscript notation to write down

1. the first pivot
2. the multiplier $I_{i1}$, of row 1 to be substracted from row $i$
3. the new entry that replaces $a_ij$ after that substraction
4. the second pivot
11. True or false; give a specific counterexample when false

1. If the first and third columns of $B$ are the same, so are the first and third columns of $AB$
2. If the first and third rows of $B$ are the same, so are the first and third rows of $AB$
3. If the first and third rows of A are the same, so are the first and third rows of $AB$.
4. $(AB)^2 = A^2B^2$
12. The first row of $AB$ is a linear combination of all the rows of $B$. What are the coefficients in this combination, and what is the first row of $AB$ if $A = \begin{bmatrix} 2&1&4\\0&-1&1\end{bmatrix}, B=\begin{bmatrix}1&1\\0&1\\1&0\end{bmatrix}\text{?}$

13. The product of two lower triangular matrices is again lower triangular (all its entries abover the main diagonal are zero). Confirm this with a 3 by 3 example, and then explan how it follows from the laws of matrix multiplication.

14. By trial and error find examples of 2 by 2 matrices such that

1. $A^2 = -I$, having only real entries;
2. $B^2 = 0$, although $B\neq0$
3. $CD = -DC$, not allowing the case $CD=0$
4. $FE=0$, although no enteries of $E$ or $F$ are zero.
15. Describe the rows of $EA$ and the columns of $AE$ if $E\begin{bmatrix}1&7\\0&1\end{bmatrix}$

16. Check the associative law $(EF)G=E(FG)$ for matrices in the text.

17. Suppose $A$ commutes with every 2 by 2 matrix ($AB=BA$) and in particular

 $A=\begin{bmatrix}a&b\\c&d\end{bmatrix}$ commutes with $B_1=\begin{bmatrix}1&0\\0&0\end{bmatrix}$ and $B_2=\begin{bmatrix}0&1\\0&0\end{bmatrix}$

Show that $a=d$ and $b=c=0$ if $AB=BA$ for all matrices $B$, then $A$ is a mupliple of the identity.

18. Let $x$ be the column vector with components $1, 0,\dots, 0$. Show that the rule $(AB)x=A(Bx)$ forces the first column of $AB$ to equal $A$ times the first column of $B$.

19. Which of the following matrices are guaranteed to equal $(A + B)^2$? $(B+A)^2, (A^2 + 2AB+B^2),A(A+B) + B(A+B), (A+B)(A+B), A^2 + AB + BA + B^2$

20. In summation notation, the $i, j$ entries of $AB$ is $(AB)_{ij} = \sum_k a_{ik}b_{kj}$, If $A$ and $B$ are $n$ by $n$ matrices with all entries equal to 1, find $(AB)_{ij}$. The same notation turns associative law $(AB)C=A(BC)$ in to $\sum_j(\sum_k a_{ik}b_{kj})c_jl = \sum_k a_{ik}(\sum_j b_{kj}c_{jl})$ Compute both sides if $C$ is alos $n$ by $n$, with every $c_{jl} = 2$.

21. There is a forth way of looking at matrix multilication, as columns times roews. If the columns of $A$ are $c_1, \dots, c_n$, and the rows of $B$ are vectors $r_1, \dots r_n$, then $c_ir_i$ is the matrix and $AB = c_1r_1 + c_2r_2 + \dots + c_nr_n$

1. Give a 2 by 2 example of this rule for matrix mutiplication.
2. Explain whi the right side gives the correct value $\sum_{k=1}^n a_{ik}b_{kj}$ for very entry $(AB)_{ij}$
22. The matrices that “rotate” the $x-y$ plane are $A(\theta) = \begin{bmatrix} \cos{\theta} & -\sin{\theta} \\\ \sin{\theta} & \cos{\theta} \end{bmatrix}$.

1. Verify $A(\theta_1)A(\theta_2) = A(\theta_1 + \theta_2)$ from the identities for $\cos(\theta_1+\theta_2)$ and $\cos(\theta_1+\theta_2)$.
2. What is $A(\theta)$ times $A(-\theta)$.
23. For the matrices $A = \begin{bmatrix} \frac{1}{2} & \frac{1}{2} \\ \frac{1}{2} & \frac{1}{2} \end{bmatrix} \text{ and } B = \begin{bmatrix} 1 & 0 \\ 0 & -1 \end{bmatrix} \text{ and } C = AB = \begin{bmatrix} \frac{1}{2} & -\frac{1}{2} \\ \frac{1}{2} & -\frac{1}{2} \end{bmatrix}$ find all the powers $A^2, A^3$ (which is $A^2$ times $A$),$\dots$, and $B^2, B^3, \dots$, and $C^2, C^3, \dots$.

24. More general than multiplication by columns is block multiplication. If matrices are separated into blocks (submatrices) and their shape makes block multiplication posible, then it is allowed: $\left[\begin{array}{cc|c} x & x & x \\ x & x & x \\ \hline x & x & x \end{array}\right] \left[\begin{array}{cc|c} x & x & x \\ x & x & x \\ \hline x & x & x \end{array}\right] \text{ or } \left[\begin{array}{cc|cc} x & x & x & x \\ x & x & x & x \end{array}\right] \left[\begin{array}{cc} x & x \\ x & x \\ \hline x & x \\ x & x \end{array}\right] \text{ or } \dots$

1. Replace those x’s by numbers and confirm that block multiplication succeds.
2. Give two more examples (with x’s) if $A$ is 3 by 4 and $B$ is 4 by 2. Vertical cuts in $A$ must match by horizonal cuts in $B$.