I am trying to understand the least squares method, I have found a simple enough example, but it doesn't fully explain the last part of it.
http://www.emathzone.com/tutorials/basic-statistics/example-method-of-least-squares.html
The part I am struggling with is this part
"Eliminate ‘a’ from equation (1) and (2), multiply equation (2) by 3 and subtract form equation (2), we get the values of ‘a’ and ‘b’."
First of all, why do you multiple by 3? Is this it just some arbitrary number that works in this least squares method. Secondly how do I go about this calculation. I have tried it, and I don't understand how I am meant to get 2 values. It does not show the working out, and I fail to see how you can get 2 values from a single subtraction. If I multiple equation 2 by 3, then subtract from equation 2, I would only get one value. How is 1.1 and 1.3 retrieved?
Math is not exactly my strongest point, but I need to understand it for task I am working on. Would someone be able to show me exactly how this solution was worked out
Thanks in advance
OK Adam, if you go through what the Least Squares actually does you end up needing to find two numbers $a$ and $b$ that satisfy the simultaneous equations
$$\begin{align}5a+15b&=25\\ 15a+55b&=88.\end{align}$$ Now there are many different ways of solving such a pair of equations (a linear system if you will). Here I will show you the way you might have solved them in school all those years ago.
First we need to understand what these equations are saying. When I write down
$$2x+3=11,$$
what we do first is we assume that $x$ solves the equation.
The second thing you need to realise is that if you have an equation, for example,
$$2x+3=11,$$ then you are allowed to add something to both sides... because when two numbers are equal, for example five and five, then adding three to both of them leaves you with two numbers that are still equal. So for example you could add $-3$ to both sides of $2x+3=11$ and you get
$$2x=8,$$
and these two numbers are still equal.
We are also able to multiply both sides by the same thing and we will end up with numbers that are still equal... in fact, if we are careful, we can do a lot of different things to the two numbers that are equal and they will remain equal. If we multiply both sides by a half here we end up with
$$x=4.$$
So what we do is we assume that $x$ solves the original equation and we are lead then to the conclusion that $x$ must equal four and indeed $2x+3=2(4)+3=8+3=11$.
The next thing we need to realise is that if you have two equations, then you can add these equations together. For example suppose I have $$\begin{align} 2x&=1 \\y&=0. \end{align}$$ What I can do is add $y$ to $2x$ and add zero to one. Why? Well because $y$ is equal to zero I am actually only adding the same thing to both sides.
Now if we look at our equations
$$\begin{align} 5a+15b&=25 \\ 15a+55b&=88, \end{align}$$ the problem is we have two numbers to find... i.e. we assume that $a$ and $b$ solve both equations and we want to go off and conclude that they must equal this or that...
The next problem is that, in general, one equation in two unknowns can have an infinite number of solutions. For example, if $x$ and $y$ are whole numbers, then
$$x+y=0,$$ has infinite number of solutions. You can have $x=1$, $y=-1$, $x=2$, $y=-2$, etc. Now the way you want to think is... if only I could find an equation in only one unknown. You are able to do that as follows.
Try and match up the number of $a$s (or $b$s), by multiplying both sides of the first equation by three:
$$3(5a+15b)=3(25).$$
Remember. $5a+15b$ is equal to 25 so if you multiply it by three you get 75. Now you need the little fact that $x(y+z)=xy+xz$... I assume and hope this is OK for you:
$$15a+45b=75$$.
Now we have that these are equal and allied to the second equation we know have
$$\begin{align} 15a+45b&=75 \\ 15a+55b&=88. \end{align}$$ Similarly to equation one, just to make things nice for us later, we can multiply both sides of the second equation by minus one to get the two pairs of equal numbers:
$$\begin{align} 15a+45b&=75 \\ -15a-55b&=-88. \end{align}$$
Now if we add the equations together --- i.e. add -88 to 75 and an equal thing ($-15a-55b$) to $15a+45b$ and then we get another pair of equal numbers (the $\Rightarrow$ stands for 'means that' or 'implies that'):
$$\begin{align} 15a+45b+(-15a-55b)&=75+(-88) \\ \Rightarrow -10b&=-13 \end{align}$$ Now multiply both sides by minus one:
$$10b=13,$$ and multiply both sides by $\frac{1}{10}$:
$$b=\frac{13}{10}=1.3.$$
Great! We know $b$. Now we know that the numbers $5a+15b$ and $25$ are equal from the very start... but $b$ is equal to 1.3 so that:
$$5a+15(1.3)=25.$$
I will leave the rest up to you.
Make sure to end by presenting your answer nicely with
$$Y(X)=a+bX.$$