How do I solve these least-squares exercises?

SegFault123

New member
Joined
Feb 5, 2021
Messages
1
I'm having some trouble using the least squares method on these exercises. Normally what I do is write the system as A^tAx=A^tb and

1-Use the normal equations to find the parabola ax^2+3x+b that goes through (2,1.5), (-1,1.7) and (1,1.9) using the least squares method.
2-Use the normal equations to find the parabola x^2+bx+c that goes through (-1,2), (1,-1) and (2,1) using the least squares method.

1- All goes well until I get to the L^tx = y part. (Find $ax^2+3x+b$ that goes through the given points using the least squares). I think the way I write the matrix is wrong. That 3x is confusing me. Could someone show me how to setup the system? I can do it on my own afterwards.

2- Same as above.

3-Find the line that best represents the points (0,1),(1,2) and (2,1) using the least-squares method.
4-Using the Normal Equations, find the line y=ax+b that goes through the points (1,2),(-1,0) and (-1,-2) using the least squares method.

3 - When I set up the system as

A =
1 0
1 1
1 2

x =
b
a

b =
1
2
1

And then try to turn this into A^tAx=A^tb, the problem is that A^tA is a 3x3 matrix and x is a 2x1 matrix. I could solve this by getting rid of that (0,1) point as it's implicit in the first col of A, but that doesn't seem correct...

4- Same issue, only here I can't remove points. Help?
 
Top