Linear Algebra review - Addition and scalar multiplication

摘要: 本文是吴恩达 (Andrew Ng)老师《机器学习》课程,第三章《线性代数回顾》中第15课时《加法和标量乘法》的视频原文字幕。为本人在视频学习过程中逐字逐句记录下来以便日后查阅使用。现分享给大家。如有错误,欢迎大家批评指正,在此表示诚挚地感谢!同时希望对大家的学习能有所帮助。

In this video (article), we'll talk about matrix addition and subtraction, as well as how to multiply a matrix by a number, also called Scalar Multiplication.

Let's start an example. Given two matrices like these, let's say I want to add them together. How do I do that? And so, what does addition of matrices mean? It turns out if you want to add two matrices, what you do is just add up the elements of these matrices one at a time. So, my result of adding two matrices is going to be another matrix as above. And it turns out that you can add only two matrices that are of the same dimensions. So, this example (1^{st} matrix) is a 3\times 2 matrix, and this example (2^{nd} matrix) is also a 3\times 2 matrix, and the result of adding these two matrices is a 3\times 2 matrix again. So, you can only add matrices of the same dimension, and the result will be another matrix that's of the same dimension as the ones you just added.

Whereas in contrast, if you were to take these two matrices, so this one (1^{st}) is a 3\times 2 matrix, another one (2^{nd}) is a 2\times 2 matrix. And because these two matrices are not of the same dimension, you know, this is an error. So, you cannot add these two matrices, and their sum is not well-defined. So, that's matrix addition.

Next, let's talk about multiplying matrices by a scalar number. And a scalar is just a, maybe an overly fancy term for, you know, a number or a real number. Alright, this scalar just means real number. So, let's take the number 3 and multiply it by this matrix. And if you do that, the result is pretty much what you'll expect. You just take your elements of the matrix and multiply them by 3, one at a time. The result is as above. And you notice, again, this is a 3\times 2 matrix, and the result is a matrix of the same dimension. And by the way, you can write multiplication, you know, either way. So, I have 3 times this matrix. I could also take this matrix and multiply this by 3. So, what as you know, 3 times the matrix or the matrix times 3 is the same thing, and this thing in the middle is the result.

You can also take a matrix and divide it by a number. So, turns out taking this matrix and divided it by 4, this is actually the same as taking the number 1/4, and multiplying it by this matrix. And so, you can figure the answer, the result of this product is as above.

Finally, for a slightly more complicated example, you can also take these operations and combine them together. So, in this calculation, I have 3 times a vector plus a vector minus another vector divided by 3. So, just make sure we know where these are, right? This multiplication, this is an example of scalar multiplication because I am taking 3 and multiplying it. And this is another scalar multiplication. Or more like scalar division, I guess. It really just means \frac{1}{3} times this. And so, if we evaluate these two operations first, then what we get is this thing is equal to above. And again, just to make sure we understand what's going on here, this plus symbol, that is matrix addition, right? Or really, since these are vectors. Remember, vectors are special classes of matrices, right? You can also call this vector addition. This minus sign here, this is again a matrix subtraction, but because this is an n\times 1, really a 3\times 1 matrix, that this is actually a vector. We call this a vector subtraction, as well. And finally, to wrap this up. This therefore gives me a vector as above which is the outcome of this calculation over here. So, that's how you add and subtract matrices and vectors and multiply them by scalars or by real numbers.

So far, I have only talked about how to multiply matrices and vectors by scalars, by real numbers. In the next video (article), we'll talk about a much more interesting step of taking 2 matrices and multiplying 2 matrices together.

<end>

发布了41 篇原创文章 · 获赞 12 · 访问量 1306

猜你喜欢

转载自blog.csdn.net/edward_wang1/article/details/103092253
今日推荐