Question
Say that you want to measure something, say the length of a table. Denote by the exact length of the table. Say now that you do a certain number of measures of the length of the table and get values
where is the number of measures you took. Now using all these measures, you want to construct an approximated value which should give you a solid idea of how much the real measure is. How to do so efficiently?
One very good idea would be to say that you want your value to be the one that has the smallest sum of the square of the differences to all your measures. What does that mean, it means you want to compute
and you'll say that your best guess for is the value that makes the above as small as possible. Why that? Well it makes sense to look at all the differences but since some might be positive and some negative, it makes sense to square them just to get them all positive and then to sum all that. Any number that makes the sum of the square differences small can be thought as being fairly in the middle and hence a really good guess for what all these measures are trying to get at.
Now the question is of course: great, how do I find that guy if I'm given all these measures ?
Solution
|
Before reading the solution, you should really try the problem for yourself. By should I mean that if you don't you will not gain any understanding, whatever you might believe, this is 100% guaranteed. So do yourself a favour, try the problem and look at the solution once you've gave it an authentic try.
Solution
|
Well, let's just use optimization! So we assume that we are given the values and we're looking for the value that will minimize the sum of the square of the differences, in other words, we're looking for the minimum value of the function:
To do this, we'll start by finding its critical points. So we need first to compute its derivative.
Then solve it for zero.
and so
Which is the only critical point and clearly a minimum since the second derivative of the function is
which is always positive and hence concave up.
Looking more closely at our answer, we actually see that
is the average of the values . So we've actually proved that the average of all the measures yields the value that minimizes the sum of the square of the difference of all the measures; a result that should have felt quite intuitive but for which we have a deeper understanding now.
|
|