# If $f(n) + (n+1)^2 = f(n+1)$ then what is $f\phantom{|}$?

Suppose that $$f(n) + (n+1)^2 = f(n+1),$$

1. How could I find the original (or family of) function(s) that satisfies this property?
2. What is the branch of mathematics that deals with equations like this?
-
You're trying to solve a functional equation. – J. M. Aug 1 '11 at 7:23
Assuming you meant $f(n)$ rather than $f(x)$ in your equation, then this is simply a case of a linear recurrence relation (with constant coefficients!), or definition by recursion. There is a branch of mathematics called recursive function theory but it is almost surely not what you're interested in. I suspect you want to know about solutions to more complicated functional equations like $f(f(x)) = x$, but I don't think this is a well-understood topic in mathematics yet. – Zhen Lin Aug 1 '11 at 7:26
With the edit: you now have a difference equation, or as Henry says, a recurrence/recursion relation. – J. M. Aug 1 '11 at 7:47
1. You're looking for an antidifference of a hypergeometric, so Gosper's algorithm will give you the solution. – Peter Taylor Aug 1 '11 at 11:01

That is a recurrence relation. There will be a family of solutions, depending on the starting point. For example, starting with $f(0)=0$, it will simply be the sum of squares, which is $f(n)=n(n+1)(2n+1)/6$. If you started from $f(0)=1$ it would be $(n+2)(2n^2-n+3)/6$.

There are various ways of solving it. One is spot that since the first difference $f(n+1)-f(n) = n^2+2n+1$ is a quadratic polynomial, $f(n)$ will be a cubic polynomial, so you can use the early values to find the coefficients.

Another would be to use generating functions, for example described in generatingfunctionology.

And there are more, such as methods associated with functional equations.

-
+1: Of course the general solution for arbitrary $f(0)=c$ is not too difficult. – Simon Aug 1 '11 at 8:34

Let $x=n+1$ ,

Then $f(x)=f(x-1)+x^2$

In fact this belongs to a functional equation of the form http://eqworld.ipmnet.ru/en/solutions/fe/fe1108.pdf.

The general solution of this functional equation is $f(x)=\Theta(x)+f_p(x)$ , where $\Theta(x)$ is an arbitrary periodic function with unit period

Luckily we can find $f_p(x)$ by method of undetermined coefficients:

Let $f_p(x)=Ax^3+Bx^2+Cx$ ,

Then $f_p(x-1)=A(x-1)^3+B(x-1)^2+C(x-1)=Ax^3-3Ax^2+3Ax-A+Bx^2-2Bx+B+Cx-C=Ax^3+(B-3A)x^2+(3A-2B+C)x-A+B-C$

$\therefore Ax^3+Bx^2+Cx-(Ax^3+(B-3A)x^2+(3A-2B+C)x-A+B-C)\equiv x^2$

$3Ax^2+(2B-3A)x+A-B+C\equiv x^2$

$\therefore\begin{cases}3A=1\\2B-3A=0\\A-B+C=0\end{cases}$

$\begin{cases}A=\dfrac{1}{3}\\B=\dfrac{1}{2}\\C=\dfrac{1}{6}\end{cases}$

$\therefore f(x)=\Theta(x)+\dfrac{x^3}{3}+\dfrac{x^2}{2}+\dfrac{x}{6}=\Theta(x)+\dfrac{2x^3+3x^2+x}{6}=\Theta(x)+\dfrac{x(x+1)(2x+1)}{6}$ , where $\Theta(x)$ is an arbitrary periodic function with unit period

$f(n)=\Theta(n)+\dfrac{n(n+1)(2n+1)}{6}$ , where $\Theta(n)$ is an arbitrary periodic function with unit period

-