Can someone derive (or provide a complete reference for) the least squares solution of a linear system in the cases of overdetermined, square, and underdetermined? I added a link to a solution I compiled that gives the information I want to derive: https://math.stackexchange.com/a/2138532/246090
derive:
minimal residual solution family $\hat x \in \hat X$ of overdetermined system Ax=b, when $A^TA$ nonsingular and also derive the solution with minimal $\|\hat x\|$
minimal residual solution family $\hat x \in \hat X$ of overdetermined system Ax=b, when $A^TA$ is singular and also derive the solution with minimal $\|\hat x\|$
minimal residual solution family $\hat x \in \hat X$ of square system Ax=b, when $A^TA$ is nonsingular and also derive the solution with minimal $\|\hat x\|$
minimal residual solution family $\hat x \in \hat X$ of square system Ax=b, when $A^TA$ is singular and also derive the solution with minimal $\|\hat x\|$
minimal residual solution family $\hat x \in \hat X$ of underdetermined system Ax=b, when $A^TA$ is nonsingular and also derive the solution with minimal $\|\hat x\|$
minimal residual solution family $\hat x \in \hat X$ of underdetermined system Ax=b, when $A^TA$ is singular and also derive the solution with minimal $\|\hat x\|$