1
00:00:07,980 --> 00:00:09,430
PROFESSOR: Hi, and welcome.
2
00:00:09,430 --> 00:00:11,580
Today we're going to do
a problem about least
3
00:00:11,580 --> 00:00:13,910
squares approximations.
4
00:00:13,910 --> 00:00:15,510
Here's the question.
5
00:00:15,510 --> 00:00:18,740
Find the quadratic equation
through the origin that
6
00:00:18,740 --> 00:00:24,090
is a best fit for these
three points: (1, 1), (2, 5),
7
00:00:24,090 --> 00:00:27,060
and (-1, -2).
8
00:00:27,060 --> 00:00:30,150
I'll give you a minute to
work that out on your own.
9
00:00:30,150 --> 00:00:32,090
You can hit the
pause button now,
10
00:00:32,090 --> 00:00:35,440
and we'll be back in a minute to
work the problem out together.
11
00:00:47,430 --> 00:00:50,690
OK and we're back.
12
00:00:50,690 --> 00:00:53,790
So what's the first step
in a problem like this?
13
00:00:53,790 --> 00:00:58,220
The first step is figuring out
what our equation looks like,
14
00:00:58,220 --> 00:01:00,280
the one that we're
going to find.
15
00:01:00,280 --> 00:01:07,740
So our equation is going to
look like c*t plus d t squared
16
00:01:07,740 --> 00:01:10,150
equals y.
17
00:01:10,150 --> 00:01:11,790
So that's what
we're looking for.
18
00:01:11,790 --> 00:01:15,780
We're looking for a quadratic
equation through the origin.
19
00:01:15,780 --> 00:01:17,740
Now, if it were just
any quadratic equation,
20
00:01:17,740 --> 00:01:19,530
then we would have
a constant term,
21
00:01:19,530 --> 00:01:21,410
but through the
origin just means
22
00:01:21,410 --> 00:01:25,730
that the constant term is 0.
23
00:01:25,730 --> 00:01:28,250
Now, what's the next step?
24
00:01:28,250 --> 00:01:31,980
Next we need to set
up a matrix equation.
25
00:01:31,980 --> 00:01:43,890
So we need an A, a
matrix A. And which
26
00:01:43,890 --> 00:01:46,740
matrix is that going to be?
27
00:01:46,740 --> 00:01:51,360
Well, let me start with the
first coordinate of these three
28
00:01:51,360 --> 00:01:52,790
points.
29
00:01:52,790 --> 00:01:57,450
And I'm going to put them in the
first column of this matrix, 1,
30
00:01:57,450 --> 00:01:59,200
2, -1.
31
00:01:59,200 --> 00:02:01,700
And then my second
column is going
32
00:02:01,700 --> 00:02:08,410
to be the squares of these
coordinates, 1, 4, and 1.
33
00:02:08,410 --> 00:02:14,490
And my x hat--
that's just c and d.
34
00:02:14,490 --> 00:02:21,960
And my b-- this is going to be
the second coordinates, 1, 5,
35
00:02:21,960 --> 00:02:22,460
and -2.
36
00:02:25,820 --> 00:02:28,960
OK, why did I set this
problem up like that?
37
00:02:28,960 --> 00:02:34,950
Well, multiply A times x hat.
38
00:02:34,950 --> 00:02:38,970
The first coordinate of
A times x hat is 1 times
39
00:02:38,970 --> 00:02:41,720
c plus 1 times d.
40
00:02:41,720 --> 00:02:44,290
It's just the same as
plugging in this first point
41
00:02:44,290 --> 00:02:48,670
into the left-hand
side of this equation.
42
00:02:48,670 --> 00:02:53,060
And similarly, if I
took the second point
43
00:02:53,060 --> 00:02:55,630
and plugged it in here,
I would just get 2 times
44
00:02:55,630 --> 00:02:59,090
c plus 4 times d,
which is just the same
45
00:02:59,090 --> 00:03:02,840
as the second coordinate in the
multiplication A times x hat.
46
00:03:02,840 --> 00:03:06,490
2 times c plus 4 times d.
47
00:03:06,490 --> 00:03:08,120
OK, and where did
the b come from?
48
00:03:08,120 --> 00:03:10,840
Well, b came from
plugging in these points
49
00:03:10,840 --> 00:03:12,680
to the right-hand side.
50
00:03:12,680 --> 00:03:16,740
So 1, 5, and -2 are
just the y-coordinates
51
00:03:16,740 --> 00:03:19,720
of these three points.
52
00:03:19,720 --> 00:03:27,070
So it would be great if we
could solve A x hat equals b.
53
00:03:27,070 --> 00:03:33,680
But we can't solve
A x hat equals
54
00:03:33,680 --> 00:03:38,610
b, because there isn't
a quadratic equation
55
00:03:38,610 --> 00:03:41,500
through the origin that
contains these three points.
56
00:03:41,500 --> 00:03:44,880
But we need to find the
best approximation to that,
57
00:03:44,880 --> 00:03:48,340
so that's the same as
solving A x hat equals
58
00:03:48,340 --> 00:03:51,660
the projection of b onto
the column space of A.
59
00:03:51,660 --> 00:03:54,150
Because we only have a chance
of solving A x hat equals
60
00:03:54,150 --> 00:03:57,150
something if it's in
the column space of A.
61
00:03:57,150 --> 00:04:01,760
And remember from our
projections part of the class
62
00:04:01,760 --> 00:04:13,600
that this is the same as solving
A transpose A x hat equals
63
00:04:13,600 --> 00:04:14,340
A transpose b.
64
00:04:17,180 --> 00:04:19,540
So that's what we're
really going to do.
65
00:04:19,540 --> 00:04:21,710
We're really going
to solve A transpose
66
00:04:21,710 --> 00:04:24,640
A x hat equals A transpose b.
67
00:04:24,640 --> 00:04:27,840
And now all we have to
do is just a computation.
68
00:04:27,840 --> 00:04:29,400
So let's do it.
69
00:04:32,190 --> 00:04:36,210
So what is A transpose A?
70
00:04:36,210 --> 00:04:37,850
I'm going to do this
kind of quickly,
71
00:04:37,850 --> 00:04:41,400
because you should be good at
multiplying matrices by now.
72
00:04:56,130 --> 00:05:02,350
Oh this-- I have the negative
in the wrong place, thank you.
73
00:05:02,350 --> 00:05:03,475
Thanks for that correction.
74
00:05:03,475 --> 00:05:06,470
I have the negative
backwards there.
75
00:05:10,390 --> 00:05:13,065
And what do I get
when I multiply these?
76
00:05:13,065 --> 00:05:14,340
I'll let you check.
77
00:05:14,340 --> 00:05:17,952
This is 6, 8; 8, and 10.
78
00:05:22,560 --> 00:05:24,650
And what is A transpose b?
79
00:05:34,620 --> 00:05:37,970
Well, if you multiply
this out, I'll
80
00:05:37,970 --> 00:05:43,480
let you check that
you get 13 and 19.
81
00:05:46,540 --> 00:05:49,780
So this is just
some computation.
82
00:05:49,780 --> 00:05:54,600
And so what we're solving
here is [6, 8; 8, 10]
83
00:05:54,600 --> 00:05:59,720
times x hat equals [13; 19].
84
00:05:59,720 --> 00:06:04,640
And we remember how to do this
just by using elimination.
85
00:06:04,640 --> 00:06:08,690
We replace the second row
by 3 times the second row
86
00:06:08,690 --> 00:06:11,090
minus 4 times the first row.
87
00:06:11,090 --> 00:06:13,900
Again, I'm going to do this
quickly because you know this
88
00:06:13,900 --> 00:06:15,150
from other parts of the class.
89
00:06:18,280 --> 00:06:21,400
You similarly
change the b vector,
90
00:06:21,400 --> 00:06:30,750
and we backsolve
to get d is -5/2
91
00:06:30,750 --> 00:06:35,940
and c equals--
let's plug that in
92
00:06:35,940 --> 00:06:40,330
and see-- think you're
going to get 11 over 2.
93
00:06:40,330 --> 00:06:44,330
So what's our final equation?
94
00:06:44,330 --> 00:06:56,365
Our final equation is y equals
11/2 t minus 5/2 t squared.
95
00:07:04,280 --> 00:07:04,780
OK.
96
00:07:04,780 --> 00:07:08,520
So this is our best
fit quadratic equation
97
00:07:08,520 --> 00:07:10,150
through the origin.
98
00:07:10,150 --> 00:07:13,400
Now before I end, let
me do a couple things.
99
00:07:13,400 --> 00:07:18,460
First, let me go back and
review what the key steps were.
100
00:07:18,460 --> 00:07:23,380
Whenever you're faced with such
a best fit equation, first,
101
00:07:23,380 --> 00:07:26,670
you want to see what the
general form of the equation is.
102
00:07:26,670 --> 00:07:29,490
Next you want to write
it in terms of matrices.
103
00:07:29,490 --> 00:07:33,780
Write down your matrix
A and your vector b.
104
00:07:33,780 --> 00:07:38,750
And lastly, you set up
your projection equation.
105
00:07:38,750 --> 00:07:43,480
And then all you have to
do is just a computation.
106
00:07:43,480 --> 00:07:45,290
But it might also
be worth noting
107
00:07:45,290 --> 00:07:48,230
that these three
points certainly aren't
108
00:07:48,230 --> 00:07:51,210
on this quadratic equation.
109
00:07:51,210 --> 00:07:54,680
For instance, if I plug in 1
here, I don't get (1, 1), I get
110
00:07:54,680 --> 00:07:56,560
(1, 3).
111
00:07:56,560 --> 00:07:58,230
But that's OK.
112
00:07:58,230 --> 00:08:01,910
This is as close as we can do.
113
00:08:01,910 --> 00:08:03,318
Thanks.