# Thread: Check my answer for least square solution of Ax=b

1. ## Check my answer for least square solution of Ax=b

I was just trying to solve a couple of questions from the past exam tests and I've got the following answer for this question. Can someone check if my answer is right. I am not so sure. Thanks!
Let,
A = [ 1 1 0
1 1 0
1 0 1
1 0 1]

and b = [1,3,8,2]^T. Find the least squares solutions of the system Ax=b.

ANSWER:
The general least squares solution to this sort of problem is:

x = ((A^T)A)^(-1)*((A^T)*b)

In this case this will not yield a solution, since you have two pairs of identical rows, the A matrix represents only 2 independent realtions. As such, ((A^T)A) is singular so no solution exists.

2. Originally Posted by Skelly
I was just trying to solve a couple of questions from the past exam tests and I've got the following answer for this question. Can someone check if my answer is right. I am not so sure. Thanks!
Let,
A = [ 1 1 0
1 1 0
1 0 1
1 0 1]

and b = [1,3,8,2]^T. Find the least squares solutions of the system Ax=b.

ANSWER:
The general least squares solution to this sort of problem is:

x = ((A^T)A)^(-1)*((A^T)*b)

In this case this will not yield a solution, since you have two pairs of identical rows, the A matrix represents only 2 independent realtions. As such, ((A^T)A) is singular so no solution exists.
The question says find the least squares solutions (plural). Because A^T A is singular, there are an infinite number of solutions. They are the solutions to the normal equations A^T A x = A^T b. When A^T A is nonsingular, there is a unique solution to those equations, which you give. Here you must form the normal equations and find the general form of the solutions, which is x1 + x2 = 2 and x1 + x3 = 5.