I am working on the following question:
Let us say we have $n$ consecutive numbers labelled $x_1$ to $x_n$. I want to find the average of these. The quickest way to do this seems to be $$AVERAGE=\frac{x_1 + x_n}{2}\tag1$$
The other way to do this is $$AVERAGE=\frac{x_1+x_2+x_3...+x_n}{n}\tag2$$
I stumbled upon equation (1) without any proof of it, but simply started using it as it seems to work, and later I proved equation (1) by converting the problem into one of coordinate geometry. I want to know if this shortcut (i.e. equation 1) is legitimate, since I am not absolutely sure about my proof.
Let's say the consecutive numbers start with $a$, so that $$x_1=a,\quad x_2=a+1,\quad\ldots,\quad x_n=a+(n-1)$$ Then $$\begin{align*} x_1+x_2+\cdots+x_n&=a+(a+1)+\cdots+(a+(n-1))\\ &=(\underbrace{a+a+\cdots+a}_{n\text{ times}})+\bigg[1+2+\cdots+(n-1)\bigg]\\\\\\\\ &=na+\frac{n(n-1)}{2} \end{align*}$$ (where we have used the standard formula for the sum of the first $k$ integers) so that $$\frac{x_1+x_2+\cdots+x_n}{n}=a+\frac{n-1}{2}=\frac{2a+(n-1)}{2}=\frac{a+(a+(n-1))}{2}=\frac{x_1+x_n}{2}$$