Why does the function $0.5x^2+0.5x$ have all integer inputs output the sum of all integers before it? I was messing around with sums in desmos and tried to see if any of these sums had other functions that were similar to them. The one I was messing with was just summing up all the positive integers through a given integer (eg. When you input $3$ you get $1+2+3$). I found that the function $0.5x^2+0.5x$, when given an integer, gave the same output as the sum. Does anybody know why this is?
edit: just looked at the Wikipedia article for triangular numbers and that answered my question.
 A: The formula $$\sum_{i=1}^n i = \frac{n(n+1)}{2}$$ is very well known. There's a slick argument to prove this: set $S_n:=\sum_{i=1}^n i$ and shuffle things around to get $$\begin{align}S_n+S_n&=(1+n)+(2+(n-1))+(3+(n-2))+\cdots((n-1)+2)+(n+1)\\&=n(n+1).\end{align}$$
A: If
$$
1+2+3+\ldots+n=S=n+n-1+n-2+\ldots+1
$$
then
$$
2S=n(n+1),
$$
say by adding in pairs
$$
(1+n)+(2+n-1)+(3+n-2)+\ldots+(n+1),
$$
with $n$ pairs and each pair summing to $n+1$.  Hence $S=n(n+1)/2$.
A: Imagine any positive integer $n$. Imagine making a $n\times(n+1)$ rectangle.
$$\begin{array}{|c|c|c|c|c|c|}
\hline
&&&&&\\
\hline
&&&&&\\
\hline
&&&&&\\
\hline
&&&&&\\
\hline
&&&&&\\
\hline
\end{array}$$
Cut it in half this way:
$$\begin{array}{|c|c|c|c|c|c|}
\hline
\cdot&\cdot&\cdot&\cdot&\cdot&\phantom{\cdot}\\
\hline
\cdot&\cdot&\cdot&\cdot&&\\
\hline
\cdot&\cdot&\cdot&&&\\
\hline
\cdot&\cdot&&&&\\
\hline
\cdot&&&&&\\
\hline
\end{array}$$
Count the dots. In this picture, there are $1+2+3+4+5$ of them.  In general, $1+2+\cdots+n$ of them. But at the same time, it's half of the area of the rectangle. That is, $\frac12n(n+1)$.
A: This is because for a natural number $n$, the sum from $1$ to $n$ is $\frac{1}{2}n^2 + \frac{1}{2}n$, proved by alex.jordan, yoyo, and Dave.
Now, for other functions that may be similar to this, you may be interested in sums of powers, that is $$\sum_{i = 1}^{n}i^{p} = 1^{p} + 2^{p} + 3^{p} + \cdots + n^{p}.$$ For example, in the case where $p = 2$, the sum is $\frac{1}{3}n^3 + \frac{1}{2}n^2 + \frac{1}{6}n$. Indeed, plugging in different values for $n$ gives the sum of numbers where each term is squared.
See Faulhaber's formula in here or here to get some information about these sums.
