YouTube2Text

2.1 Matrices and Matrix Operations — Transcript

by KAUST Academy · 2,924 words · 409 segments · language en · Watch on YouTube

Full transcript

  1. 0:01Hello again. So, today we are going to
  2. 0:03move on to module number two, which is
  3. 0:06which talks about matrices.
  4. 0:08So, we're going to learn uh matrices,
  5. 0:11matrix shapes, and matrix operations.
  6. 0:14And we're going to see how matrices
  7. 0:16arise naturally from a system of linear
  8. 0:18equations. So, let's begin.
  9. 0:21What is a matrix? A matrix is a
  10. 0:23rectangular array of numbers, as we see
  11. 0:25in the example. It's represented either
  12. 0:28with square brackets or parentheses. And
  13. 0:32in the matrices, we have some numbers
  14. 0:35inside it. We have also rows and
  15. 0:38columns.
  16. 0:39So, the numbers are called the entries
  17. 0:42or the coefficients of the matrix.
  18. 0:44But what we use in general, the
  19. 0:47terminology that we use very often are
  20. 0:49the entries.
  21. 0:50Then, every matrix is characterized by
  22. 0:53the number of rows and the number of
  23. 0:55columns. So, in this case, we have 1 2 3
  24. 1:00rows. And we count the columns 1 2 3 4
  25. 1:05columns.
  26. 1:06So, we say that the matrix is a 3 by 4
  27. 1:10matrix. And that is the size of the
  28. 1:13matrix. So, the number of rows will be
  29. 1:16uh
  30. 1:17indicated first, which is three, and
  31. 1:20then the number of columns next, which
  32. 1:22would be four.
  33. 1:25Let's look at the general form of the
  34. 1:27matrix. So, an m by n matrix, it means
  35. 1:30that we have m rows and then n columns.
  36. 1:33So, it's given by
  37. 1:35uh all of these entries. And every
  38. 1:37single entry has two indices.
  39. 1:40One The first index will indicate in
  40. 1:43what row we are, and then in the second
  41. 1:45index, in what column we are.
  42. 1:47So, every single entry has two indices,
  43. 1:52i and j, just to indicate that we are in
  44. 1:55the ith row and then the jth column.
  45. 2:00So, for the general form of a matrix, we
  46. 2:04would have a11 standing for the first
  47. 2:07entry in the first row, first column,
  48. 2:09all the way to a1n. This would stand for
  49. 2:13the first row and the nth column. Then
  50. 2:16going all the way to amn, all the way to
  51. 2:19amn. So, amn would be the entry that is
  52. 2:22situated in the mth row and the first
  53. 2:25column. Those notations are very
  54. 2:27important notations that are going to be
  55. 2:30with us up until the end of this course.
  56. 2:34So, as I mentioned, aij is the ijth
  57. 2:37element of the matrix. I is the row
  58. 2:39index, j is the column index. For
  59. 2:41instance, look at this example. So, what
  60. 2:44do you think a23
  61. 2:46would be?
  62. 2:48So,
  63. 2:49a23 would stand for the second row,
  64. 2:53third column. So, we're going to count
  65. 2:55row one, row two, and then one, two,
  66. 2:59three. So, a23, second row, third column
  67. 3:03would be 3.2.
  68. 3:06So, a23 is the entry 3.2.
  69. 3:11What are a12 and a34? Take just a moment
  70. 3:14to think about a12 and a34. So, a12,
  71. 3:19first row,
  72. 3:20second column. First row, second column.
  73. 3:24So, that's would be -1.
  74. 3:26a34,
  75. 3:28third row, one, two, three, fourth
  76. 3:31column.
  77. 3:33So, this would be 2.2, and that is a34.
  78. 3:38So, as we have seen, indices in matrices
  79. 3:42start at one. However, in computer
  80. 3:45languages, they are going to start at
  81. 3:47zero, and you are going to see that in
  82. 3:50your Python course.
  83. 3:53Next, we are going to look at matrix
  84. 3:55shapes. An m by n matrix A is tall if m
  85. 3:59is greater than n. What do you think?
  86. 4:01What does it mean for m to be greater
  87. 4:03than n? It means the number of rows is
  88. 4:07greater than the number of columns. So,
  89. 4:10just an example of a tall matrix, let's
  90. 4:13talk about A. 1 2 -1 0 -1 3 square root
  91. 4:19of 10
  92. 4:2111. So, this is a matrix. What's the
  93. 4:24size of the matrix? It has 1 2 3 rows
  94. 4:29and two columns. So, it's a 4 by 2
  95. 4:32matrix and the four is standing for the
  96. 4:35number of rows, which is m, and then two
  97. 4:37is standing for the number of columns,
  98. 4:40which is n. And in this case, m is
  99. 4:42strictly greater than n.
  100. 4:45A matrix is wide if m is less than n.
  101. 4:48What does it mean wide matrix? m being
  102. 4:51less than n meaning the number of rows
  103. 4:54is less than the number of columns. Just
  104. 4:56a quick example, let's take a 2 by 3
  105. 5:00matrix now. So, m being less than n, we
  106. 5:03have 1 2 3 4 5 6.
  107. 5:06So, this is a matrix where it that has
  108. 5:09two rows and then three columns and then
  109. 5:12m, which is equal to two, is less than
  110. 5:14n, is equal to three. So, the number of
  111. 5:16rows are less than the number of
  112. 5:18columns.
  113. 5:20How about a square matrix? And this is a
  114. 5:22very important matrix. The square matrix
  115. 5:25is a matrix such that the number of rows
  116. 5:28and the number of columns are just the
  117. 5:30same. So, let's just look at a 3 by 3
  118. 5:34matrix. A 3 by 3 matrix will have
  119. 5:38the same exact number of rows and this
  120. 5:41exact number of columns, which are
  121. 5:42three. So, I'm just going to plug in
  122. 5:44some entries, some random entries as an
  123. 5:47example, 10 11 and let's suppose 12. So,
  124. 5:51this is a 3 by 3 matrix having three
  125. 5:53rows and three columns.
  126. 5:56So, example of matrices, let's look at
  127. 5:59the following image. It's a grayscale
  128. 6:01image
  129. 6:02and it will be represented by numbers
  130. 6:05between 0 and 1. 0 being black, 1 being
  131. 6:11white, and in between it's going to be
  132. 6:13the all the shade between black and
  133. 6:15white. So, the shades of gray.
  134. 6:18Then, if you zoom in a little bit and
  135. 6:20you look closely at the small area that
  136. 6:26we are representing.
  137. 6:28So, the area where you can see the white
  138. 6:31hand side, which is on the bottom left
  139. 6:34of this area, will be represented by
  140. 6:36some numbers which are close to 1.
  141. 6:39And on the top part, those are numbers
  142. 6:42which are close to 0 because they would
  143. 6:44indicate the black
  144. 6:48the black color.
  145. 6:50A second A second example would be the
  146. 6:52prices for multiple supplier.
  147. 6:56So, the PIJ is the price that vendor J,
  148. 7:00so the vendors are represented in
  149. 7:02columns. I have five columns that are
  150. 7:06charging for good I. And how many goods
  151. 7:09do I have? 1 2 3 4 5 and 6. And this is
  152. 7:14how people just compare to see where
  153. 7:17which vendor they will adopt, which
  154. 7:18vendor they will be buying from.
  155. 7:22Special matrices. Special matrices are
  156. 7:24matrices that appear everywhere.
  157. 7:27So, if you remember last time we talked
  158. 7:29about the zero vector, so it's the same
  159. 7:32way. The zero matrix is just a matrix of
  160. 7:36size n by n and with entries zero
  161. 7:40everywhere.
  162. 7:42And we denote it by just zero. Some Some
  163. 7:45In some books, you will see the notation
  164. 7:47as zero n by n just to say that we are
  165. 7:50in an n by n [clears throat] matrix.
  166. 7:53The identity matrix is a very special
  167. 7:56matrix. It is a square matrix, not like
  168. 7:59the zero matrix with the zero matrix can
  169. 8:01be non-square.
  170. 8:02So, the identity matrix is a square
  171. 8:06matrix with entries one all over the
  172. 8:08diagonal and zero everywhere else as we
  173. 8:12see and also the example. So this is the
  174. 8:15identity of 2 by 2 matrix I'm sorry 3 by
  175. 8:183 matrix. This is the identity of a 2 by
  176. 8:202 matrix.
  177. 8:22Sparse matrices sparse matrices most
  178. 8:25entries are zero. For example, the zero
  179. 8:27matrix and I are sparse matrices
  180. 8:30and can be stored and manipulated
  181. 8:33efficiently.
  182. 8:35Diagonal and triangular matrices those
  183. 8:38are also particular matrices. They are
  184. 8:41square matrices. So square matrices we
  185. 8:46cannot talk about diagonal matrices
  186. 8:48lower triangle or upper triangle unless
  187. 8:51M is equal to N the number of rows is
  188. 8:54equal to the number of columns.
  189. 8:56The diagonal matrices are just matrices
  190. 9:00where the A I J is zero whenever I is
  191. 9:05different than J. Whenever I is
  192. 9:07different than J. So you have only
  193. 9:10non-zero entries if they are appearing
  194. 9:12they should be on the diagonal. What is
  195. 9:15exactly the main diagonal of a matrix?
  196. 9:17So for a square matrix the main diagonal
  197. 9:21is the this whole strip that is formed
  198. 9:24by the A I I's meaning when the number
  199. 9:28of row is equal to the number of
  200. 9:30columns. So this is the entry 1 1 this
  201. 9:33would be the entry 2 2 this would be an
  202. 9:36entry 3 3 for the 3 by 3 matrix.
  203. 9:39So A I J is equal to zero whenever I is
  204. 9:42different than J. So you have zero
  205. 9:45everywhere else outside the diagonal.
  206. 9:48You have some different some numbers
  207. 9:50that are different than zero they these
  208. 9:52numbers may also be zero on the diagonal
  209. 9:55but if there are numbers that are
  210. 9:57different than zero they have to appear
  211. 9:59on the main diagonal. For example, I'm
  212. 10:01just going to put a three here a two
  213. 10:03here then maybe a zero here. So this is
  214. 10:06a diagonal matrix. I do not have any
  215. 10:09non-zero entries outside the diagonal.
  216. 10:12So, again, the main diagonal, let me
  217. 10:14just put this one here. The main
  218. 10:16diagonal is just this band where is
  219. 10:21collecting all these Aii's,
  220. 10:24A11, A22, and A33.
  221. 10:27A lower triangular matrix. What is a
  222. 10:29lower triangular matrix? It's a matrix
  223. 10:31whenever
  224. 10:33A i j is equal to zero whenever we are
  225. 10:38going to compare i and j. So, let's
  226. 10:40Let's try to think a little bit about a
  227. 10:42lower triangular matrix. So, a lower
  228. 10:45triangular. So, it comes from the the
  229. 10:49terminology lower triangular. So, I have
  230. 10:53entries in the lower part.
  231. 10:56So, my entries, for example, I'm going
  232. 10:59to have 5 10 -1. So, these entries in
  233. 11:02the lower part are non-zero entries. So,
  234. 11:05this is a lower triangular, which gives
  235. 11:07me a condition that this upper part,
  236. 11:10these entries in the upper part must be
  237. 11:12equal to zero.
  238. 11:14So, how do we compare the indices? So,
  239. 11:16if we go back to the general form of the
  240. 11:18matrix, the first entry here is A11.
  241. 11:23The second entries is A12. So, this is
  242. 11:26A12. This one is A13. This is A
  243. 11:31second row, third column, A23.
  244. 11:35So, if we notice all of the indices of
  245. 11:39these Aij's have the properties that i
  246. 11:43is less than j.
  247. 11:46So, i must be less than j. One is
  248. 11:49strictly less than two. One is strictly
  249. 11:52less than three, and two is strictly
  250. 11:54less than three.
  251. 11:57Then, we are going to move on to the
  252. 11:59upper triangular matrix.
  253. 12:01So, it's the same way. It's the same
  254. 12:03idea. So, in the upper triangular
  255. 12:05matrix, we have
  256. 12:08a matrix. Let's give an example where
  257. 12:10the non-zero entries should be situated
  258. 12:14in the upper side. You can also have
  259. 12:17zeros entries, no problem, but if there
  260. 12:19are entries that are non-zero, they
  261. 12:21should appear on the upper part. And in
  262. 12:24the lower part, all these entries are
  263. 12:26zero. So, upper and upper triangular
  264. 12:28matrix has the property that Aij is zero
  265. 12:33whenever
  266. 12:34I now is greater than J.
  267. 12:38So, if we combine both together, so the
  268. 12:42lower and the upper triangular is going
  269. 12:45to give you what? A diagonal matrix. So,
  270. 12:48if we combine these two together, it's
  271. 12:50going to give you a diagonal matrix.
  272. 12:54Next, we move on to discuss the
  273. 12:56transpose of a matrix. What is a
  274. 12:58transpose of an m by n matrix A?
  275. 13:02So, the transpose of an m by n matrix A
  276. 13:05is denoted by A T. This T is standing
  277. 13:09for transpose, and is defined by
  278. 13:12converting column to row vectors and
  279. 13:15vice versa. So, the columns becomes the
  280. 13:17rows and the rows becomes the columns.
  281. 13:19So, for example, when A is equal to 0 6
  282. 13:232 3 1 -1, the transpose of A would be
  283. 13:29So, the the size of A is a 3 by 2. So, A
  284. 13:35is a 3 by 2. A transpose would be a 2 by
  285. 13:383. And the first column becomes the
  286. 13:41first row,
  287. 13:43and then the second column will become
  288. 13:46the second row.
  289. 13:48So, as we have seen earlier on in the
  290. 13:51previous module, that the transpose of a
  291. 13:53single row vector is a column vector.
  292. 13:57The symmetric matrices, those are also
  293. 13:59particular matrices where the transpose
  294. 14:01of A R is equal to A. So, when you
  295. 14:04transpose A, you have to get back to A
  296. 14:07itself. So, A For A to be symmetric, A
  297. 14:11has to be a square matrix. That's my
  298. 14:13first condition. And what is the shape
  299. 14:16of A? So let's look at a small example.
  300. 14:19So you have the entries on the diagonal.
  301. 14:21I'm just looking at an example.
  302. 14:24And for A to be symmetric, if the rows
  303. 14:27and the columns the rows becomes the
  304. 14:28columns and the columns becomes the rows
  305. 14:30and both matrices are equal, it means
  306. 14:33that if I'm looking at this entry five
  307. 14:35over here, so you have a symmetry with
  308. 14:38respect to the diagonal. This entry must
  309. 14:40be equal to five. What's the reason?
  310. 14:43Because if A is squared, A I J must be
  311. 14:47equal to A J I.
  312. 14:49So if I'm looking at this entry five
  313. 14:51over here, this is A 1 2, must be equal
  314. 14:55to A 2 1. So the symmetry is happening
  315. 14:58with respect to the diagonal.
  316. 15:00So if I'm taking an example, this is
  317. 15:03three, this would be three as well. If
  318. 15:05this is two, this would be two as well.
  319. 15:08So you are obtaining a symmetry with
  320. 15:10respect to the diagonal.
  321. 15:14Then we're moving to matrix operations.
  322. 15:16The very first matrix operation that
  323. 15:18we're going to see is the matrix
  324. 15:20addition. So just like vectors, exactly
  325. 15:23like vectors, matrix can be added,
  326. 15:26subtracted, or multiplied by a constant.
  327. 15:30However, to add two matrices, you have
  328. 15:33to have the same size. So having the
  329. 15:36same size of the matrices will allow you
  330. 15:38to add both matrices. How do we add A
  331. 15:42plus B?
  332. 15:43We just add the corresponding entries.
  333. 15:46So A 1 1 plus B 1 1 all the way up to A
  334. 15:491 N plus B 1 N and so on. So
  335. 15:53corresponding entries are added
  336. 15:55together.
  337. 15:56And what is the size of A and B in here?
  338. 15:59So how many rows do we have? Each matrix
  339. 16:03has M rows and N columns.
  340. 16:07So an M by N matrix A was added to an M
  341. 16:10by N matrix B. And the subtraction is
  342. 16:14just similar.
  343. 16:16The same thing as we've done in factors,
  344. 16:18we can do a scalar multiplication. So,
  345. 16:21we can take a matrix A and multiply it
  346. 16:24by a scalar K. And how do we do that?
  347. 16:27So, we uh multiply every single entry by
  348. 16:30the scalar K, no matter what the size of
  349. 16:33the matrix is.
  350. 16:34So, A is an m by n matrix in this case,
  351. 16:37and then we are multiplying K by A
  352. 16:41involves multiplying every single entry
  353. 16:43by K. And we have these obvious
  354. 16:46properties.
  355. 16:47A plus B is B plus A. The matrix
  356. 16:50addition is commutative.
  357. 16:53K times A plus B is KA plus KB. So, we
  358. 16:57can always distribute the scalar to the
  359. 17:00addition of both matrices.
  360. 17:02The transpose of the sum is the sum of
  361. 17:06the transpose. So, A plus B transpose is
  362. 17:09A transpose plus B transpose.
  363. 17:13Example.
  364. 17:14So, let's look a little bit about at
  365. 17:16this example. We have A, the size of A
  366. 17:19is a 2 by 3
  367. 17:21matrix. B is also 2 by 3 because we have
  368. 17:24two rows, three columns. C is a 2 by 2.
  369. 17:29So, we can add A plus B. What is the
  370. 17:33answer for A plus B? So, first of all,
  371. 17:36we are going to get a matrix of the same
  372. 17:38size as A and B, which is a 2 by 3.
  373. 17:42And what do we do in order to get to the
  374. 17:44result of A plus B? We need to add the
  375. 17:48corresponding entries together.
  376. 17:50So, the first row, first column of A is
  377. 17:54-1 added to the first row, first column
  378. 17:57of B, which is +1. -1 +1 is a zero. I
  379. 18:02move on to the second entry. 0 + -1 is a
  380. 18:05-1. 0 + 1 is 1. 2 + 3 is 5. 3 + 1 is 4.
  381. 18:11And 0 + 0 is just 0.
  382. 18:15So, A plus B is oh, again, a 2 by 3
  383. 18:19matrix obtained by adding the
  384. 18:21corresponding entries of A and B.
  385. 18:24How about -2A + B? So, in order to to
  386. 18:28add -2A + B,
  387. 18:30we will
  388. 18:32we will add Let me just try to write it
  389. 18:35in here. -2A
  390. 18:38+ B. So, I'm going to multiply A by -2.
  391. 18:43-1 0 0 2 3 0 and I'm going to add B to
  392. 18:48it. 1 -1 1 3 1 0. So, what do we do
  393. 18:53first? What do you think we should do
  394. 18:55first? We need to multiply all the
  395. 18:58entries of A by -2. -2 * -1 is a 2 * 0
  396. 19:03is 0. -2 * 2 is -4. -2 * 3 is -6. 0. And
  397. 19:10we add it to 1 -1 1 3 1 0. Let's obtain
  398. 19:15the answer. The final answer would be
  399. 19:17adding the corresponding entries of -2A
  400. 19:21with the corresponding entries of B. 2 +
  401. 19:231 is 3. -1 1 -4 + 3 is -1. -5. And then
  402. 19:30finally, 0.
  403. 19:34So,
  404. 19:35what about A + C? What do you guys think
  405. 19:38about A + C?
  406. 19:40So, A + C A is a 2 a 2x3 matrix.
  407. 19:47C is
  408. 19:50a 2x2 matrix. So, A + C cannot be
  409. 19:55performed.

About this transcript

This page contains the full transcript of 2.1 Matrices and Matrix Operations by KAUST Academy, generated from the public captions YouTube serves with the video. The transcript has 2,924 words across 409 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.

What you can do with it

Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to choose a caption track available on the video.

Free YouTube transcript tool

YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, caption language selection, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.