# Least Squares solution and residuals

1. Aug 3, 2011

### Mr_Orsum

1. The problem statement, all variables and given/known data

Solve the following linear equations simultaneously by the Least Squares solution and calculate the residuals.

2. Relevant equations

3x + 2y + z = 5

x + 6y - z = -7

x - y + 2z = 3

5x - 2y = 1

3. The attempt at a solution

This is a question from this guy at work who is studying to be a surveyor. He knows me as the "Maths Genius" because I recently finished high school and got Valedictorian. He is really old and doesn't really get computers/internet. However I didn't learn this sort of thing in high school, and after watching this [http://www.youtube.com/watch?v=8mAZYv5wIcE]khanacademy[/test] vid, I only understood the Matrix forms but know nothing of the A transpose. Any help is appreciated.

2. Aug 4, 2011

### ehild

The transpose of a matrix A is a matrix formed from A by interchanging the rows and columns such that row i of matrix A becomes column i of the transposed matrix. The transpose of A is denoted by AT. Multiplying a matrix A with its transposed you get a square matrix.

ehild

3. Aug 4, 2011

### Mr_Orsum

Hey ehild,

Thanks for the information. I found a bit more info on AT and I understand that part of it now. But I still don't understand the rest. A friend of mine is in his first year at uni and has dealt with some of it but doesn't know anything about the Least squares method or how to calculate residuals. Any info is appreciated, even something to point me in the right direction. I am happy to learn

4. Aug 4, 2011

### ehild

This least squares problem is more general than the method used for curve fitting and I am familiar with. Try to read:

http://www.mathworks.com/moler/leastsquares.pdf [Broken]

ehild

Last edited by a moderator: May 5, 2017
5. Aug 4, 2011

### Ray Vickson

If you have access to EXCEL (or similar open-source spreadsheets) you can solve this directly using the Solver Tool: you want to minimize (3x+2y+z-5)^2+ ... +(5x-2y-1)^2, by varying x, y and z. Solver can handle such problems readily, up to a few hundred variables and equations.

RGV