Find a and b so that f(x)=ax+b has a minimum sum of squared errors for the points (1,2),(3,4),(4,5)

sum of squares of errors,

s = [a(1)+b-2]^2  +[a(3)+b-4]^2  +[a(4)+b-5]^2 =(a+b-2)^2  +(3a+b-4)^2  +(4a+b-5)^2

Differentiating with respect to a

ds/da =2(a+b-2)(1)+2(3a+b-4)(3)+2(4a+b-5)(4)

=2a+2b-4+18a+6b-24+32a+8b-40

=52a + 16b - 68 => 52a + 16b = 68

Differentiating with respect to b

ds/db =2(a+b-2)+2(3a+b-4)+2(4a+b-5)

=2a+2b-4+6a+2b-8+8a+2b-10

=16a + 6b - 22  => 16a + 6b = 22

We have simultaneous equations

52a + 16b = 68

16a + 6b = 22

gives a = 1, b = 1

f(x)=1x+1

Expert Answers

An illustration of the letter 'A' in a speech bubbles

We have a linear model `f(x) = ax+b`

and want to minimise the sum of squares of the errors `(y - (ax+b))^2` given data

`(x,y) =` (1,2),(3,4),(4,5)

Rewrite the model as

`f(x) = a(x-bar(x)) + b_1`   where `b_1 = b + abar(x)`

Then the least-squares estimate of `b_1` is `bar(y)`

So  `hat(b_1) = (2+4+5)/3 = 11/3`

The least-square estimate of `a` is given by

`hat(a) = (Sigma_1^n(x_i-bar(x))(y_i-bar(y)))/(Sigma_1^n((x_i-barx)^2)) = ((1-8/3)(2-11/3)+(3-8/3)(4-11/3)+(4-8/3)(5-11/3))/((1-8/3)^2+(3-8/3)^2+(4-8/3)^2) `

`= (14/3)"/"(14/3) = 1`

Therefore the least-square estimate of `b` is given by

`hat(b_1) -hat(a)bar(x) = 11/3-(1)8/3 = 3/3 = 1`

least squares estimates are a=1, b=1

See eNotes Ad-Free

Start your 48-hour free trial to get access to more than 30,000 additional guides and more than 350,000 Homework Help questions answered by our experts.

Get 48 Hours Free Access
Approved by eNotes Editorial