Average Distances From The Origin Consider all points $(m,n)$ where $m$ and $n$ are natural numbers,
  $m\leq10$, and $n\leq5$. What is the average distances from each point
  to the origin $(0,0)$?


I know how to find the distance $d$ between the points $(x_1,y_1)$ and $(x_2,y_2)$;
$d=\sqrt{(x_1-x_2)^2+(y_1-y_2)^2}$.

In this case, the first point is $(m,n)$ and the second point is the origin, therefore the distance, $d=\sqrt{m^2+n^2}$.

It is annoying to find all distances, summing them, and dividing them by the number of distances, is not it annoying?

What if the given conditions, $m\leq10$ and $n\leq5$, were changed to $m\leq49$ and $n\leq36$?!
There is a quick solution for a related problem, even though it's not quite what you are asking. If you are willing to compute squares of distances of all points, then you get
$$
\begin{split}
f(m,n)
 &amp;= \sum_{i=1}^m \sum_{k=1}^n \left(i^2 + k^2\right) \\
 &amp;= \sum_{i=1}^m \sum_{k=1}^n i^2 + \sum_{i=1}^m \sum_{k=1}^n k^2 \\
 &amp;= n \sum_{i=1}^m i^2 + m \sum_{k=1}^n k^2 \\
 &amp;= n \frac{m(m+1)(2m+1)}{6} + m \frac{n(n+1)(2n+1)}{6} \\
 &amp;= \frac{mn}{6} \left[(m+1)(2m+1) + (n+1)(2n+1)\right]
\end{split}
$$

As expected, $f(m,n)$ is symmetric in $m,n$, in other words, $f(m,n) = f(n,m)$...
There is a quick solution for a related problem, even though it's not quite what you are asking. If you are willing to compute squares of distances of all points, then you get
$$
\begin{split}
f(m,n)
 &amp;= \sum_{i=1}^m \sum_{k=1}^n \left(i^2 + k^2\right) \\
 &amp;= \sum_{i=1}^m \sum_{k=1}^n i^2 + \sum_{i=1}^m \sum_{k=1}^n k^2 \\
 &amp;= n \sum_{i=1}^m i^2 + m \sum_{k=1}^n k^2 \\
 &amp;= n \frac{m(m+1)(2m+1)}{6} + m \frac{n(n+1)(2n+1)}{6} \\
 &amp;= \frac{mn}{6} \left[(m+1)(2m+1) + (n+1)(2n+1)\right]
\end{split}
$$

As expected, $f(m,n)$ is symmetric in $m,n$, in other words, $f(m,n) = f(n,m)$...