The function $f(n)$ is defined for all integers $n$, such that $f(x) + f(y) = f(x + y) - 2xy - 1$ for all integers $x$ and $y$ and $f(1) = 1$ The function $f(n)$ is defined for all integers $n$, such that $f(x) + f(y) = f(x + y) - 2xy - 1$ for all integers $x$ and $y$ and $f(1) = 1$. Find $f(n)$.

I started plugging small values in and I got:
$$f(1)=1$$
$$f(2)=5$$
$$f(3)=11$$
I don't see any pattern so far, and I don't know another way to solve this question.  Solutions are greatly appreciated!
 A: Hint: Let $g(x)=f(x)-x^2$. Then $g(x)+g(y) = g(x+y)-1$ for all $x,y$, so in particular $g(x+1) = g(x)+1$.
A: if we take $x=n$ and $y=1$,
we will have
$f(n+1)=f(n)+2n+2$ or
$f(n)=f(n-1)+2(n-1)+2$
.
.
.
$f(2)=f(1)+2+2$
$f(1)=1$.
thus by sum, we get
$f(n)=1+n(n-1)+2(n-1)$
$=\color{green}{1+(n-1)(n+2)}$
we used the formula
$1+2+...m=\frac{m(m+1)}{2}$.
A: We find the first few values of $f(n)$.
Setting $x = y = 0$, we get $2f(0) = f(0) - 1$, so $f(0)= -1$.
Setting $y = 1$, we get
[f(x) + f(1) = f(x + 1) - 2x - 1,]
so $f(x + 1) = f(x) + 2x + f(1) + 1 = f(x) + 2x + 2$ for all integers $x$.
Then
\begin{align*}
f(2) &= f(1) + 2 \cdot 1 + 2, \\
f(3) &= f(2) + 2 \cdot 2 + 2 = 2 \cdot (1 + 2) + 2 \cdot 2 + f(1), \\
f(4) &= f(3) + 2 \cdot 3 + 2 = 2 \cdot (1 + 2 + 3) + 3 \cdot 2 + f(1), \\
f(5) &= f(4) + 2 \cdot 4 + 2 = 2 \cdot (1 + 2 + 3 + 4) + 4 \cdot 2 + f(1),
\end{align*}
so for any integer $n \ge 1$,
\begin{align*}
f(n) &= 2 \cdot [1 + 2 + \dots + (n - 1)] + (n - 1) \cdot 2 + f(1) \\
&= n(n - 1) + 2(n - 1) + 1 \\
&= n^2 + n - 1.
\end{align*}
Now we must find $f(n)$ when $n$ is a negative integer. Let $n$ be a positive integer. Setting $x = n$ and $y = -n$ in the given functional equation, we get
[f(n) + f(-n) = f(0) + 2n^2 - 1 = 2n^2 - 2.]
Then
\begin{align*}
f(-n) &= -f(n) + 2n^2 - 2 \\
&= -(n^2 + n - 1) + 2n^2 - 2 \\
&= n^2 - n - 1 \\
&= (-n)^2 + (-n) - 1.
\end{align*}
Therefore, $f(n) = \boxed{n^2 + n - 1}$ for all integers $n$.
