WEBVTT
00:00:07.980 --> 00:00:09.430
PROFESSOR: Hi, and welcome.
00:00:09.430 --> 00:00:11.580
Today we're going to do
a problem about least
00:00:11.580 --> 00:00:13.910
squares approximations.
00:00:13.910 --> 00:00:15.510
Here's the question.
00:00:15.510 --> 00:00:18.740
Find the quadratic equation
through the origin that
00:00:18.740 --> 00:00:24.090
is a best fit for these
three points: (1, 1), (2, 5),
00:00:24.090 --> 00:00:27.060
and (-1, -2).
00:00:27.060 --> 00:00:30.150
I'll give you a minute to
work that out on your own.
00:00:30.150 --> 00:00:32.090
You can hit the
pause button now,
00:00:32.090 --> 00:00:35.440
and we'll be back in a minute to
work the problem out together.
00:00:47.430 --> 00:00:50.690
OK and we're back.
00:00:50.690 --> 00:00:53.790
So what's the first step
in a problem like this?
00:00:53.790 --> 00:00:58.220
The first step is figuring out
what our equation looks like,
00:00:58.220 --> 00:01:00.280
the one that we're
going to find.
00:01:00.280 --> 00:01:07.740
So our equation is going to
look like c*t plus d t squared
00:01:07.740 --> 00:01:10.150
equals y.
00:01:10.150 --> 00:01:11.790
So that's what
we're looking for.
00:01:11.790 --> 00:01:15.780
We're looking for a quadratic
equation through the origin.
00:01:15.780 --> 00:01:17.740
Now, if it were just
any quadratic equation,
00:01:17.740 --> 00:01:19.530
then we would have
a constant term,
00:01:19.530 --> 00:01:21.410
but through the
origin just means
00:01:21.410 --> 00:01:25.730
that the constant term is 0.
00:01:25.730 --> 00:01:28.250
Now, what's the next step?
00:01:28.250 --> 00:01:31.980
Next we need to set
up a matrix equation.
00:01:31.980 --> 00:01:43.890
So we need an A, a
matrix A. And which
00:01:43.890 --> 00:01:46.740
matrix is that going to be?
00:01:46.740 --> 00:01:51.360
Well, let me start with the
first coordinate of these three
00:01:51.360 --> 00:01:52.790
points.
00:01:52.790 --> 00:01:57.450
And I'm going to put them in the
first column of this matrix, 1,
00:01:57.450 --> 00:01:59.200
2, -1.
00:01:59.200 --> 00:02:01.700
And then my second
column is going
00:02:01.700 --> 00:02:08.410
to be the squares of these
coordinates, 1, 4, and 1.
00:02:08.410 --> 00:02:14.490
And my x hat--
that's just c and d.
00:02:14.490 --> 00:02:21.960
And my b-- this is going to be
the second coordinates, 1, 5,
00:02:21.960 --> 00:02:22.460
and -2.
00:02:25.820 --> 00:02:28.960
OK, why did I set this
problem up like that?
00:02:28.960 --> 00:02:34.950
Well, multiply A times x hat.
00:02:34.950 --> 00:02:38.970
The first coordinate of
A times x hat is 1 times
00:02:38.970 --> 00:02:41.720
c plus 1 times d.
00:02:41.720 --> 00:02:44.290
It's just the same as
plugging in this first point
00:02:44.290 --> 00:02:48.670
into the left-hand
side of this equation.
00:02:48.670 --> 00:02:53.060
And similarly, if I
took the second point
00:02:53.060 --> 00:02:55.630
and plugged it in here,
I would just get 2 times
00:02:55.630 --> 00:02:59.090
c plus 4 times d,
which is just the same
00:02:59.090 --> 00:03:02.840
as the second coordinate in the
multiplication A times x hat.
00:03:02.840 --> 00:03:06.490
2 times c plus 4 times d.
00:03:06.490 --> 00:03:08.120
OK, and where did
the b come from?
00:03:08.120 --> 00:03:10.840
Well, b came from
plugging in these points
00:03:10.840 --> 00:03:12.680
to the right-hand side.
00:03:12.680 --> 00:03:16.740
So 1, 5, and -2 are
just the y-coordinates
00:03:16.740 --> 00:03:19.720
of these three points.
00:03:19.720 --> 00:03:27.070
So it would be great if we
could solve A x hat equals b.
00:03:27.070 --> 00:03:33.680
But we can't solve
A x hat equals
00:03:33.680 --> 00:03:38.610
b, because there isn't
a quadratic equation
00:03:38.610 --> 00:03:41.500
through the origin that
contains these three points.
00:03:41.500 --> 00:03:44.880
But we need to find the
best approximation to that,
00:03:44.880 --> 00:03:48.340
so that's the same as
solving A x hat equals
00:03:48.340 --> 00:03:51.660
the projection of b onto
the column space of A.
00:03:51.660 --> 00:03:54.150
Because we only have a chance
of solving A x hat equals
00:03:54.150 --> 00:03:57.150
something if it's in
the column space of A.
00:03:57.150 --> 00:04:01.760
And remember from our
projections part of the class
00:04:01.760 --> 00:04:13.600
that this is the same as solving
A transpose A x hat equals
00:04:13.600 --> 00:04:14.340
A transpose b.
00:04:17.180 --> 00:04:19.540
So that's what we're
really going to do.
00:04:19.540 --> 00:04:21.710
We're really going
to solve A transpose
00:04:21.710 --> 00:04:24.640
A x hat equals A transpose b.
00:04:24.640 --> 00:04:27.840
And now all we have to
do is just a computation.
00:04:27.840 --> 00:04:29.400
So let's do it.
00:04:32.190 --> 00:04:36.210
So what is A transpose A?
00:04:36.210 --> 00:04:37.850
I'm going to do this
kind of quickly,
00:04:37.850 --> 00:04:41.400
because you should be good at
multiplying matrices by now.
00:04:56.130 --> 00:05:02.350
Oh this-- I have the negative
in the wrong place, thank you.
00:05:02.350 --> 00:05:03.475
Thanks for that correction.
00:05:03.475 --> 00:05:06.470
I have the negative
backwards there.
00:05:10.390 --> 00:05:13.065
And what do I get
when I multiply these?
00:05:13.065 --> 00:05:14.340
I'll let you check.
00:05:14.340 --> 00:05:17.952
This is 6, 8; 8, and 10.
00:05:22.560 --> 00:05:24.650
And what is A transpose b?
00:05:34.620 --> 00:05:37.970
Well, if you multiply
this out, I'll
00:05:37.970 --> 00:05:43.480
let you check that
you get 13 and 19.
00:05:46.540 --> 00:05:49.780
So this is just
some computation.
00:05:49.780 --> 00:05:54.600
And so what we're solving
here is [6, 8; 8, 10]
00:05:54.600 --> 00:05:59.720
times x hat equals [13; 19].
00:05:59.720 --> 00:06:04.640
And we remember how to do this
just by using elimination.
00:06:04.640 --> 00:06:08.690
We replace the second row
by 3 times the second row
00:06:08.690 --> 00:06:11.090
minus 4 times the first row.
00:06:11.090 --> 00:06:13.900
Again, I'm going to do this
quickly because you know this
00:06:13.900 --> 00:06:15.150
from other parts of the class.
00:06:18.280 --> 00:06:21.400
You similarly
change the b vector,
00:06:21.400 --> 00:06:30.750
and we backsolve
to get d is -5/2
00:06:30.750 --> 00:06:35.940
and c equals--
let's plug that in
00:06:35.940 --> 00:06:40.330
and see-- think you're
going to get 11 over 2.
00:06:40.330 --> 00:06:44.330
So what's our final equation?
00:06:44.330 --> 00:06:56.365
Our final equation is y equals
11/2 t minus 5/2 t squared.
00:07:04.280 --> 00:07:04.780
OK.
00:07:04.780 --> 00:07:08.520
So this is our best
fit quadratic equation
00:07:08.520 --> 00:07:10.150
through the origin.
00:07:10.150 --> 00:07:13.400
Now before I end, let
me do a couple things.
00:07:13.400 --> 00:07:18.460
First, let me go back and
review what the key steps were.
00:07:18.460 --> 00:07:23.380
Whenever you're faced with such
a best fit equation, first,
00:07:23.380 --> 00:07:26.670
you want to see what the
general form of the equation is.
00:07:26.670 --> 00:07:29.490
Next you want to write
it in terms of matrices.
00:07:29.490 --> 00:07:33.780
Write down your matrix
A and your vector b.
00:07:33.780 --> 00:07:38.750
And lastly, you set up
your projection equation.
00:07:38.750 --> 00:07:43.480
And then all you have to
do is just a computation.
00:07:43.480 --> 00:07:45.290
But it might also
be worth noting
00:07:45.290 --> 00:07:48.230
that these three
points certainly aren't
00:07:48.230 --> 00:07:51.210
on this quadratic equation.
00:07:51.210 --> 00:07:54.680
For instance, if I plug in 1
here, I don't get (1, 1), I get
00:07:54.680 --> 00:07:56.560
(1, 3).
00:07:56.560 --> 00:07:58.230
But that's OK.
00:07:58.230 --> 00:08:01.910
This is as close as we can do.
00:08:01.910 --> 00:08:03.318
Thanks.