字幕列表 影片播放 列印所有字幕 列印翻譯字幕 列印英文字幕 Unfortunately, no one can be told, what the Matrix is. You have to see it for yourself. - Morpheus 不幸,沒人可被告知,矩陣是什麽。你不得不自己來搞懂它。 Surprisingly apt words on the importance of understanding matrix operations visually 2 00:00:08,960 --> 00:00:11,680 (論視覺理解矩陣運算重要性適當到驚人的話) Hey everyone! 嗨,大家好! If I had to choose just one topic that makes 如果我不得不來只選一個題目它使 all of the others in linear algebra start to click 所有在綫性代數中其它的多開始觸類 and which too often goes unlearned the first time a student takes linear algebra, 旁通並在一個學生第一次上綫性代數常常沒有學會的話 it would be this one: the idea of a linear transformation and its 這就是這個了:綫性變換的想法和 relation to matrices. 它同一些矩陣的關係。 For this video, I'm just going to focus on what these transformations look like in the 在三個錄像中我將集中在這些變換在 case of two dimensions 2-維的情況下看上去是什麽樣的 and how they relate to the idea of matrix-vector multiplication. 以及它們怎樣同矩陣-矢量乘法的想法相關聯的。 In particular, I want to show you a way to think about matrix-vector multiplication that 特別是,我想要給你看一下有關矩陣--矢量乘法考慮的一種方法, doesn't rely on memorization. 那也不需要硬記的。 To start, let's just parse this term “linear transformation”. 一開始,讓我們來分析這個術語“綫性變換” “Transformation” is essentially a fancy word for “function”. “變換”基本是就是函數的一個花漂的名字。 It's something that takes in inputs and spits out an output for each one. 它就是拿進來一些輸入而對每個吐出一個輸出。 Specifically in the context of linear algebra, we like to think about transformations that 特別在綫性代數的内容裏,我想到一些 take in some vector and spit out another vector. 變換它們拿進某個矢量而吐出另一個矢量。 So why use the word “transformation” instead of “function” if they mean the same thing? 如果它們的意思是指同樣的東西,那麽 Well, 為什麽使用“變換”這個字而不用“函數”?嗯, it's to be suggestive of a certain way to visualize this input-output relation. 這個提示一定的方法來看到輸入-輸出的關係。 You see, a great way to understand functions of vectors is to use movement. 你知道,來懂得矢量的函數的一個很好的方法是利用移動。 If a transformation takes some input vector to some output vector, 如果一個變換拿一些輸入矢量變成一些輸出矢量, 我們想象 we imagine that input vector moving over to the output vector. 輸入矢量移動到輸出矢量。 Then to understand the transformation as a whole, 然後作爲一個整體來理解變換,我們 we might imagine watching every possible input vector move over to its corresponding output vector. 可能想象看著每一個可能的輸入矢量移動到它相應的輸出矢量。 It gets really crowded to think about all of the vectors all at once, each one is an arrow, 同時來考慮所有的矢量這真的會很擠,每個都是一支箭。 So, as I mentioned last video, a nice trick is to conceptualize each vector, not as an arrow, 因此,就像我在上一個錄像中所提到過的,一個好的竅門就是把每個矢量 but as a single point: the point where its tip sits. 概念化不是一支箭而是單獨一個點:箭頭所在的那個點。 That way to think about a transformation taking every possible input vector to some output vector, 這樣方法來考慮一個變換拿每一個可能的輸入矢量變成某種輸出矢量。 we watch every point in space moving to some other point. 我們看著在空間的每一個點移動到某些其他的點。 In the case of transformations in two dimensions, 在2-維變換的情況下, to get a better feel for the whole “shape” of the transformation, 來得到對整個變換的“形狀”一種更好的感覺, I like to do this with all of the points on an infinite grid. 我喜歡來做這個用所有的點放在一個無限的坐標網格裏。 I also sometimes like to keep a copy of the grid in the background, 有時我還喜歡保持網格的一份複製在背景裏, just to help keep track of where everything ends up relative to where it starts. 就是來幫助跟蹤每一個東西相對與它開始的地方最後到了那裏。 The effect for various transformations, moving around all of the points in space, is, 各色各樣變換的效果,在空間裏所有的點動來動去 you've got to admit, 你得承認 beautiful. 真美。 It gives the feeling of squishing and morphing space itself. 它給出摩擦的感覺和變化著的空間本身。 As you can imagine, though arbitrary transformations can look pretty complicated, 正如你可以想象到的,雖然隨意的一些變換可以看起來相當地複雜, but luckily linear algebra limits itself to a special type of transformation, 但是好在綫性代數限制自己在一個特殊類型的變換, ones that are easier to understand, called “linear” transformations. 那些容易來理解的,叫做“綫性”變換。 Visually speaking, a transformation is linear if it has two properties: 從視覺上來說,一個變換是綫性的如果它具有兩個性質: all lines must remain lines, without getting curved, 所有的直綫必須仍舊是直綫,沒有被彎曲, and the origin must remain fixed in place. 而且原點必須保持固定著。 For example, this right here would not be a linear transformation since the lines get all curvy 例如,就在這裏的這個就不是綫性變換因爲一些綫條都彎了, and this one right here, although it keeps the line straight, 而在這裏的這個,雖然它保持著綫是直的, is not a linear transformation because it moves the origin. 也不是一個綫性變換因爲它移動了原點。 This one here fixes the origin and it might look like it keeps line straight, 00:03:06,040 --> 00:03:09,190 但是那只不過因爲我只畫出水平和垂直網格 but that's just because I'm only showing the horizontal and vertical grid lines, 在你看到它的一根對角綫,它就明顯了它根本不是綫性的 when you see what it does to a diagonal line, it becomes clear that it's not at all linear 因爲它把那根綫都彎曲了。 since it turns that line all curvy. 縂的說來,你應該想到綫性變換是保持網格綫平行并且間隔均等的。 In general, you should think of linear transformations as keeping grid lines parallel and evenly spaced. 有些綫性變換容易來想,就像以原點為中心的轉動。 Some linear transformations are simple to think about, like rotations about the origin. 其他的有點難度來用文字來描述的。 Others are a little trickier to describe with words. 那麽你認爲怎樣可以用數字了描述這些變換呢? So how do you think you could describe these transformations numerically? 比方說,如果你覺得行,編些圖像程序來製作一個錄像教這個課題 If you were, say, programming some animations to make a video teaching the topic 爲了給計算機一個矢量的坐標,你用什麽樣的公式給它, what formula do you give the computer so that if you give it the coordinates of a vector, 它可以給你那個矢量出來的地方。 it can give you the coordinates of where that vector lands? 其結果是你只要記錄兩個單位矢量,i-hat和j-hat,在什麽地方, It turns out that you only need to record where the two basis vectors, i-hat and j-hat, each land. 而其餘的都會跟著那個來的。 and everything else will follow from that. 例如,想一個坐標為(-1,2)的矢量v, For example, consider the vector v with coordinates (-1,2), 意思是它等於-1乘以i-hat 加上2 乘以j-hat。 meaning that it equals -1 times i-hat + 2 times j-hat. 如果我們施加某種變換並跟隨所有的這三個矢量到什麽地方去了。 If we play some transformation and follow where all three of these vectors go 這個性質即網格綫仍舊平行並間隔均等,真是有很重要的後果的: the property that grid lines remain parallel and evenly spaced has a really important consequence: v著地的地方將是-1 乘以i-hat著地的地方 the place where v lands will be -1 times the vector where i-hat landed 加上2倍j-hat 著得的地方。 plus 2 times the vector where j-hat landed. 換句話說,它以一定的i-hat和j-hat綫性組合開始 In other words, it started off as a certain linear combination of i-hat and j-hat 而終止於這兩個矢量所著地地方同樣的綫性組合。 and it ends up is that same linear combination of where those two vectors landed. 這意味著你可以歸結出v一定去的地方只根據與i-hat和j-hat去的地方。 This means you can deduce where v must go based only on where i-hat and j-hat each land. 這就是為什麽我要在背景裏保存原來的網格的一份復件。 This is why I like keeping a copy of the original grid in the background; 從這裏顯示的變換上我們可以讀出i-hat 落在坐標(1,-2), for the transformation shown here we can read off that i-hat lands on the coordinates (1,-2). 而j-hat落在坐標(3,0)上。 and j-hat lands on the x-axis over at the coordinates (3, 0). 這個意思是由(-1)i-hat+(2)j-hat來代表的矢量 This means that the vector represented by (-1) i-hat + 2 times j-hat 終結與(-1乘以矢量(1,-2)+ 2乘以矢量(3,0). ends up at (-1) times the vector (1, -2) + 2 times the vector (3, 0). 把那個都加起來,你可以演繹出它一定是停在矢量(5,2)上的。 Adding that all together, you can deduce that it has to land on the vector (5, 2). 這是一個很好的地方來停一下和想一下,因爲這是相當重要的。 This is a good point to pause and ponder, because it's pretty important. 現在 ,我在給你看了全部的轉換的前提下, Now, given that I'm actually showing you the full transformation, 你可以就看看v有坐標(5,2), you could have just looked to see the v has the coordinates (5, 2), 但是這裏妙的地方是它給我們一種技術來演繹出任何矢量停下的地方 but the cool part here is that this gives us a technique to deduce where any vectors land, 只要我們有一份記錄i-hat和j-hat各自停在什麽地方, so long as we have a record of where i-hat and j-hat each land, 而不必來看變換的本身。 without needing to watch the transformation itself. 把矢量寫出更通用的坐標x和y, Write the vector with more general coordinates x and y, 而它將在x乘以i-hat停的(1, -2), and it will land on x times the vector where i-hat lands (1, -2), 加上y 乘以 j-hat停的(3,0). plus y times the vector where j-hat lands (3, 0). 算出那個和,你知道它停在(1x+3y, -2x+0y)。 Carrying out that sum, you see that it lands at (1x+3y, -2x+0y). 我給你任何一個矢量,而你可以用這個公式來告訴我那個矢量停在什麽地方。 I give you any vector, and you can tell me where that vector lands using this formula 所有這個就是說一個2-維的綫性轉換 what all of this is saying is that a two dimensional linear transformation 就完全只有4個數字來描述了 is completely described by just four numbers: 兩個i-hat上的坐標和兩個 the two coordinates for where i-hat lands j-hat上的坐標。 and the two coordinates for where j-hat lands. 這不是很妙的嗎? Isn't that cool? 通常把這些坐標寫成2x2格式的數字 it's common to package these coordinates into a two-by-two grid of numbers, 叫做2乘2矩陣, called a two-by-two matrix, 你可以把連個列解釋為兩個特殊的 where you can interpret the columns as the two special vectors i-hat和j-hat所在的矢量。 where i-hat and j-hat each land. 如果給你一個描述著一個綫性轉換的2乘2的矩陣 If you're given a two-by-two matrix describing a linear transformation 以及某個矢量 and some specific vector 而你想知道那個綫性轉換被那個矢量拿到哪裏去了, and you want to know where that linear transformation takes that vector, 你可以拿這矢量的坐標 you can take the coordinates of the vector 把他們乘上相應矩陣的列然後把它們加起來就得出了。 multiply them by the corresponding columns of the matrix, then add together what you get. 這對應於把我們的新基本矢量加上乘過係數的矢量這樣的想法。 This corresponds with the idea of adding the scaled versions of our new basis vectors. 讓我們來看一下在最通用的情況下這看起來像是什麽 Let's see what this looks like in the most general case 在那裏你的矩陣有著項a, b, c, d where your matrix has entries a, b, c, d 而記住,這個矩陣不過只是包裝著需要 and remember, this matrix is just a way of packaging the information needed to describe 來描述一個綫性轉換的信息的一種方法。 a linear transformation. 永遠要記住把第一個列,(a,c)解釋 Always remember to interpret that first column, (a, c), 出第一個基本矢量停下的地方 as the place where the first basis vector lands 而第二個列,(b,d)是第二個基本矢量停下的地方。 and that second column, (b, d), is the place where the second basis vector lands. 如果我們把這個變換施加到某個矢量(x,y),你會得出什麽呢? When we apply this transformation to some vector (x, y), what do you get? 好吧, Well, 這將是x乘以(a,c)加上y乘以(b,d) it'll be x times (a, c) plus y times (b, d). 把這放在一起,你得到一個矢量(ax+by, cx+dy). Putting this together, you get a vector (ax+by, cx+dy). 你甚至可以把這個定義為矩陣-矢量的乘法如果你 You can even define this as matrix-vector multiplication 像是它的一個函數 when you put the matrix on the left of the vector 把矩陣放在這矢量的左面。 like it's a function. 然後,你可能使一些中學生記住這個, Then, you could make high schoolers memorize this, 而不給他們看這使它有直感的關鍵部分。 without showing them the crucial part that makes it feel intuitive. 但是, But, 這難道不是更有趣來想一下把這些列 isn't it more fun to think about these columns 作爲你的變換過的基本矢量的版本 as the transformed versions of your basis vectors 並來考慮一下這些結果作爲 and to think about the results 這些矢量的適當的綫性組合。 as the appropriate linear combination of those vectors? 讓我們來練習一下用矩陣描述幾個綫性變換。 Let's practice describing a few linear transformations with matrices. 例如, For example, 如果我們把所有的空間逆時針轉過90度 if we rotate all of space 90° counterclockwise 然後i-hat就停在坐標(0,1)上 then i-hat lands on the coordinates (0, 1) 而j-hat就停在坐標(-1,0)上。 and j-hat lands on the coordinates (-1, 0). 所以我們得到這矩陣的列(0,1),(-1,0) So the matrix we end up with has columns (0, 1), (-1, 0). 要算出任何矢量經過90度的轉動之後會發生什麽, To figure out what happens to any vector after 90° rotation, 你就可以把它的坐標乘以這個矩陣。 you could just multiply its coordinates by this matrix. 有一個有著特殊的名字叫做一個“剪切”的變換。 Here's a fun transformation with a special name, called a “shear”. 在其中,i-hat保持固定的 In it, i-hat remains fixed 因此矩陣的第一個列是(1,0) so the first column of the matrix is (1, 0), 但是j-hat移動到坐標(1,1) but j-hat moves over to the coordinates (1,1) 這成爲矩陣的第二個列。 which become the second column of the matrix. 而在這裏為了避免重復, And, at the risk of being redundant here, 想出一個剪切怎樣變換一個給定的矢量, figuring out how a shear transforms a given vector 就歸到來把這個矩陣乘以那個矢量。 comes down to multiplying this matrix by that vector. 我們假定要反過來做, Let's say we want to go the other way around, 開始於矩陣,比方說它的列(1,2)和(3,1) starting with the matrix, say with columns (1, 2) and (3, 1), 而我們想要推斷出它的變換看上去像是什麽樣的。 and we want to deduce what its transformation looks like. 暫停並用寫時間來看看你是不是可以來想象它。 Pause and take a moment to see if you can imagine it. 來做這個的一個方法是 One way to do this 先把i-hat移動到(1,2)。 is to first move i-hat to (1, 2). 然後,把j-hat移到(3,1)。 Then, move j-hat to (3, 1). 總是把其餘的空間用這樣一種方法來移動 Always moving the rest of space in such a way 即保持網格平行並間隔均等。 that keeps grid lines parallel and evenly spaced. 如果這矢量i-hat和j-hat是綫性上依賴的 If the vectors that i-hat and j-hat land on are linearly dependent 這,如果你從上一個錄像裏囘想起來, which, if you recall from last video, 意思是一個是另一個的加過係數的版本而已。 means that one is a scaled version of the other. 它意味著這綫性變換擦著所有在那兩 It means that the linear transformation squishes all of 2D space 個矢量所在的的2-維空間上的直綫, on to the line where those two vectors sit, 這也眾所周知的兩個綫性是依賴的 also known as the one-dimensional span 矢量的1-維伸張。 of those two linearly dependent vectors. 總結一下,綫性轉換是 To sum up, linear transformations 在空間移動的一種方法,而網格保持 are a way to move around space 平行並間隔均等 such that the grid lines remain parallel and evenly spaced 以及原點保持不變。 and such that the origin remains fixed. 高興的是,這些變換 Delightfully, 可以只用在每個單位矢量停著的 these transformations can be described using only a handful of numbers. 坐標的幾個數字來描述。 The coordinates of where each basis vector lands. 矩陣給我們一種語言來描述這些變換 Matrices give us a language to describe these transformations 而這些列代表著這些坐標 where the columns represent those coordinates 而矩陣--矢量的乘法只不過是來計算的 and matrix-vector multiplication is just a way to compute 變換沒有給出的矢量的一種方法。 what that transformation does to a given vector. 在這裏學到重要的是 The important take-away here is that, 每次你看到一個矩陣 every time you see a matrix, 你可以把它解釋成空間的某種變換。 you can interpret it as a certain transformation of space. 一旦你真正地消化了這個想法, Once you really digest this idea, 你將在深度地理解綫性代數上處於一個很好的地位。 you're in a great position to understand linear algebra deeply. 幾乎所有以後要講的題目 Almost all of the topics coming up, 從矩陣的相乘到行列式, from matrix multiplication to determinant, 改變單位矢量,特徵值,...所有這些將變得更容易了理解, change of basis, eigenvalues, ... 一旦你開始把矩陣看作是空間的綫性轉換。 all of these will become easier to understand 立刻在下一個錄像 once you start thinking about matrices as transformations of space. 我將講把兩個矩陣乘起來。到時再見! Most immediately, in the next video 00:10:51,260 --> 00:10:58,060 I'll be talking about multiplying two matrices together. See you then!
B2 中高級 中文 美國腔 變換 矩陣 什麽 網格 輸出 地方 線性變換和矩陣|線性代數精髓,第3章。 (Linear transformations and matrices | Essence of linear algebra, chapter 3) 66 5 Chun Sang Suen 發佈於 2021 年 01 月 14 日 更多分享 分享 收藏 回報 影片單字