Find all functions $f: \mathbf{Z}_{>0} \rightarrow \mathbb{Z}_{>0}$ such that the number $x f(x)+f^{2}(y)+2 x f(y)$ is a perfect square for all positive integers $x, y$.
Let $p$ be a prime number. Then for $x=y=p$ the given condition gives us that the number $f^{2}(p)+3 p f(p)$ is a perfect square. Then, $f^{2}(p)+3 p f(p)=k^{2}$ for some positive integer $k$. Completing the square gives us that $(2 f(p)+3 p)^{2}-9 p^{2}=4 k^{2}$, or

$$
(2 f(p)+3 p-2 k)(2 f(p)+3 p+2 k)=9 p^{2} .
$$

Since $2 f(p)+3 p+3 k>3 p$, we have the following 4 cases.

$$
\begin{aligned}
& \left\{\begin{array} { l } 
{ 2 f ( p ) + 3 p + 2 k = 9 p } \\
{ 2 f ( p ) + 3 p - 2 k = p }
\end{array} \text { or } \left\{\begin{array}{l}
2 f(p)+3 p+2 k=p^{2} \\
2 f(p)+3 p-2 k=9
\end{array}\right.\right. \text { or } \\
& \left\{\begin{array} { l } 
{ 2 f ( p ) + 3 p + 2 k = 3 p ^ { 2 } } \\
{ 2 f ( p ) + 3 p - 2 k = 3 }
\end{array} \text { or } \left\{\begin{array}{l}
2 f(p)+3 p+2 k=9 p^{2} \\
2 f(p)+3 p-2 k=1
\end{array}\right.\right.
\end{aligned}
$$

Solving the systems, we have the following cases for $f(p)$.

$$
f(p)=p \text { or } f(p)=\left(\frac{p-3}{2}\right)^{2} \text { or } f(p)=\frac{3 p^{2}-6 p-3}{4} \text { or } f(p)=\left(\frac{3 p-1}{2}\right)^{2} .
$$

In all cases, we see that $f(p)$ can be arbitrary large whenever $p$ grows.
Now fix a positive integer $x$. From the given condition we have that

$$
(f(y)+x)^{2}+x f(x)-x^{2}
$$

is a perfect square. Since for $y$ being a prime, let $y=q, f(q)$ can be arbitrary large and $x f(x)-x^{2}$ is fixed, it means that $x f(x)-x^{2}$ should be zero, since the difference of $(f(q)+x+1)^{2}$ and $(f(q)+x)^{2}$ can be arbitrary large.
After all, we conclude that $x f(x)=x^{2}$, so $f(x)=x$, which clearly satisfies the given condition.