Science:Math Exam Resources/Courses/MATH221/April 2013/Question 11
• Q1 • Q2 (a) • Q2 (b) • Q2 (c) • Q2 (d) • Q3 • Q4 • Q5 • Q6 • Q7 (a) • Q7 (b) • Q7 (c) • Q8 • Q9 • Q10 • Q11 • Q12 (a) • Q12 (b) • Q12 (c) •
Question 11 

Consider the follow matrix A and vector b: Find the least squares solution x for the linear system Ax = b. Use this to find a linear function whose graph best fits the points (1,0), (0,1), (1,2), and (2,2) in . 
Make sure you understand the problem fully: What is the question asking you to do? Are there specific conditions or constraints that you should take note of? How will you know if your answer is correct from your work only? Can you rephrase the question in your own words in a way that makes sense to you? 
If you are stuck, check the hints below. Read the first one and consider it for a while. Does it give you a new idea on how to approach the problem? If so, try it! If after a while you are still stuck, go for the next hint. 
Hint 1 

What is the dimension of the least square solution vector x? 
Hint 2 

The equation Ax = b is overdetermined, and does not have a solution. What we mean by least square solution x is the vector that satisfies 
Hint 3 

In order to find the least square solution solve the normal equations 
Hint 4 

Now that you know it is time to look at how the matrix A and the vector b were chosen. How does this relate to the equation of a line Consider each of the four points, one at a time. 
Checking a solution serves two purposes: helping you if, after having used all the hints, you still are stuck on the problem; or if you have solved the problem and would like to check your work.

Solution 

Found a typo? Is this solution unclear? Let us know here.
Please rate my easiness! It's quick and helps everyone guide their studies. The least squares solution vector is a 2x1 vector. We can quickly find it using the normal equations. To find from here we can either invert the matrix on the left hand side, or use gaussian elimination. We choose the latter. Hence
best fits the four given points (x_{1},y_{1}), (x_{2},y_{2}), (x_{3},y_{3}), (x_{4},y_{4}). To answer this we need to understand how the matrix A and the vector b were chosen. We notice that b holds the y values. Further, the x values of the points, are in the second column of A. The first column of A is ones and this is because the same constant t appears for each (x,y) pair. In matrix notation Reading line by line reveals for j = 1,2,3,4. Comparing to y = mx + t we obtain The graph below is just for illustration purposes. It is not necessary to include a graph in your answer. Therefore, the linear function is given by 