Thanks to ked4r for his post on solving this problem without calculus (http://forums.udacity.com/cs215/questions/3277/spoilers-mathematical-proofs-for-ps4-2-and-ps4-3/3296):
The question requests that given a list of numbersyou calculate a value to
Expanding the square, we get:
Note thatdoes not depend on so equation is equivalent to calculating
Let. Then we can write
We can then add and subtract, which completes the square.
Again, note thatdoesn't depend on , and that . This implies that Equation is minimized when and , which is the mean of .
Calculating the mean of