Find $f(2012)$, when $f(2)=0$ and
$$f(x+2)=f(x)+4x+4$$ for any $x$
I tried to find $f(4), f(6), f(8),....$
\begin{align*} f(4)&=f(2)+4 \cdot 2 +4 \\ f(6)&=f(4)+4 \cdot 4 + 4 = f(2)+4 \cdot (2 + 4) + 2 \cdot 4 \\ f(8) &= f(2) + 4 \cdot (2 + 4 + 6) + 3 \cdot 4 \\ \vdots \\ f(2012) &= f(2) + 4 \cdot (2 + 4 + 6 + … + 2010) + 1005 \cdot 4 = 4 048 140 \end{align*}
And it is correct answer.
But my question is how they found $f(2012)$ as
$$f(2012)=2012^2 - 4 = 4048140 \, ?$$
How they found proper function $?$
Given, $f(x+2)=f(x)+4x+4$
$$1. \quad{f(x+2+2)=f(x+2)+4 \cdot (x+2) +4\\ 2. \quad f(x+2+4){=\color{green}{f(x+4)}+4 \cdot (x+4) +4\\=\color{green}{f(x+2)+4 \cdot (x+2)+4}+4 \cdot (x+4) +4\\=f(x+2)+4\cdot(2x+2+4)+2\cdot4}\\}$$ By observations, $${\therefore f(x+2+2n){=f(x+2)+4\cdot\left(nx+\sum_{i=1}^{n}2i\right)+n\cdot4\\ =f(x+2)+4\cdot\left(nx+2\cdot\frac{n(n+1)}{2}\right)+n\cdot4}}$$
Put, $x=0$,$$f(2+2n){ =f(2)+4\cdot n(n+1)+n\cdot4\\ =4\cdot n(n+1)+n\cdot4\quad (\because f(2)=0)\\=4n^2+8n}$$
Now, put $2+2n=m$, $$f(m){=4\cdot\left(\frac{m-2}{2}\right)^2+8\cdot\frac{m-2}{2}\\ =(m-2)^2+4m-8\\ =m^2-4}$$
Hence, $f(2012)=2012^2-4=4048140$