Find all $f:\mathbb{N} \to \mathbb{N}$ such that $f(n) + f\big(f(n)\big) = 6n$ for every $n\in\mathbb{N}$.

Find all functions $$f:\mathbb{N} \to \mathbb{N}$$ such that $$f(n) + f\big(f(n)\big) = 6n$$ for every $$n\in\mathbb{N}$$.

I don't know any formal way to solve this. I just tried to use some functions of the form $$f(n) =\alpha n$$ and found that $$f(n) = 2n$$ is the answer because $$2n + 2(2n) = 6n$$

I don't know how to correctly solve this type of questions and just used simple try-error method, So any help on solving this in mathematical way is appreciated.

I am not also sure about the tags I selected. It looks like a number theory problem to me that is also related to recurrence relations. Sorry if the tag is inappropriate.

Prove that $$f^{k}(n)+f^{k-1}(n)-6\,f^{k-2}(n)=0$$ for every $$n\in\mathbb{N}$$ and $$k\in\mathbb{Z}_{\geq 2}$$. Here, $$f^0:=\text{id}_\mathbb{N}$$ and $$f^k:=f\circ f^{k-1}$$ for $$k\in\mathbb{Z}_{\geq 1}$$. Use a result from recursive sequences to show that $$f^k(n)=2^k\,A(n)+(-3)^k\,B(n)$$ for some functions $$A,B:\mathbb{N}\to\mathbb{R}$$. Verify that $$B$$ is identically zero.
Anyhow, it would be a very interesting problem to find all $$f:\mathbb{Z}\to\mathbb{Z}$$ such that $$f\big(f(n)\big)+f(n)-6n=0$$ for all $$n\in\mathbb{Z}$$. There are at least two solutions $$f(n)=2n$$ for each $$n\in\mathbb{Z}$$, and $$f(n)=-3n$$ for each $$n\in\mathbb{Z}$$. We have seen so far that $$f^{k}(n)=2^k\,\left(\frac{3n+f(n)}{5}\right)+(-3)^k\,\left(\frac{2n-f(n)}{5}\right)$$ for all $$n\in\mathbb{Z}$$ and $$k\in\mathbb{Z}_{\geq 0}$$. Are there more such functions?
• How do you find your initial equality without assuming $f$ is linear? Oct 12 '19 at 22:05
• I do not apply $f$ on the whole equation (this is what I believe what you were referring to). I simply replace $n$ by, for example, $f(n)$. Oct 12 '19 at 22:06
• @Aqua Did you read the hidden box, where I gave explicitly $A(n)$ and $B(n)$ in terms of $f(n)$ and $n$? May 3 '20 at 7:20
• @Aqua If not $(-3)^k\,B(n)$ will overcome $2^k\,A(n)$ for some large $k$, making $f^k(n)$ negative. May 3 '20 at 7:36