00:01
Given endpoints in the plane x1, y1, x2, y2, up to xn, y, n, the regression line y equals mx plus p can be found using the list squares method by minimizing the function g of mb equals sum from one to n of the squares of the recereals, that is m x of i plus b minus y so by square these receivables represent the difference between the reversion line at x of i minus y so g is a function of two variables m and y and b sorry where m and b are the coefficients that determine the regression line so we got to find m and b in order to know the regression line.
01:09
So in part a, we are going to prove that if the partial derivatives of g respect to m and b are equal 0, then the variables m and b satisfy the equations given here, which represents a linear system on the two variables m and b, where the coefficients are these values highlighted here.
01:36
These are the coefficients of the matrix, 2 by 2 matrix, and these are the independent terms on the right.
01:48
So what we are doing here is to calculate the critical points of g because we are solving the equations, partial derivatives of g equal to 0.
02:06
And what we want to do is show that to find the critical points of g is the same as solving the system of linear equations.
02:19
So we start with calculating the partial derivative of g respect to m.
02:28
That's the partial derivative respect to m of the sum of m x of i plus b minus y of i square.
02:41
And we know by the linearity of the derivative that this is the sum from 1 to n of the partial derivative respect to m of m x of i plus b minus y square.
02:59
And this is the sum from 1 to n of 2 times m x of i plus b minus y sub i times the partial derivative respect.
03:18
To m of m x y plus p minus y so y here we have applied the shame rule so we have the sum of this general term here and the derivative here is equal to x of i so this is equal to the sum from one to n of two m x y plus b minus y so y times x of i and we have this factor two can be put out of this sum because it's a constant so we get two times sum from one to n of and then we can also distribute this x of i inside the parenthesis and we get m x of i square plus b x of i minus x of y y and that's equal to two times well we let it that point because we now we can equate this to zero so you can say that partial derivative respect to m equals zero implies that two sum from one to n of these general term m x of i squared plus b x of i minus x of i y y sub i is equal to zero so we can pass two divided by divided zero to the right and we get sum from one to n of m x of i square plus b x of i minus x y of i equal zero and we can separate this sum term by term so we get sum from one to n of m x of y square plus sum from one to n of p x of i minus sum from one to n of x y y y of i equal zero we recognize here m is a constant b is a constant so they can be put out of their sums so we get m times sum from one to n of x of y square plus b sum of x of x y square plus b sum of x of i from 1 to n equals we can put this term to the right so we get sum of x y y sub i from 1 to n and we can write this using the commutative property of the product so we get sum of x of i square from 1 to n times m plus the sum of x of i from 1 to n times b equals sum of x of i from 1 to n of the x x x y sub i from one to n and this is exactly the first equation of the linear system here this equation here and now we go to the second equation and that corresponds to the partial derivative respect to b of g and we know that is a partial derivative respect to b of the sum from one to n minus y of i square by the linearity of the derivative this is the sum from one to n of the partial derivative respect to p of m x of i plus b minus y so i square and this is the sum from one to n of two times m x of i plus b minus y so i times the partial derivative respect to b of the base mxy plus b minus y y -so -i.
08:00
And this derivative here is equal to 1.
08:03
So this is the sum from 1 to n.
08:07
We are going to put this here equal 1.
08:12
So this is sum.
08:15
And we also are going to put this factor 2 outside of the sum, because it's a constant, so it's 2, sum of m x x x x x x plus v minus y x x x x x x x x5 .5 equals i equals i equals i equal 0.
08:37
We can pass 2, divide into the right, and we get sum from 1 to n of m x y sub i plus v minus y sub i equal 0.
08:48
We can pass 2, divide into the right, and we get sum from 1 to n of m x y0 plus b minus b minus y so i equals 0 and there we distribute this sum here so we get you know ready we know m is a constant is a constant so we get m sum from 1 to n of x of i plus b sum from 1 to n of 1 equals and we put the term to the right already that is sum of y so i from 1 to n and this sum here equal to n so we can write this way sum of x x x times m plus b times n that is m times it's the same thing equal sum of y -o -i and this is the second equation we have here right here so we have proved that the partial derivative of g both equal zero implies that m and b satisfy the linear system of equations given here.
10:41
Now in part b we are going to prove the following if x bar represents the arithmetic average of the x of i, that is the sum of the x of i over n, then n times the sum of the x of i square minus the square of the sum of the x of i is greater than or equal to zero.
11:05
So this is positive or zero.
11:07
And we have equality with zero or equality to zero, if and only if all the x -5 are the same value.
11:20
And so for that, we're going to use the fact that the sum from 1 to n of x -y minus x -bar square is created than or equal to 0.
11:33
This is true because we have the sum of squares of real numbers.
11:38
So this sum get to be positive or zero.
11:43
From this fact, we're going to prove this inequality up here.
11:50
So we start by developing this sum from 1 to n of x x minus x bar square.
12:03
That's the sum from 1 to n of x.
12:10
Minus 2x bar times x of i plus x bar square and we can separate this sum this is sum of x of i square minus in the second sum we will have here and 2 x bar is a constant so we can put it out of the sum so it's 2 x bar times sum of x of i plus and again this x bar square is a constant so we got plus x bar times sum from 1 to n of 1.
12:57
So this is equal to the sum from 1 to n of x of i square minus 2 x bar sum of x of i plus and this sum here is equal to n so we got n x bar.
13:16
I think i forgot the square here x bar square so it's x bar square so it x bar square square square okay now we can replace x bar here by its definition so we get sum of x of i square minus two times x y which is sum of i divided by n times this sum here which is sum of x of i from one to n plus n times and we can do the same here which is sum of x of i from one to n plus n plus n times and we can do the same thing here so we put what is x bar that is the sum of x of i from 1 to n over n and that square we note here that this is the sum of x of i square from 1 to n minus 2 over n times the sum of x of i square because we have this sum here in the numerator and the same sense multiply in here so it's that sum square plus n times and the square here is a square of the sum over n square we can now simplify this n with this n square here and we get some of x i square from 1 to n minus 2 over n times the sum of x of i that sum square that sum square plus and we get here 1 over n times the sun sum of x of i square and we recognize here a common factor sum of x of i square so we get sum from 1 to n of x of i square minus negative 2 over n plus 1 over n times the common factor sum of x of i squared and negative 2 over n plus 1 over n is negative 1 over n so this is equal to the sum of the x of i square minus 1 over n times the sum of the x of i square so we have proven that the sum remember we start up with the sum of the squares of x x y minus x bar so we prove here that the sum x of i minus x bar square is exactly the same as the sum of x of i square minus 1 over n times the sum of x of i square they are equal but we know that this sum here is greater than equal 0 so this implies theoretically that the sum of x of i square from 1 to n minus 1 over n times the sum of x of i square is greater than or equal 0 and we can multiply both sides by n that doesn't change the sense of the inequality because n is positive so n positive implies that n times the left side is is n times the sum of the x of i square from one to n minus n times this second term is n is going to be cancelled so we get the square of the sum of the x of i that's squared iron equal to zero which is just what we wanted to prove here so now we're going to prove the second part that is and we have equality in this inequality if and only if all the x of i are the same.
18:21
So first we are going to assume that all the x of i are the same.
18:39
Say for example x1 is x2 is equal to up to xn that is all are equal.
18:47
Let's say they are equal to comma value x.
18:52
Then we are going to calculate all this expression here.
18:56
So n times the sum of x x square from 1 to n minus the square of the sum of the x of i from 1 to n square is equal to n sum from 1 to n any x of i is equal to x so we get x square minus the sum of x and that sum square and that's equal to n times and here we know x is a constant x squared is a constant so we get x square times the sum from one to n of one minus here the same thing inside this sum is x which is constant we get x times sum from one to n of one and that square and that's equal to n x squared and that's times the sum of 1 n times is n minus x times some of 1 and times is n squared and that is x square n square here minus x square n square they are the same so it's zero so if all the x of i are the same we have equality here now we are going to suppose the other side that is we are going to suppose we have equality that is n times the sum from 1 to n of x of i square minus the square of the sum of the x of i is 0 we have equality with 0 and and this implies then multiplying both sides by 1 over n that sum of the x of i square minus 1 over n times sum from 1 to n of x of i square is 0.
21:34
But remember we prove at the very beginning that this expression here is exactly equal to this one.
21:53
That is, we prove at the very beginning of this part b, this equality here.
22:06
This implies that the sum of x x x bar square from 1 to n is 0 because this expression here is equal to this 1.
22:27
So if this is 0, this is 0.
22:30
But here, all the terms we are summing here are positive or null.
22:38
That is x of i minus x bar square is greater than to zero for all i so the only way this sum here is equal to zero being all the terms greater than recal zero is that all the terms are zero so the only way sum of x of i minus x bar square is zero is that x of i minus x bar square is zero for all i that is all the terms in the sum get to be zero that is because all the terms are very down equal to zero so we have for all i for all index i the square is equal to zero that it means that x i minus x bar is zero for all i and this implies that x of i equals x bar for all i that is, all the x of i are equal, are the same and are equal, in fact, to the average of their values...