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

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

I think the answer is $$f(n)=n$$,We prove this by induction. (at last step I can't induction it

It is true for $$n=1$$ because Let $$f(1)=x\ge 1,$$and let $$n=1$$,we have $$f(x)+x=2\Longrightarrow x=1$$

(2) Suppose it is true for $$f(n)=n(n\le k)$$,

then for $$n=k+1$$,let $$f(n+1)=y$$,so we have $$f(y)+y=2(k+1)\Longrightarrow f(y)=2(k+1)-y$$ it is easy to have $$k+1\le y\le 2k+1$$,and $$f(f(y))+f(y)=2y\Longrightarrow f(2k+2-y)=2y-f(y)=3y-2(k+1)$$ since $$2k+2-y\in [1,k+1]$$,then I can't it ,can you help? Thanks (if $$2k+2-y\in [1,k]$$,I have done it! bacuase $$f(2k+2-y)=2k+2-y$$,so $$y=k+1$$)

At first, we will show that $$f$$ is injective. Suppose, for some $$m,n$$ $$f(m)=f(n)\implies f(f(m))=f(f(n))$$ therefore, by the given condition we have, $$m=n$$ Now, we claim, $$f(n+1)\ge n+1$$ Otherwise, suppose $$f(n+1)=n+1-k (1\ge k\le n)=f(n+1-k)$$ (by induction) Therefore, $$n+1=n+1-k$$ (as $$f$$ is injective) So, a contradiction arise. Hence, $$f(n+1)\ge n+1$$ In a similar way we can show that $$f(f(n+1)\ge n+1$$ Hence, $$2(n+1)=f(n+1)+f(f(n+1))\ge 2(n+1)$$ Therefore, we must have, $$f(n+1)=n+1$$ and hence we are done!

Note that $$f(f(n)) = 2n-f(n) \ge 1$$ so we have $$1 \le f(n) \le 2n-1$$. Hence we must have $$f(1) = 1$$.

It is straightforward to check that $$f$$ is injective.

Suppose $$f(k) = k$$ for $$k=1,...,n$$. Note that we must have $$f(n+1) \ge n+1$$ since $$f$$ is injective. Similarly, we must have $$f(f(n+1)) \ge n+1$$, and since $$f(f(n+1))+f(n+1) = 2(n+1)$$, we must have $$f(n+1) = n+1$$.

Induction is definitely useful to show that $$f(n)=n$$ is the only solution. First note that $$f$$ has to be injective, for if $$f(n)=f(m)$$, the functional equation would imply $$2n=2m$$ and hence $$n=m$$.

Now we prove by induction the statement that for all $$n\leq k,\, f(n)=n$$. You've done the base case. $$f(1)$$ has to be $$1$$. Now suppose that $$f(n)=n$$ for all $$n\leq k-1$$. Then by injectivity, $$f(k)\geq k$$. This implies $$f(f(k))\geq k$$ as well, because if $$f(f(k))=u, then we also know $$f(u)=u$$, so injectivity would imply that $$f(k)=u$$, a contradiction since $$u.

Since $$f(f(k))+f(k)=2k$$ and both summands are $$\geq k$$, they must both be exactly $$k$$, and the induction step is completed.

Alternatively, let $$a_k(n):=f^{\circ k}(n)$$ for $$k\in\mathbb{Z}_{\geq 0}$$ and $$n\in\mathbb{Z}_{>0}$$. Here, $$f^{\circ 0}(n):=n$$ and $$f^{\circ k}(n):=f\big(f^{\circ(k-1)}(n)\big)$$ for $$k=1,2,3,\ldots$$. Thus, for a fixed $$n\in\mathbb{Z}_{>0}$$, we have $$a_{k+2}(n)+a_{k+1}(n)-2\,a_k(n)=0$$ for every $$k=0,1,2,\ldots$$, with initial values $$a_0(n)=n$$ and $$a_1(n)=f(n)$$. This is a simple recursive relation, and the solution is given by $$a_k(n)=(-2)^k\left(\frac{n-f(n)}{3}\right)+\left(\frac{2n+f(n)}{3}\right)$$ for all $$k\in\mathbb{Z}_{>0}$$. Since we have $$a_k(n)\in\mathbb{Z}_{>0}$$ for all $$k\in\mathbb{Z}_{\geq 0}$$, it must hold that the coefficient of $$(-2)^k$$ is $$0$$; that is, $$f(n)=n\text{ for each }n\in\mathbb{Z}_{>0}\,.$$