# Applied Calculus Homework Question

The function $f(x) = 1-f(x-1)$, for positive interger, $x$. If $f(2) = 12$, compute $f(2012)$

-

## 3 Answers

$f(x)=1-f(x-1)=1-(1-f(x-2))=f(x-2)=...=f(2)$ is $x$ is even

So, $f(2012)=f(2)=12$

If x is odd, $f(x)$ will reduce to $f(1)=1-f(2)=1-12=-11$

-
So, the answer to f(2) and f(2012) are both 12? And any even number is also 12? – Ctrl Sep 9 '12 at 17:48
Yes, to me that is the case. – lab bhattacharjee Sep 10 '12 at 4:59

Since $x$ is an integer, I will replace it with $k$. Also, instead of $f (x)$ I will use $x_k$. Hence, the rephrased problem is the following:

Problem: for nonnegative $k$ we have that $x_{k+1} = 1 - x_k$. If $x_2 = 12$, compute $x_{2012}$.

Consider the discrete-time dynamical system

$$x_{k+1} = a x_k + b$$

where $a, b \in \mathbb{R}$. It is easy to show that for all $k \geq 0$ we have that

$$x_k = a^k x_0 + \displaystyle\sum_{i=0}^{k-1} a^i b = a^k x_0 + \displaystyle \left(\frac{1 - a^k}{1 - a}\right) b$$

Let's make $a = -1$ and $b = 1$. We then have that the general solution of $x_{k+1} = 1- x_k$ is

$$x_k = (-1)^k x_0 + \displaystyle \left(\frac{1 - (-1)^k}{2}\right)$$

If $x_2 = 12$, then $x_0 = 12$ as well. Note that $x_{2012} = (-1)^{2012} x_0 = x_0 = 12$. I do concede that this approach is total overkill, but next time you see something of the form $x_{k+1} = a x_k + b$, you know what to do.

-
Nice one! ${}{}$ – Pedro Tamaroff Sep 8 '12 at 17:33

Hint $\$ Iterating a function $\rm\:g\:$ of period $\rm\,n\:$ produces a sequence of period $\rm\,n$

$$\rm g^n = Id,\,\ f(k\!+\!1) = g\,f(k)\ \Rightarrow\ f(k\!+\!n) = g^n f(k) = f(k)\ \Rightarrow\ f(k\!+\!jn) = f(k)$$

Yours is the special case $\rm\:n=2,\:$ since $\rm\:f(k\!+\!1) = 1-f(k) = g\,f(k),\:$ for $\rm\:g(x) = 1\!-\!x,\:$ where $\rm\:g^2(x) = g(g(x)) = g(1\!-\!x) = 1\!-\!(1\!-\!x) = x,\$ so $\rm\:g^2(x) = x,\:$ i.e. $\rm\ g^2 = Id.$

-