Why does sum of squares appear in so many mathematical applications? I have some little background in statistics, where in many applications summing of squares is an important calculation. Recently, I came across a mention that summing squares is involved in calculating Euclidian distance (it's a connection which never occurred to me, I am not a mathematician by any means). This got me wondering whether there is perhaps some deep similarity between them, so I looked "summing of squares" up in wikipedia and found this lengthy disambiguation page, much of it referring to things I don't understand. 
This makes me wonder, if something as seemingly simple and seemingly rather arbitrary as summing squares shows up in so many places, is there some deeper reason for this, a connection between all of them? Is there some common problem that summing of squares is solving in all (or most, or many) of these cases?
As I mentioned I am not a mathematician by any means, and this may be an idiotic question. Still, I did do some searching around and didn't find anything obviously related.
 A: One can not simply answer this question. It is just too broad. But I guess the story starts from the Pythagorean theorem. The Pythagorean theorem for right-angled triangles in the plane could be used as a measure of distance between points in the x-y coordinates in $\mathbb{R}^2$. You could prove a similar theorem for the distance between two points in 3-dimensional space by using the Pythagorean theorem and then you just generalize the formula for n-dimensional spaces by defining it that way. This way you can define the concept of distance to a Cartesian coordinate system for any dimension. The concept of distance is very important on its own because many mathematical and statistical properties are defined using distance. For example, before mathematicians create topology, the limit of a sequence was defined such that as n goes to infinity, the distance between the terms of the sequence and the limit of the sequence becomes negligible. The idea of distance is generalized by a metric function which gives us 'metric spaces' that are one of the most studied kinds of topological spaces. On the other hand, as Gauss showed, you can study non-Euclidean geometries by a generalization of the Euclidean distance to something of the form $\mu_{11}(dx)^2 + 2\mu_{12}(dx)(dy)+\mu_{22}(dy)^2$ which gives the distance between two close points on a curved 2-dimensional surface. Something like this is called a quadratic form and is a generalization of sum of squares. Riemann later generalized Gauss idea to higher dimensions.
Another thing which is noteworthy is that you can write quadratic forms by matrices,  see that wikipedia article for more details. This is very important because then you can use the tools of linear algebra to study quadratic forms and this is a BIG advantage. There are some very nice theorems about quadratic forms. For example it's possible to simplify a quadratic form into a sum of squares as you can read about it on that wikipedia article. Unfortunately, we don't know much about cubic forms or forms of higher degrees. Had we known them as well as we know quadratic forms then it would've been much easier to deal with them. It would've been a great progress in the theory of elliptic curves for example. So, after all this nonsense that I have written, I want to tell you that the objects of interest for mathematicians are actually quadratic forms, not only sum of squares, and sum of squares are a special case of quadratic forms. And the reason for this is mostly because we have more tools to study them. That's why we understand the nature of conic sections and their 3-D counterparts way better than the way we understand the nature of elliptic curves,...
