A.Kaw矩阵代数初步学习笔记 3. Binary Matrix Operations
“矩阵代数初步”(Introduction to MATRIX ALGEBRA)课程由Prof. A.K.Kaw(University of South Florida)设计并讲授。
PDF格式学习笔记下载(Academia.edu)
第3章课程讲义下载(PDF)
Summary
- Addition of matrices
Two matrices $[A]$ and $[B]$ can be added only if they are the same size. The addition is then shown as $$[C]=[A]+[B]$$ where $$c_{ij}=a_{ij} + b_{ij}$$ For example $$\begin{bmatrix}5& 2& 3\\ 1& 2& 7\end{bmatrix} + \begin{bmatrix}6& 7& -2\\ 3& 5& 19\end{bmatrix}$$ $$= \begin{bmatrix}5 + 6& 2 + 7& 3 - 2\\ 1 + 3& 2 + 5& 7 + 19\end{bmatrix} = \begin{bmatrix}11& 9& 1\\ 4& 7& 26\end{bmatrix}$$ - Subtraction of matrices
Two matrices $[A]$ and $[B]$ can be subtracted only if they are the same size. The subtraction is then given by $$[D] = [A]-[B]$$ where $$d_{ij}=a_{ij} - b_{ij}$$ For example $$\begin{bmatrix}5& 2& 3\\ 1& 2& 7\end{bmatrix} - \begin{bmatrix}6& 7& -2\\ 3& 5& 19\end{bmatrix}$$ $$= \begin{bmatrix}5 - 6& 2 - 7& 3 -(-2)\\ 1 - 3& 2 - 5& 7 - 19\end{bmatrix} = \begin{bmatrix}-1& -5& 5\\ -2& -3& -12\end{bmatrix}$$ - Multiplication of matrices
Two matrices $[A]$ and $[B]$ can be multiplied only if the number of columns of $[A]$ is equal to the number of rows of $[B]$ to give $$[C]_{m\times n}=[A]_{m\times p}\cdot[B]_{p\times n}$$ where $$c_{ij}=a_{i1}b_{1j}+a_{i2}b_{2j}+\cdots+a_{ip}b_{pj}= \sum_{k=1}^{p}a_{ik}b_{kj}$$ for each $i=1, \cdots, m$ and $j=1, \cdots, n$.
That is, the $i$-th row and the $j$-th column of $[C]$ is calculated by multiplying the $i$-th row of $[A]$ by the $j$-th column of $[B]$: $$c_{ij}=\begin{bmatrix}a_{i1} & a_{i2}& \cdots & a_{ip}\end{bmatrix}\cdot \begin{bmatrix}b_{1j}\\ b_{2j}\\ \vdots\\ b_{pj}\end{bmatrix}$$ For example, $$A=\begin{bmatrix}5& 2& 3\\ 1& 2& 7\end{bmatrix},\ B=\begin{bmatrix}3& -2\\ 5& -8\\ 9& -10\end{bmatrix},\ C=A\cdot B$$ we have $$c_{11}=\begin{bmatrix}5& 2& 3\end{bmatrix}\cdot \begin{bmatrix}3\\ 5\\ 9\end{bmatrix}=15+10+27=52,\ c_{12}=\begin{bmatrix}5& 2& 3\end{bmatrix}\cdot \begin{bmatrix}-2\\ -8\\ -10\end{bmatrix}=-10 -16 -30 = -56,$$ $$c_{21}=\begin{bmatrix}1& 2& 7\end{bmatrix}\cdot \begin{bmatrix}3\\ 5\\ 9\end{bmatrix}=3+10+63=76,\ c_{22}=\begin{bmatrix}1& 2& 7\end{bmatrix}\cdot \begin{bmatrix}-2\\ -8\\ -10\end{bmatrix}=-2-16-70=-88,$$ $$\Rightarrow C=\begin{bmatrix}52& -56\\ 76& -88\end{bmatrix}.$$ - Scalar product of matrices
If $[A]$ is a $m\times n$ matrix and $k$ is a real number, then the multiplication $[A]$ by a scalar $k$ is another $m\times n$ matrix $[B]$, where $b_{ij}=ka_{ij}$ for all $i$, $j$. For example, $$2\cdot\begin{bmatrix}5& 2& 3\\ 1& 2& 7\end{bmatrix} = \begin{bmatrix}10& 4& 6\\ 2& 4& 14\end{bmatrix}$$ - Linear combination of matrices
If $[A_1]$, $[A_2]$, $\cdots$, $[A_{p}]$ are matrices of the same size and $k_1$, $k_2$, $\cdots$, $k_p$ are scalars, then $$k_1A_1 + k_2A_2 + \cdots + k_pA_p$$ is called a linear combination of $[A_1]$, $[A_2]$, $\cdots$, $[A_{p}]$. - Rules of binary matrix operation
- Commutative law of addition
If $[A]$ and $[B]$ are $m\times n$ matrices, then $$[A]+[B] = [B] + [A]$$ - Associative law of addition
If $[A]$, $[B]$, and $[C]$ are all $m\times n$ matrices, then $$[A]+([B] + [C]) = ([A] + [B]) + [C]$$ - Associate law of multiplication
If $[A]$, $[B]$, and $[C]$ are $m\times n$, $n\times p$, and $p\times r$ size matrices. respectively. Then $$[A]\cdot([B]\cdot[C]) = ([A]\cdot[B])\cdot[C]$$ and the resulting matrix size on both sides of the equation is $m\times r$. - Distributive law
If $[A]$ and $[B]$ are $m\times n$ size matrices, and $[C]$ and $[D]$ are $n\times p$ size matrices, then $$[A]\cdot([C] + [D]) = [A]\cdot[C] + [A]\cdot[D]$$ $$([A] + [B])\cdot[C] = [A]\cdot[C] + [B]\cdot[C]$$ and the resulting matrix size on both sides of the equation is $m\times p$.
- Commutative law of addition
Selected Problems
1. For the following matrices $$A=\begin{bmatrix}3& 0\\ -1& 2\\ 1& 1\end{bmatrix},\ B=\begin{bmatrix}4& -1\\ 0& 2\end{bmatrix},\ C=\begin{bmatrix}5& 2\\ 3& 5\\ 6& 7\end{bmatrix}.$$ Find where possible $4[A] + 5[C]$, $[A]\cdot[B]$, $[A]-2[C]$.
Solution:
$$4[A] + 5[C] = \begin{bmatrix}12& 0\\ -4& 8\\ 4& 4\end{bmatrix} + \begin{bmatrix}25& 10\\ 15& 25\\ 30& 35\end{bmatrix} = \begin{bmatrix}37& 10\\ 11& 33\\ 34& 39\end{bmatrix}$$ $$[A] \cdot [B] = \begin{bmatrix}12& -3\\ -4& 5\\ 4& 1\end{bmatrix}$$ $$[A]-2[C] = \begin{bmatrix}3& 0\\ -1& 2\\ 1& 1\end{bmatrix} - \begin{bmatrix}10& 4\\ 6& 10\\ 12& 14\end{bmatrix} = \begin{bmatrix}-7& -4\\ -7& -8\\ -11& -13\end{bmatrix}$$
2. Food orders are taken from two engineering departments for a takeout. The order is tabulated in Table 1.

However they have a choice of buying this food from three different restaurants. Their prices for the three food items are tabulated in Table 2.

Show how much each department will pay for their order at each restaurant. Which restaurant would be more economical to order from for each department?
Solution:
Denote the food order and price matrices as $$[A]=\begin{bmatrix}25& 35& 25\\ 21& 20& 21\end{bmatrix},\ [B]=\begin{bmatrix}2.42 & 2.38 & 2.46\\ 0.93 & 0.90 & 0.89\\ 0.95 & 1.03 & 1.13 \end{bmatrix}$$ The total fees matrix $[C]$ is the product of $[A]$ and $[B]$: $$[C]=[A]\cdot [B] = \begin{bmatrix}116.8 & 116.75 & 120.9\\ 89.37 & 89.61 & 93.19\end{bmatrix}$$ Covert it using tabular is shown in Table 3.

Thus, Burcholestrol is the cheapest for the Mechanocal department, which is 116.75. And MacFat is the cheapest for the Civil department, which is 89.37.
3. Given $$[A] = \begin{bmatrix}2& 3& 5\\ 6& 7& 9\\ 2& 1& 3\end{bmatrix},\ [B]= \begin{bmatrix}3& 5\\ 2& 9\\ 1& 6\end{bmatrix} ,\ [C]= \begin{bmatrix}5& 2\\ 3& 9\\ 7& 6\end{bmatrix}.$$ Illustrate the distributive law of binary matrix operations: $$[A]\cdot([B]+[C]) = [A]\cdot[B] + [A]\cdot[C]$$
Solution:
$$[B]+[C] = \begin{bmatrix}8& 7\\ 5& 18\\ 8& 12\end{bmatrix},\ [A]\cdot([B]+[C]) = \begin{bmatrix}71& 128\\ 155& 276\\ 45& 68\end{bmatrix}$$ $$[A]\cdot [B]=\begin{bmatrix}17& 67\\ 41& 147\\ 11& 37\end{bmatrix},\ [A]\cdot [C] = \begin{bmatrix}54& 61\\ 114& 129\\ 34& 31\end{bmatrix}\, [A]\cdot [B]+[A]\cdot [C]= \begin{bmatrix}71& 128\\ 155& 276\\ 45& 68\end{bmatrix}$$ Thus $$[A]\cdot([B]+[C]) = [A]\cdot[B] + [A]\cdot[C]$$
4. Let $[I]$ be a $n\times n$ identity matrix. Show that $[A]\cdot[I] = [I]\cdot[A]=[A]$ for every $n\times n$ matrix $[A]$.
Solution:
Let $[C]_{n\times n}=[A]_{n\times n}\cdot[I]_{n\times n}$. So we have $$c_{ij}=a_{i1}i_{1j} + \cdots + a_{i, j-1}i_{j-1, j} + a_{ij}i_{jj} + a_{i, j+1}i_{j+1, j}+\cdots + a_{in}i_{nj} = \sum_{p=1}^{n} a_{ip}i_{pj}$$ for each of $i=1, \cdots, n$ and $j=1, \cdots, n$. Since $$i_{ij}=\begin{cases}0 & i\neq j \\ 1 & i=j\end{cases}$$ Thus $$c_{ij} = \sum_{p=1}^{n} a_{ip}i_{pj} = a_{ij}i_{jj} = a_{ij}$$ That is, $[A]\cdot[I] = [A]$.
Similarly, denote $[D]_{n\times n}=[I]_{n\times n}\cdot [A]_{n\times n}$, and $$d_{ij}=i_{i1}a_{1j} + \cdots + i_{i, i-1}a_{i-1, j} + i_{ii}a_{ij} + i_{i, i+1}a_{i+1, j}+\cdots + i_{in}a_{nj} = \sum_{p=1}^{n} i_{ip}a_{pj}$$ Because $i_{ij}=1$ when $i=j$, otherwise $i_{ij}=0$. Thus, $$d_{ij}= \sum_{p=1}^{n} i_{ip}a_{pj} = a_{ij}$$ That is, $[I]\cdot[A]=[A]$.
5. Consider there are only two computer companies in a country. The companies are named Dude and Imac. Each year, company Dude keeps ${1/5}^{th}$ of its customers, while the rest switch to Imac. Each year, Imac keeps ${1/3}^{rd}$ of its customers, while the rest switch to Dude. If in 2002, Dude has ${1/6}^{th}$ of the market and Imac has ${5/6}^{th}$ of the market.
(A) What is the distribution of the customers between the two companies in 2003? Write the answer first as multiplication of two matrices.
(B) What would be distribution when the market becomes stable?
Solution:
(A) Denote $D_n$ and $M_n$ as the market share of Dude and Imac in the $n$-th year, respectively. $$\begin{bmatrix}D_n \\ M_n \end{bmatrix} = \begin{bmatrix}{1\over5} & {2\over3} \\ {4\over5} & {1\over3}\end{bmatrix}\cdot \begin{bmatrix}D_{n-1} \\ M_{n-1} \end{bmatrix}$$ Thus $$\begin{bmatrix}D_{2003} \\ M_{2003} \end{bmatrix} = \begin{bmatrix}{1\over5} & {2\over3} \\ {4\over5} & {1\over3}\end{bmatrix}\cdot \begin{bmatrix}D_{2002} \\ M_{2002} \end{bmatrix} = \begin{bmatrix}{1\over5} & {2\over3} \\ {4\over5} & {1\over3}\end{bmatrix}\cdot \begin{bmatrix}{1\over6} \\ {5\over6} \end{bmatrix}= \begin{bmatrix}{53\over90} \\ {37\over90} \end{bmatrix}$$
(B) The stable system means the market share will not be changed from year to year, that is, $$\begin{cases}D = {1\over5}D+{2\over3}M \\ M = {4\over5}D + {1\over3}M\end{cases}\Rightarrow {4\over5}D-{2\over3}M=0$$ On the other hand, $D + M =1$, thus we have $$\begin{cases}{4\over5}D-{2\over3}M=0\\ D + M =1\end{cases}\Rightarrow\begin{cases}D={5\over11}\\ M={6\over11}\end{cases}$$ Hence the stable market share of Dude and Imac is ${5\over11}$ and ${6\over11}$, respectively.
6. Given $$[A]=\begin{bmatrix}12.3& -12.3& 10.3\\ 11.3& -10.3& -11.3\\ 10.3& -11.3& -12.3\end{bmatrix},\ [B]=\begin{bmatrix}2& 4\\ -5& 6\\ 11& -20\end{bmatrix}$$ if $[C] = [A]\cdot[B]$, then what is $c_{31}$?
Solution:
$$c_{31} = \begin{bmatrix}10.3& -11.3& -12.3\end{bmatrix} \cdot \begin{bmatrix}2\\-5\\11\end{bmatrix} = 10.3\times2+11.3\times5-12.3\times11 = -58.2$$
7. $[A]$ and $[B]$ are square matrices of $n\times n$ order. Then $([A] - [B])([A] - [B])$ is equal to ( ).
Solution:
$$([A]-[B])([A]-[B]) = [A]([A]-[B])-[B]([A]-[B])=[A]^2-[A][B]-[B][A]+[B]^2$$ Note that $[A][B]$ and $[B][A]$ is not equal to each other unless $[A][B]=[B][A]$.
8. Given $[A]$ is a rectangular matrix and $c[A]=0$, then what are the values of $c$ and $[A]$?
Solution:
$c[A]=0\Rightarrow c=0$ or $[A]=[0]$.
9. You sell Jupiter and Fickers Candy bars. The sales in January are 25 and 30 of Jupiter and Fickers, respectively. In February, the sales are 75 and 35 of Jupiter and Fickers, respectively. If a Jupiter bar costs 2 dollars and a Fickers bar costs 7 dollars, then what is the total sales amount in each month?
Solution:
$$\begin{bmatrix}25& 30\\ 75& 35\end{bmatrix}\cdot\begin{bmatrix} 2 \\ 7 \end{bmatrix} =\begin{bmatrix} 260 \\ 395 \end{bmatrix} $$ Thus, the total sales amount in January and February are 260 dollars and 395 dollars, respectively.
A.Kaw矩阵代数初步学习笔记 3. Binary Matrix Operations的更多相关文章
- A.Kaw矩阵代数初步学习笔记 4. Unary Matrix Operations
“矩阵代数初步”(Introduction to MATRIX ALGEBRA)课程由Prof. A.K.Kaw(University of South Florida)设计并讲授. PDF格式学习笔 ...
- A.Kaw矩阵代数初步学习笔记 10. Eigenvalues and Eigenvectors
“矩阵代数初步”(Introduction to MATRIX ALGEBRA)课程由Prof. A.K.Kaw(University of South Florida)设计并讲授. PDF格式学习笔 ...
- A.Kaw矩阵代数初步学习笔记 9. Adequacy of Solutions
“矩阵代数初步”(Introduction to MATRIX ALGEBRA)课程由Prof. A.K.Kaw(University of South Florida)设计并讲授. PDF格式学习笔 ...
- A.Kaw矩阵代数初步学习笔记 8. Gauss-Seidel Method
“矩阵代数初步”(Introduction to MATRIX ALGEBRA)课程由Prof. A.K.Kaw(University of South Florida)设计并讲授. PDF格式学习笔 ...
- A.Kaw矩阵代数初步学习笔记 7. LU Decomposition
“矩阵代数初步”(Introduction to MATRIX ALGEBRA)课程由Prof. A.K.Kaw(University of South Florida)设计并讲授. PDF格式学习笔 ...
- A.Kaw矩阵代数初步学习笔记 6. Gaussian Elimination
“矩阵代数初步”(Introduction to MATRIX ALGEBRA)课程由Prof. A.K.Kaw(University of South Florida)设计并讲授. PDF格式学习笔 ...
- A.Kaw矩阵代数初步学习笔记 5. System of Equations
“矩阵代数初步”(Introduction to MATRIX ALGEBRA)课程由Prof. A.K.Kaw(University of South Florida)设计并讲授. PDF格式学习笔 ...
- A.Kaw矩阵代数初步学习笔记 2. Vectors
“矩阵代数初步”(Introduction to MATRIX ALGEBRA)课程由Prof. A.K.Kaw(University of South Florida)设计并讲授. PDF格式学习笔 ...
- A.Kaw矩阵代数初步学习笔记 1. Introduction
“矩阵代数初步”(Introduction to MATRIX ALGEBRA)课程由Prof. A.K.Kaw(University of South Florida)设计并讲授. PDF格式学习笔 ...
随机推荐
- 跟我学习Storm_Storm主要特点
Storm拥有低延迟.高性能.分布式.可扩展.容错等特性,可以保证消息不丢失,消息处理严格有序.Storm的主要特点如下所示: 简单的编程模型.类似于MapReduce降低了并行批处理复杂性,Stor ...
- 还记得高中的向量吗?leetcode 335. Self Crossing(判断线段相交)
传统解法 题目来自 leetcode 335. Self Crossing. 题意非常简单,有一个点,一开始位于 (0, 0) 位置,然后有规律地往上,左,下,右方向移动一定的距离,判断是否会相交(s ...
- 如何在 apache 中开启 gzip 压缩服务
服务器设置 gzip 压缩是 web 开发里很普遍的做法.假设你要请求一个 100k 的文件,网络传输速度为 50k/s,需要 2s 才能得到数据,但是如果在服务器设置了 gzip 压缩,将服务端的文 ...
- .Net 程序集按需加载机制
在开始本文之前先提两个疑问: 1.一个.Net程序依赖很多的dll,那个他们是在应用程序启动的时候全部把所依赖的动态库全部都加载到应用程序域中的呢还是有选择的加载呢? 2.当应用程序已经启动后我们动态 ...
- ASP.NET MVC3入门教程之参数(数据)传递
本文转载自:http://www.youarebug.com/forum.php?mod=viewthread&tid=98&extra=page%3D1 MVC模式的参数(数据)传递 ...
- grootjs 简明教程
grootJs简明教程 mvvm框架也是解决的一类问题,在某些时候会提高生产效率: 经过接近一个月的努力,grootJs测试版终于发布了 grootJs是一个mvvm的框架,名字取 grass 和ro ...
- C语言strcat()函数:连接字符串
头文件:#include <string.h> strcat() 函数用来连接字符串,其原型为: char *strcat(char *dest, const char *src); ...
- Sqlsever
Sqlsever: 获取主键当前最大值: select ident_current('tablename');
- js正则表单验证汇总,邮箱验证,日期验证,电话号码验证,url验证,信用卡验证,qq验证
本文主要汇总各种正则验证,很多都是转载,本人也会尽可能验证准确性,如有错误欢迎留言 //trim()方法在有些浏览器中不兼容,最好自己重写一下 String.prototype.trim=functi ...
- 东大oj-1591 Circle of friends
题目描述 Nowadays, "Circle of Friends" is a very popular social networking platform in WeChat. ...