1 00:00:05,688 --> 00:00:08,300 PROFESSOR: Hi, guys. 2 00:00:08,300 --> 00:00:10,830 My name is Nikola, and in this video, 3 00:00:10,830 --> 00:00:12,300 we're going to work out an example 4 00:00:12,300 --> 00:00:14,680 of an orthogonal projection matrix. 5 00:00:14,680 --> 00:00:18,540 Specifically, we are gonna compute the projection matrix 6 00:00:18,540 --> 00:00:22,100 onto the plane given by the equation x plus y minus z 7 00:00:22,100 --> 00:00:23,480 equals 0. 8 00:00:23,480 --> 00:00:27,060 So before we start, let me just recall 9 00:00:27,060 --> 00:00:29,350 what a projection matrix is. 10 00:00:29,350 --> 00:00:35,170 So you've seen this sketch here a million times already. 11 00:00:35,170 --> 00:00:42,000 A projection matrix takes any vector in three-space-- well, 12 00:00:42,000 --> 00:00:44,750 just in this case, we are dealing with a three-space-- 13 00:00:44,750 --> 00:00:49,640 and projects it down onto the plane, 14 00:00:49,640 --> 00:00:52,840 a two-dimensional subspace of R^3. 15 00:00:52,840 --> 00:00:56,850 So I'll give you a few moments to consider 16 00:00:56,850 --> 00:00:58,120 the problem for yourselves. 17 00:00:58,120 --> 00:01:00,640 And then you'll see my take on it. 18 00:01:10,657 --> 00:01:12,900 Hi again. 19 00:01:12,900 --> 00:01:19,120 So in lecture, Professor Strang derived, in meticulous detail, 20 00:01:19,120 --> 00:01:21,990 the formula for the projection matrix. 21 00:01:21,990 --> 00:01:27,850 So it was given by the following slightly complicated 22 00:01:27,850 --> 00:01:28,900 expression. 23 00:01:28,900 --> 00:01:36,240 It's A times A transpose A inverse A 24 00:01:36,240 --> 00:01:40,050 transpose where A is a matrix that 25 00:01:40,050 --> 00:01:45,320 somehow encodes the subspace we're projecting on. 26 00:01:45,320 --> 00:01:53,820 In particular, A has, as its columns, a_1, a_2, 27 00:01:53,820 --> 00:01:57,510 I'm going to denote them-- a basis for the plane we're 28 00:01:57,510 --> 00:02:00,080 projecting on. 29 00:02:00,080 --> 00:02:03,340 So essentially, what we need to do 30 00:02:03,340 --> 00:02:08,979 is find two such vectors that span the plane and start 31 00:02:08,979 --> 00:02:12,490 computing with a matrix. 32 00:02:12,490 --> 00:02:13,960 This is fairly straightforward. 33 00:02:18,320 --> 00:02:24,220 One choice that works, for example, is [1, -1, 0] 34 00:02:24,220 --> 00:02:31,970 for the first column, and [1, 0, 1] for the second column. 35 00:02:35,430 --> 00:02:51,500 And let me write out the matrix A. So in the formula, 36 00:02:51,500 --> 00:02:54,640 the slightly more complicated combination 37 00:02:54,640 --> 00:03:00,270 is A transpose A inverse, so let me compute that first for you. 38 00:03:00,270 --> 00:03:08,900 So A transpose A is a 2 by 2 matrix. 39 00:03:08,900 --> 00:03:18,780 And it's not so hard to figure out that it's 2 and 1; 1, 2. 40 00:03:18,780 --> 00:03:29,100 Now we shall invert it using the familiar formula. 41 00:03:29,100 --> 00:03:31,190 1 over the determinant. 42 00:03:31,190 --> 00:03:34,260 2 times 2 minus 1 is 3. 43 00:03:34,260 --> 00:03:40,450 And so we switch the diagonal entries, 44 00:03:40,450 --> 00:03:42,533 and we flip the signs of the off-diagonal ones. 45 00:03:45,410 --> 00:03:46,620 Right. 46 00:03:46,620 --> 00:03:53,240 And therefore, projection matrix is given by the following 47 00:03:53,240 --> 00:04:12,140 product of matrices: ...1/3, [2, -1; -1, 48 00:04:12,140 --> 00:04:22,239 2] and then transpose of A, which is [1, -1, 0; 1, 0, 1]. 49 00:04:25,650 --> 00:04:28,340 I'm gonna carry out this multiplication 50 00:04:28,340 --> 00:04:31,650 in inhumanly fast fashion. 51 00:04:31,650 --> 00:04:38,140 So I'm just gonna write down the answer, which is 1/3 52 00:04:38,140 --> 00:04:45,070 [2, -1, 1; -1, 2, 2; 1, 1, 1]. 53 00:04:48,680 --> 00:04:51,740 So what you can do now is-- well, 54 00:04:51,740 --> 00:04:56,680 you can check whether this answer actually makes sense. 55 00:04:56,680 --> 00:04:59,540 One thing you can do is just-- well, 56 00:04:59,540 --> 00:05:03,770 a projection matrix is supposed to take the normal 57 00:05:03,770 --> 00:05:06,090 to the plane down to 0. 58 00:05:06,090 --> 00:05:14,090 So you can just multiply P and the normal vector [1, 1, -1]. 59 00:05:14,090 --> 00:05:18,700 And if you get 0, maybe you've done a good job. 60 00:05:18,700 --> 00:05:21,940 Another curious thing that I would like to point out here 61 00:05:21,940 --> 00:05:26,310 is: so you see we had lots of freedom choosing 62 00:05:26,310 --> 00:05:31,450 the matrix A. We could have chosen any two columns that 63 00:05:31,450 --> 00:05:36,060 span the subspace, that spans the plane. 64 00:05:36,060 --> 00:05:38,660 The beautiful thing about it is that in the end, 65 00:05:38,660 --> 00:05:40,130 we'll get the same answer. 66 00:05:44,510 --> 00:05:46,880 So I hope there will be many of you 67 00:05:46,880 --> 00:05:51,870 who would say, hey, there is an easier way to do the problem. 68 00:05:51,870 --> 00:05:53,600 And I'll agree with these people. 69 00:05:53,600 --> 00:06:01,590 So let's see what would be an easier approach. 70 00:06:01,590 --> 00:06:08,450 Well, let's go back to the sketch here. 71 00:06:08,450 --> 00:06:11,290 And let's make the following observation, 72 00:06:11,290 --> 00:06:16,970 that any vector is a sum of two components. 73 00:06:16,970 --> 00:06:22,540 The first component is its projection onto the plane. 74 00:06:22,540 --> 00:06:25,820 And the other component is its projection 75 00:06:25,820 --> 00:06:29,040 onto the orthogonal complement of the plane, in this case, 76 00:06:29,040 --> 00:06:31,620 onto the normal vector through the plane. 77 00:06:31,620 --> 00:06:35,050 So in the language of linear algebra, 78 00:06:35,050 --> 00:06:41,660 this is just b equals to its projection 79 00:06:41,660 --> 00:06:45,850 onto the plane plus its projection-- I'm 80 00:06:45,850 --> 00:06:48,760 gonna call it P_N-- onto the orthogonal complement 81 00:06:48,760 --> 00:06:49,700 of the plane. 82 00:06:52,650 --> 00:06:56,580 I'm gonna suggestively write here the identity 83 00:06:56,580 --> 00:06:59,520 matrix so that you can immediately 84 00:06:59,520 --> 00:07:01,510 read off a matrix equality. 85 00:07:01,510 --> 00:07:05,100 Associated with this equality here, it's 86 00:07:05,100 --> 00:07:10,770 the identity equals P plus P_N. 87 00:07:10,770 --> 00:07:14,410 And therefore, the projection matrix 88 00:07:14,410 --> 00:07:17,930 is just the identity minus the projection matrix 89 00:07:17,930 --> 00:07:20,510 onto the normal vector. 90 00:07:20,510 --> 00:07:27,450 Now, this object here, P_N, is much easier to compute, well, 91 00:07:27,450 --> 00:07:28,910 for two reasons. 92 00:07:28,910 --> 00:07:33,150 First one is that projecting onto a one-dimensional subspace 93 00:07:33,150 --> 00:07:36,210 is infinitely easier than projecting 94 00:07:36,210 --> 00:07:38,350 onto a higher-dimensional subspace. 95 00:07:38,350 --> 00:07:43,830 And second, we already have-- well, immediately we 96 00:07:43,830 --> 00:07:46,080 can read off from the equation of the plane what 97 00:07:46,080 --> 00:07:47,750 the normal vector is. 98 00:07:47,750 --> 00:07:52,570 So we don't have derive these guys. 99 00:07:52,570 --> 00:07:56,250 We don't have to do what we did here. 100 00:07:56,250 --> 00:08:12,401 So essentially, P_N will be N N transpose N inverse N 101 00:08:12,401 --> 00:08:12,900 transpose. 102 00:08:16,050 --> 00:08:30,730 And that's equal to [1, 1, -1]-- N transpose N inverse, 103 00:08:30,730 --> 00:08:33,669 this is just a number. 104 00:08:33,669 --> 00:08:37,890 It's 1 over the magnitude of the normal vector, 105 00:08:37,890 --> 00:08:41,766 so that's-- then, the magnitude squared, so that's 3. 106 00:08:41,766 --> 00:08:45,105 And 1, 1, -1. 107 00:08:48,510 --> 00:08:55,030 I'm gonna write the answer here. 108 00:08:55,030 --> 00:09:13,953 It's 1/3, 1, 1, -1; 1, 1, -1; and -1, 1, 1. 109 00:09:25,070 --> 00:09:28,773 And in order to get the projection matrix-- yes? 110 00:09:28,773 --> 00:09:30,505 AUDIENCE: [INAUDIBLE]. 111 00:09:30,505 --> 00:09:32,430 PROFESSOR: Oh. 112 00:09:32,430 --> 00:09:33,270 Thank you. 113 00:09:33,270 --> 00:09:34,320 Thank you. 114 00:09:34,320 --> 00:09:37,520 And in order to get the projection matrix, 115 00:09:37,520 --> 00:09:41,750 we just subtract from the identity this expression. 116 00:09:41,750 --> 00:09:48,170 And you can confirm that it's-- we get the same answer as here. 117 00:09:48,170 --> 00:09:49,878 I think we're done here.