We have $(f ◦g)(x)=f(g(x))=f(x+2)=(x+2)^2+1=x^2+4x+5$,
whereas $(g◦f)(x) =
g(f(x))=g(x^2+1)=x^2+1+2=x^2+3$. Note that they are not equal
We want a one-to-one function from the set of positive integers to the set of odd positive integers. The simplest one to use is $f(n)=2n-1$ .We put the guest currently in Room $n$ into Room$(2n-1)$.Thus the guest in Room 1 stays put,the guest in Room 2 moves to Room 3,the guest in Room 3 moves to Room 5,and so on.