2. Determine all functions $f: \mathbb{N} \rightarrow \mathbb{N}$ such that $a^{2}+f(a) f(b)$ is divisible by $f(a)+b$ for all natural numbers $a$ and $b$.


2. Substituting $a=b=1$ gives $f(1)+1 \mid f(1)^{2}+1 \equiv 2(\bmod f(1)+1)$, so it must be that $f(1)=1$. Now for $a=1$ we have $b+1 \mid f(b)+1$. Therefore, $f(b) \equiv-1(\bmod b+1)$, and thus $f(b) \geqslant b$.

On the other hand, for $b=f(a)$ the original relation gives $2 f(a) \mid a^{2}+f(a) f(f(a))$, from which $f(a) \mid a^{2}$. However, we have $\frac{a^{2}}{f(a)} \equiv \frac{1}{-1}=-1(\bmod a+1)$, so $\frac{a^{2}}{f(a)} \geqslant a$. Since $f(a) \geqslant a$, the only possibility is that $f(a)=a$.