Proofs for an equality I was working on a little problem and came up with a nice little equality which I am not sure if it is well-known (or) easy to prove (It might end up to be a very trivial one!). I am curious about other ways to prove the equality and hence I thought I would ask here to see if anybody knows any or can think of any. I shall hold off from posting my own answer for a couple of days to invite different possible solutions.

Consider the sequence of functions:
  $$
\begin{align}
g_{n+2}(x) & = g_{n}(x) - \left \lfloor \frac{g_n(x)}{g_{n+1}(x)} \right \rfloor g_{n+1}(x)
\end{align}
$$
  where $x \in [0,1]$ and $g_0(x) = 1, g_1(x) = x$. Then the claim is:
  $$x = \sum_{n=0}^{\infty} \left \lfloor \frac{g_n}{g_{n+1}} \right \rfloor g_{n+1}^2$$


I'll let you decide if it's trivial :-): 
$$
\begin{align*}
\sum_{n=0}^{\infty} \left \lfloor \frac{g_n}{g_{n+1}} \right \rfloor g_{n+1}^2
&= \sum_{n=0}^{\infty} \left( \left \lfloor \frac{g_n}{g_{n+1}} \right \rfloor g_{n+1} \right) \cdot g_{n+1}
\\&= \sum_{n=0}^{\infty} \left( g_{n} - g_{n+2} \right) \cdot g_{n+1}
\\&= \sum_{n=0}^{\infty}  \left(g_{n} g_{n+1} - g_{n+1} g_{n+2} \right)
\\&= g_0 g_1 = x,
\end{align*}
$$
by a telescopic cancelation.

Technical note: Convergence. The above manipulations are valid only after we check the convergence of the infinite series. Note that
$$
g_{n+2} = g_{n+1} \cdot \left \{ \frac{g_{n}}{g_{n+1}} \right\} ,
$$
where $\{ \cdot \}$ denotes fractional part. Hence, inductively we see that the sequence $(g_n)$ is nonnegative and monotone decreasing; therefore it converges. We claim that $g_n$ in fact converges to $0$. Towards a contradiction, assume that $\lim\limits_{n \to \infty} \ g_n > 0$. Then for large enough $n$, we have $1 < \frac{g_n}{g_{n+1}} < \frac{3}{2}$, and hence $ \left\{ \frac{g_n}{g_{n+1}} \right\} < \frac{1}{2}$. Therefore $g_{n+2}\lt \frac{g_{n+1}}{2}$, which is a contradiction to the previous sentence. :) Thus $g_n$ converges to $0$.
Finally, for any $N$, we have
$$
\left| g_0 g_1 -  \sum_{n=0}^{N}  (g_n g_{n+1} - g_{n+1} g_{n+2}) \right| = g_{N+1} g_{N+2} \to 0.
$$
That is, the series $\sum \limits_{n=0}^{\infty}  \left(g_{n} g_{n+1} - g_{n+1} g_{n+2} \right)$ converges to $g_0 g_1$ as desired. 
