Find the function $f(x)$ if $f(x+2)=f(x+1)+2f(x)$ for all $x\in \mathbb{Z}^{+}$

188 Views Asked by At

Here is my problem:

If $x\in \mathbb{Z}^{+}$ and $f(x+2)=f(x+1)+2f(x)$ find the function $f(x)$

where, $f(1)=4, f(2)=2.$

When I encounter this problem, I thought the question is wrong. I obviously, I would expect a question like this, for example: $f(5)+f(17)=?$

Anyway, I did something like this:

$f(3)=f(2)+2f(1)$

$f(4)=f(3)+2f(2)=f(2)+2f(1)+2f(2)=3f(2)+2f(1)$

$f(5)=f(4)+2f(3)=3f(2)+2f(1)+2f(2)+4f(1)=5f(2)+6f(1)$

$f(6)=f(5)+2f(4)=5f(2)+6f(1)+6f(2)+4f(1)=11f(2)+10f(1)$

$f(7)=f(6)+2f(5)=11f(2)+10f(1)+10f(2)+12f(1)=21f(2)+22f(1)$

$f(8)=f(7)+2f(6)=21f(2)+22f(1)+22f(2)+20f(1)=43f(2)+42f(1)$

$A_{f(2)} :=\left\{ 1,3,5,11,21,43 ... \right\}$

$B_{f(1)} :=\left\{ 2,2,6,10,22,42 ... \right\}$

Here, $A_{f(2)}$ and $B_{f(1)}$ are coefficients.

$A_{f_1(2)}=2^1-1; A_{f_2(2)}=2^2-2+1; A_{f_3(2)}=2^3-2^2+2-1;...; A_{f_n(2)}=2^n-2^{n-1}+2^{n-2}-2^{n-3}+2^{n-4}-2^{n-5}+...-...+ (-1)^n \Longrightarrow A_{f_n(1)}=\frac {2^{n+1}-2(-1)^{n+2}}{3}=\frac {2^{n+1}+2(-1)^{n+3}}{3}$

$B_{f_1(1)}=2^1; B_{f_2(1)}=2^2-2; B_{f_3(1)}=2^3-2^2+2;...;B_{f_n(1)}=2^n-2^{n-1}+2^{n-2}-2^{n-3}+2^{n-4}-2^{n-5}+...-...+2 (-1)^{n+1} \Longrightarrow B_{f_n(2)}=\frac{2^{n+1}-(-1)^{n+1}}{3}=\frac{2^{n+1}+(-1)^{n+2}}{3}$

$f(n+2)=2A_{f_n(1)}+4B_{f_n(2)}=\frac {2^{n+1}+2(-1)^{n+3}}{3} ×2+ \frac{2^{n+1}+(-1)^{n+2}}{3} ×2^2=2^{n+2}-2(-1)^{n+2} \iff f(x)=2^x-2(-1)^x$

Finally, I got an answer like this:

$$f(x)=2^x+2(-1)^{x+1} , x\in \mathbb Z^{+}$$

Honestly, I don't know. Maybe, this is a ridiculous way. Because, it might be an intelligent way for to do it. And You know what I will actually asking. Is my solution correct? Or,was there an intelligent way to do it?

Thank you!

3

There are 3 best solutions below

0
On

Your solution is correct. The usual way is to assume the solution is of the form $a^x$ and plug it in to get the characteristic equation, which for you is $$a^2=a+2\\(a-2)(a+1)=0$$ The solution is then $b2^x+c(-1)^x$ and you evaluate $b,c$ from your initial conditions. A longer discussion is in Wikipedia or many texts.

0
On

Write $a_n = f(n)$ for $n\in\mathbb{N}$, then we have $$a_{n+2}=a_{n+1}+2a_n$$

Writing characteristic equation for this sequence we get

$$ x^2-x-2 =0\implies x_1=2\;\; {\rm and}\;\; x_2=-1 $$

So a general solution is $$ a_n = a2^n+b(-1)^n$$ Since $a_1=4$ and $a_2 = 2$ we get $a=1$ and $b=-2$, so $a_n = 2^n-2(-1)^n$.

3
On

Since $x\in \mathbb Z^{+}$, it is a second order linear difference equation. You can write it as: $$y_{n+2}=y_{n+1}+2y_n, y_1=4,y_2=2, \ \ \ \text{find} \ \ y_n.$$

Use the method of generating functions.

Consider $f(x)=\sum_{n\ge 1}y_nx^n$. Multiply the given equation by $x^{n+2}$ and sum them: $$\sum_{n\ge 1} y_{n+2}x^{n+2}=\sum_{n\ge 1}y_{n+1}x^{n+2}+\sum_{n\ge 1}2y_nx^{n+2} \Rightarrow \\ f(x)-y_2x^2-y_1x=x(f(x)-y_1x)+2x^2f(x) \Rightarrow \\ f(x)=\frac{4x-2x^2}{1-x-2x^2}=\frac{1}{1-2x}-\frac{2}{1+x}+1.$$ Now we need to find $y_n$ (the coefficients of the expansion of $f(x)$): $$\begin{align}[x^n]f(x)&=[x^n](1-2x)^{-1}-2[x^n](1+x)^{-1}+0 =\\ &=[x^n]{-1\choose n}(-2x)^n-[x^n]2{-1\choose n}x^n=\\ &=[x^n]{1+n-1\choose n}(-1)^n(-2x)^n-[x^n]2{1+n-1\choose n}(-1)^nx^n=\\ &=[x^n]2^nx^n-[x^n]2\cdot (-1)^nx^n=2^n-2\cdot(-1)^n,\end{align}$$ where ${-n\choose r}={n+r-1\choose r}(-1)^r$. Hence: $$y_n=2^n-2\cdot (-1)^n.$$ or: $$f(x)=2^x-2\cdot (-1)^x, x\in \mathbb Z^+.$$