# Weighted Least Squares Solution

samgrace

## Homework Statement

\begin{bmatrix}
3x_{1}& 7x_{2}& 4x_{3} \\
3x_{1}& 4x_{2}& 5x_{3} \\
x_{1}& 10x_{2}& 8x_{3} \\
8x_{1}& 8x_{2}& 6x_{3} \\
\end{bmatrix}
=
\begin{bmatrix}
26 \\
16 \\
33 \\
46 \\
\end{bmatrix}
the measurements represented by equations 1 and 3 above can be trusted more than those represented by equations 2 and 4 and are given twice the weight.

Write down an explicit matrix form for the system of equations.

Solve it using Matlab.

However all I really need is to find the weighting factor, I can do the rest from there, struggling to see how I can weight the first and third rows by a factor of two, whilst simultaneously leaving the first and fourth alone.

## Homework Equations

I am going to use

Ax = b
e = W(Ax-b)
so

e^{T}e = (Ax-b)^T*W^T*W*(Ax-b)

so A^T*W^T*W*A*x = A^T*W^T*W*b

basically multiply that out and solve via guassian elimination for x

## The Attempt at a Solution

e = W(Ax-b)

\begin{bmatrix}
e \\
e \\
e \\
e \\
\end{bmatrix}

=
\begin{bmatrix}
?& ?& ?& ?& \\
?& ?& ?& ?& \\
?& ?& ?& ?& \\
?& ?& ?& ?& \\
\end{bmatrix}

*

\begin{bmatrix}
3x_{1}& 7x_{2}& 4x_{3}& -26& \\
3x_{1}& 4x_{2}& 5x_{3}& -16& \\
x_{1}& 10x_{2}& 8x_{3}& -33& \\
8x_{1}& 8x_{2}& 6x_{3}& -46& \\
\end{bmatrix}

I have tried various combinations of 4x4 matrices for the ?????? matrix (weighting matrix) that will result in the weighting factor needed, e.g a diagonal 4x4 matrix of 2's, works however the other rows get multiplied by this as well. Please inform me of how to find this.

Mentor
e.g a diagonal 4x4 matrix of 2's, works however the other rows get multiplied by this as well.
Then you should use "1" instead of "2" at some places.

samgrace
Need all of the elements in rows 1 and 3 to be multiplied by two and this cannot be acheived if some are ones. Also need all the elements in rows 2 and 4 to remain the same and this cannot be acheied if some are twos. Tried an algebraic finding of the weighing coefficients but to no avail.

samgrace
No need for an answer I have now solved it

Mentor
No need for an answer I have now solved it
You can help others with the same question in the future if you post the solution here.