# Infinitely many least-square solutions

#### Fernando Revilla

##### Well-known member
MHB Math Helper
I quote a question from Yahoo! Answers

Hard Linear Algebra Q: Find a least-square solution of the inconsistent system Ax=b.?
1 1 0 0 = A
1 1 0 0
1 0 1 0
1 0 1 0
1 0 0 1
1 0 0 1

7 = b
8
0
2
4
1

The answer options are:
A) [5/2, 5, -7/2, 0] + x4[-1, 1, 1, 1]
B) [5/2, 5, -3/2, 0] + x4[-1, 1, 1, 1]
C) [5/4, 5, -3/2, 0] + x4[-1, 1, 1, 0]
D) [5/2, 4, -3/2, 0] + x4[-1, -1, 1, 1]
I have given a link to the topic there so the OP can see my response.

#### Fernando Revilla

##### Well-known member
MHB Math Helper
According to a well known theorem, the least squares solutions of $Ax=b$ are the solutions of the consistent system $A^TAx=A^Tb$. In our case, you'll get;

$$A^TAx=A^Tb \Leftrightarrow \begin{bmatrix}{6}&{2}&{2}&{2}\\{2}&{2}&{0}&{0}\\{2}&{0}&{2}&{0}\\ {2}&{0}&{0}&{2}\end{bmatrix}\begin{bmatrix}{x_1}\\{x_2}\\{x_3}\\{x_4}\end{bmatrix}=\begin{bmatrix}{22}\\{15}\\{2}\\{5}\end{bmatrix}$$
Now, solve the last system using the Gauss method and you'll find solutions of the form $a+x_4v$ with $a,v\in\mathbb{R}^4$ and $x_4\in\mathbb{R}$.