[线性代数] 矩阵代数基础 Basic Matrix Algebra
Overview: Matrix algebra
Matrix algebra covers rules allowing matrices to be manipulated algebraically via addition, subtraction, multiplication and division. However, despite the manipulations illustrated in the following may seem to be like that of normal algebra, bear in mind that for everything we do in matrix algebra, we consider the manipulation of LINEAR COMBINATION, not individual elements in matrices. The difference would help rationalize many properties below. So, please bear in mind of this.
Matrix addition
When doing matrix addition, we have a requirement that all matrices being added along the way should be of same sizes. This requirement can be proved as the following: since all matrices having same size must have their columns in same size with each other as well. Thus, aj+bj+cj+…+nj = yj stands for all columns within the addition chain. Nothing special, everything simple enough.

Matrix multiplication
While matrix multiplication does not involve the too-restrictive 'same size' assumption as that in matrix addition and subtraction, it still requires size of rows of preceding matrix = size of column of the matrix followed.

Noted that matrix multiplication is NOT COMMUNTATIVE, meaning
, a scratch of proof as follow:

Indeed, matrix multiplication is like matrix-vector multiplication as follows. In Abi, each column on RHS matrix acts as a coefficient to the matrix comes before it, which means each element in bi acts as a coefficient to each column in A.



Sometimes in matrix multiplication, it's quite hard to recall to which element in the resulting matrix will the current operation result go. Fortunately, we have the row-column rules, which states each row of multiplicand corresponds to each row in resulting matrix after some linear combination.


Another mnemonic to help us remember the order :D

So we have the following 'seemingly trivial' matrix multiplication rules, but they are all reasonable. Noted that despite matrix multiplication is both left and right distributive, they are not commutative! Order must be strictly observed so the assumption of 'size of row of multiplicand = size of columns in multiplier' is upheld. Moreover, such non-commutativity also renders a dimensionality transformation of identity matrix in ImA=AIn.

Some sketches of proofs in terms of columns. Noted that (B+C) is essentially element-wise operations, which should not affect linear combination much.

Finally, there are few warnings about matrix multiplication. As mentioned, always bear in mind matrix multiplication is completely different from real-number multiplication, in a sense that the former considers the linear combination among columns in multiplicands weighted by elements in multiplier. Thus, we yield the following reminders about matrix multiplication:

Another aspect of matrix multiplication is matrix power, where matrices multiplied by themselves. Due to the chaining nature of matrix power, it requires each A to be of nxn square matrix.

In the following, I'm going to introduce matrix transpose, which application is not yet explicit for the moment. Transposing a matrix allows the interchange of dimension of a matrix. Imagine a 3x2 matrix B, BT becomes 2x3. It sometimes become handy in matrix multiplication, like:

Matrix inverse
Warning: matrix inverse refers to any invertible matrices not limited to 2x2! Just that the calculation of invertibility of larger matrix is a little bit more involved. Interested readers may refer to here. Thus, the properties below actually apply to larger matrix.
A non-singular matrix must be of nxn. Its inverse must be uniquely determined. Noted here that
, and the LHS and RHS of the following must be satisfied simultaneously. Otherwise, the matrix A can only be a singular matrix. This highlights the important property of matrix multiplication, that left multiply and right multiply do make a difference. This also justify why the nxn requirement for matrix to be invertible.


We can conclude from below that indeed A-1 = C. Moreover, when observed closely the relation between the colored stripes above, we can draw inference about what determines a matrix to be invertible or not by simple inspection of the matrix we are interested in. In general, a invertible matrix satisfies:

So, from above,
, A is invertible. Noted still, we have zero idea about who is its invertible. So the following formula comes into rescue:

With the uniqueness of matrix inverse, we can answer the uniqueness problem of a matrix equation without going through the pain of row-reduction algorithm: for any nxn invertible matrix, Ax=b must have unique solution. A sketch of proof would be that A-1A=I, and identity matrix has no free variable and always have a pivot position at each column. This gives unique solution.

Below show some properties of invertible matrices:

(2) states if A and B are both invertible nxn matrices, AB is also invertible and its inverse is B-1A-1 .
Proof of (2): 
Proof of (3):
. And that if A is invertible, so is AT.
Elementary Matrix
It refers to an identity matrix In being applied a SINGLE row operation. Recalled the painful row operation to be performed when we need to row-reduce a matrix. Such trouble can be effectively avoided by multiplying elementary matrix onto the matrix A being row-reduced. Instead of directly applying row operations onto A, we apply it on identity matrix I, one at a time. As we know to get the reduced row echelon form of A, we have to undergo a series of row operations. This means we need to apply row operations onto a series of identity matrices before left-multiplying them on A, as follows:

Since row operation does not change the solution set of a matrix equation,
is row equivalent to A!
Recall that row operations are reversible and let E' denotes the reverse of row operation, we have IA=A:


This sounds familiar…doesn't it mean that elementary matrices are invertible? Indeed, find E' is equivalent of finding E-1. Unfortunately, our discussion of invertibility above only limited to 2x2. Then how can we invert a nxn matrix in general?

Despite it can be as computationally involved as illustrated in the link above, finding an inverse on E can be trivial. You can simply tell what row operation has been applied onto I to generate E1 above. Thus, we have the following:

Matrix A is invertible (AA-1=A-1A=In) if it can be row-reduced to In. And we claim that any sequence of elementary row operations reducing A to In also transform In to A-1. Assuming A is invertible, a sketch of proof as follow:


Thus, we have:

This has great implication, as we know in general,

But now we can apply the elementary matrices WITH SAME SEQUENCE on A to transform:
- A to In
- In to A-1
If you are just given a matrix A, how could you test if inverse exists? How to find one? Recalled from above invertibility means that:

And we also use determinants to test and find the inverse of 2x2 matrices. We also have that complicated procedure for dealing with matrix beyond 2x2. But from our discussion immediately above, we seem to find another way of dealing with nxn invertibility without going through the plain of that complex algorithm.
Why not putting them all together to get [A I], on which a sequence of elementary matrices is applied to yield [I A-1]? If the nxn matrix A does not have an inverse, [A I] cannot be row reduced to [I A-1]. Sometimes only certain column of A-1 is needed, we can even solve [A ei] instead of [A I] as we know [A I] = [A e1 e2 … en].
Characteristics of invertible matrices
Most of you may encounter the lengthy list of invertible properties when studying invertible matrices. However, everything can be boiled down into the following:
invertible == row equivalent to In == n pivot columns == columns all linearly independent == columns span Rn == linear transformation one-to-one for Ax=0 == at least one solution to Ax=b (at least have that for Ax=0)
However, there still one tricky property which requires some derivation:
The linear transformation x à Ax maps Rn to Rn
Let's consider the proof as follows: as A is invertible, A must be a nxn and all columns thus span Rn. Naturally, the above stands.
With these properties at our belt, we can quickly determine if a nxn matrix is invertible or not: when it can be row-reduced to a yield a unique solution/ to be an identity matrix, it must be invertible. After all, invertibility is guaranteed by matrices which are row equivalent to identity matrix.
Despite the universality of these characteristics linking the concepts of linear independence to solution uniqueness, one limitation is that all these only apply on square matrices. For non-square matrices, we still need to painfully row-reduce the matrix to decide the basic and free variables.
Invertible linear transformation
Definition first. A linear transformation T: Rn à Rn is invertible
- iff standard matrix of standard matrix of T, namely A, is invertible. è explains why T need to be Rn à Rn
- iff there exists a function S: RnàRn such the following holds FOR ALL x IN Rn:
S(T(x)) = x
T(S(x)) = x
Noted here we are talking about INVERSE of linear transformation, and the result of the applying the inverse of linear transformation onto another one recovers the input vector x. This becomes useful in solving matrix equations later.
If linear transformation T is invertible, S(x)=A-1x is a unique function satisfying S(T(x)) = x and T(S(x)) = x, namely:

Thus, it's like what we've seen, and S upholds the uniqueness of inverse.
Here, to summarize, we observed that for a linear transformation T: RnàRn, the columns of standard matrix must be linearly independent and span across Rn, and thus gives an onto mapping, hence T is an invertible linear transformation and there exists a unique inverse: S(x)=A-1x, which recovers the input vector x from T(x).
Some Examples
後續:例子不定期更新,矩陣代數進階版
Ex 1. Proof of identity matrix multiplication: AI=A. As you can see, ai with non-one coefficient are zeroed-out.

Ex 2. Prove when a nxn matrix is invertible, Ax=b exists unique solution for all b belongs to Rn. From the following, we see the uniqueness of solution relies on uniqueness of the inverse, A-1.

Ex 3. We mentioned that by applying a series of elementary row operations on [A I], we get [I A-1]. If we are to row-reduce A-1 back into I again, we must apply the series in an reverse order:
. In other words, the same sequence can only be used to reduce A to I and I to A-1, but not the reverse.
Ex 4. When asking about if B=C where AB=BC, we must know if A is invertible or not. If A is invertible, then this B=C stands. Otherwise, it does not.
Ex 5. If AB, B is invertible, then A must be invertible. We first let C be the product of the invertible AB. By theorem, since AB invertible, C must be invertible as well. Noted in the final step we get A equals to the product of invertible matrices. Hence A is invertible. ■

Ex 6. Recalled that for invertible nxn matrix A, for any b in Rn, there exists a unique solution to Ax=b, namely x=A-1b. Also recall there's a unique sequence {Ei} which transform A to A-1. This justifies the uniqueness of x. As there's unique solution x to the system, the columns span Rn and we can conclude that for an invertible matrix, columns of A spans Rn and are linearly independent.
Ex 7. Careful when we try to row reduce [A I], sometimes A turns out to be singular.

Ex 8. General concepts for nxn matrix A
- if Ax=0 only has trivial solution, meaning there are only basic variables and thus all columns are pivot columns. Thus, they are linearly independent and reducible to/ row-equivalent to identity matrix.
- In other words, for a nxn matrix, if there are n pivot positions, it's definitely invertible and has at least one unique solution in Ax=b
- Recall a nxn matrix A has another nxn matrix D such that AD=I, there must exist a nxn matrix C where CA=I. Specifically, C=D due to inverse uniqueness.
- A linear transformation T: x à Ax mapping Rn to Rn, i.e. no dimensional changes.
- When the columns in A are linearly independent, then they spans Rn. Recall definition of linear span of a set of vectors in a vector space. Span is the intersection of ALL linear subspaces each containing every vector within the subspace. Or, schematically, where A,B and C are all vector spaces.

Thus, with n linearly independent columns in a nxn matrix, they must form a basis vector set for Rn, all possible linear combination of these vectors must reconstruct the vector space Rn, thus they 'span' Rn.
- By the theorem, if there exists at least one solution to Ax=b, then the linear transformation is one-to-one. Noted that if only the former part of the statement is true, there still has chance to be a onto mapping but not one-to-one, if there exists free variable in matrix. But for a nxn matrix with at least one solution to Ax=b, there must be n pivot columns, according to the theorem. Thus, the mapping becomes one-to-one, as it is not possible to have free variables anymore.
[线性代数] 矩阵代数基础 Basic Matrix Algebra的更多相关文章
- 算法库:基础线性代数子程序库(Basic Linear Algebra Subprograms,BLAS)介绍
调试DeepFlow光流算法,由于作者给出的算法是基于Linux系统的,所以要在Windows上运行,不得不做大量的修改工作.移植到Windows平台,除了一些头文件找不到外,还有一些函数也找不到.这 ...
- [线性代数] 矩阵代数進階:矩阵分解 Matrix factorization
Matrix factorization 导语:承载上集的矩阵代数入门,今天来聊聊进阶版,矩阵分解.其他集数可在[线性代数]标籤文章找到.有空再弄目录什麽的. Matrix factorization ...
- R语言基础-list matrix array
列表可以包含多种类型,如数字/字符/向量/data.frame/list # 创建含一个向量元素的list list1 = list(c(1,2,3)) # list2有三个元素 list2 = li ...
- Python与线性代数——Numpy中的matrix()和array()的区别
Numpy中matrix必须是2维的,但是 numpy中array可以是多维的(1D,2D,3D····ND).matrix是array的一个小的分支,包含于array.所以matrix 拥有arra ...
- 目标检测之基础hessian matrix ---海森矩阵
就是海赛(海色)矩阵,在网上搜就有. 在数学中,海色矩阵是一个自变量为向量的实值函数的二阶偏导数组成的方块矩阵, Hessian矩阵是多维变量函数的二阶偏导数矩阵,H(i,j)=d^2(f)/(d(x ...
- [Java复习] Java基础 Basic
Q1面向对象 类.对象特征? 类:对事物逻辑算法或概念的抽象,描述一类对象的行为和状态. OOP三大特征,封装,继承,多态 封装:隐藏属性实现细节,只公开接口.将抽象的数据和行为结合,形成类.目的是简 ...
- A.Kaw矩阵代数初步学习笔记 4. Unary Matrix Operations
“矩阵代数初步”(Introduction to MATRIX ALGEBRA)课程由Prof. A.K.Kaw(University of South Florida)设计并讲授. PDF格式学习笔 ...
- A.Kaw矩阵代数初步学习笔记 3. Binary Matrix Operations
“矩阵代数初步”(Introduction to MATRIX ALGEBRA)课程由Prof. A.K.Kaw(University of South Florida)设计并讲授. PDF格式学习笔 ...
- 【线性代数】6-1:特征值介绍(Introduction to Eigenvalues)
title: [线性代数]6-1:特征值介绍(Introduction to Eigenvalues) categories: Mathematic Linear Algebra keywords: ...
随机推荐
- tslint 忽略格式检查
// tslint:disable——忽略该行以下所有代码出现的错误提示,可以在文件首行添加达到忽略整个文件的格式提示 // tslint:enable——当前ts文件重新启用tslint// tsl ...
- Python 内置函数进制转换的用法(十进制转二进制、八进制、十六进制)
使用Python内置函数:bin().oct().int().hex()可实现进制转换. 先看Python官方文档中对这几个内置函数的描述: bin(x)Convert an integer numb ...
- VBA用户自定义函数(十五)
函数是一组可重复使用的代码,可以在程序中的任何地方调用.这消除了一遍又一遍地编写相同的代码的需要.这使程序员能够将一个大程序划分成许多小的可管理的功能模块. 除了内置函数外,VBA还允许编写用户定义的 ...
- Java 之 注解
一.注解介绍 注解概念:注解是说明程序的,给计算机看的. 注释概念:用文字描述程序的,给程序员看的. 注解定义:注解(Annotation),也叫元数据.一种代码级别的说明.它是 JDK1.5 及以后 ...
- 【Mybatis】 入门
一.概述 1.1 JDBC 1.2 JDBC编程中问题 1.3 MyBatis介绍 1.4 Mybatis架构 二.MyBatis入门程序 2.1 需求 2.2 引入MyBatis依赖 2.3 配置 ...
- 数据库中的Schema到底是什么
参考:http://database.guide/what-is-a-database-schema/ 在数据库中,schema(发音 “skee-muh” 或者“skee-mah”,中文叫模式)是数 ...
- 解决Hibernate validator抛出Ljavax/validation/ParameterNameProvider异常方法
最近升级CAS Client4.0客户端Spring版本至Spring4.*以上,升级整合hibernate框架时,Hibernate validator 4.3.0.Final使用版本(从Hiber ...
- SecureCRT进行端口转发
总共3台机器:my电脑.跳转机器(外网).内网服务器. 首先配置至跳板机(150.236.223.72:22)的连接: 配置完成后选择Connect连接至跳板机,输入密码后可选择“Save p ...
- P1338 末日的传说[水题]
题目描述 只要是参加jsoi活动的同学一定都听说过Hanoi塔的传说:三根柱子上的金片每天被移动一次,当所有的金片都被移完之后,世界末日也就随之降临了. 在古老东方的幻想乡,人们都采用一种奇特的方式记 ...
- AJAX学习笔记——jQuery中的AJAX
用jQuery实现Ajax jQuery.ajax([settings]) 1.type:类型, "POST"或"GET" ,默认为"GET" ...