Functions $f: \mathbb{Z}^{+}\to \mathbb{R}$ satisfying $x f(y) + y f(x) = (x+y) f(x^2+y^2)$ Let $\mathbb{Z}^{+}=\{1, 2, 3, ...\}$ denote the set of positive integers.
Problem 1. Are there any non-constant functions $f\colon \mathbb{Z}^{+}\to\mathbb{R}$ such that
$$
x f(y) + y f(x) = (x+y) f(x^2+y^2)
$$
for all $x, y\in\mathbb{Z}^{+}$?
Clearly, the constant functions satisfy the functional equation above, and so it is natural to see if there are any non-constant examples. The motivation for this problem comes from a related (and easier problem) from Canadian Mathematical Olympiad (Year 2002):
Problem 2. Find all functions $f\colon \mathbb{Z}^{+}\to\mathbb{Z}^{+}$ such that
$$
x f(y) + y f(x) = (x+y) f(x^2+y^2)
$$
for all $x, y\in\mathbb{Z}^{+}$.
This second problem has a nice solution. I don't want to spoil it for others, so if you want to read it, you can hover over the following solution (I divided it into steps, in case you want to have hints one step at a time):

 Solution to Problem 2.   We claim that only the constant functions $f:\mathbb{Z}^{+}\to\mathbb{Z}^{+}$ satisfy the functional equation above.


 Assume, to the contrary, there is a non-constant function $f$ with this property. Thus, there exist positive integers $a$ and $b$ such that $f(a)<f(b)$. Then using the functional equation, one gets:


 $$ (a+b) f(a) < (a+b) f(a^2+b^2) < (a+b) f(b)$$


 So, $f(a) < f(a^2+b^2) < f(b)$. We have shown that between any two distinct points in the image of $f$, there is a third point in between. And this process can be repeated forever. However, this is a contradiction since the target of $f$ is the natural numbers $\mathbb{Z}^{+}$. As you can see, this solution does not work when the target is $\mathbb{R}$, hence the reason for asking this question.


 A: We show that for any $N \ge 15$, there are $a,b,c \le N$ such that $N+1 = \sqrt{a^2+b^2-c^2}$. By Ewan Delanoy's answer, this suffices. For $N \equiv 0,1,2 \pmod{3}$, we can take $(a,b,c) = (N-1,\frac{N+9}{3},\frac{N-9}{3}),(N, \frac{N+5}{3}, \frac{N-4}{3}), (N-2, \frac{N+13}{3}, \frac{N-14}{3})$, respectively.
A: This is really just harvesting on the work and ideas of @Evan_Delanoy and @mathworker to whom the credit goes. But here is a more 'compact' finishing argument. We have the identities for all $N$:
$$ (2N+2)^2-(2N-2)^2 = (N+4)^2 - (N-4)^2$$
$$ (2N+1)^2 - (2N-1)^2 = (N+2)^2 - (N-2)^2 $$
Without repeating the previous arguments, these two identities ensure that as soon as we know that $\{1,...,10\}\in A$ then $A={\Bbb N}$.
A: Moving forward with the solution idea by @Evan Delanoy, I will provide an algorithm which could lead to any number in $\mathbb{N}$ being in the set $A$.
Suppose the required number is $x$.
Algorithm:
A = {1..20}  
while x is not in A:
    S = A
    for each pair (a, b) in A x A:
        S = S U {a^2 + b^2}
    for each triple (a, b, c) in A x A x A:
        if a^2 + b^2 - c^2 = d^2 where d is a positive integer:
            S = S U {d}
    A = S

We now show that this terminates.
Suppose that after the $i^\mathrm{th}$ iteration, all positive integers not exceeding $n$ are in the set $A$. We proceed to use the next few iterations to force all numbers less than or equal to $3n/2$ to lie in $A$.
The first loop gives us all positive integers less not exceeding $n^2$ which can be represented as the sum of 2 positive squares. To characterize these, let $W$ be the integers not exceeding $n^2$ in whose prime factorization, the exponent of any prime which is 3 mod 4 is even, (call such primes bad primes). Then the complement of the required set wrt $W$ is the set of numbers not exceeding $n^2$ which are perfect squares but can not be represented as a sum of 2 positive squares. For this to hold true, their square root, say $r$, is not a part of a Pythagorean triplet which is composed entirely of positive integers. We claim that a necessary and sufficient condition for such $r$ is to not have any prime factor congruent to 1 mod 4, which can be seen by applying theorem 4.4 here.
Now we try to construct numbers between $n$ and $3n/2$ in which the powers of bad primes are allowed to be odd, as well as those which are perfect squares of numbers divisible only by 2 and/or bad primes.
We give a proof using induction.
Firstly consider the case of the number not being a power of $2$.
Suppose the number is $x$, and $x = vp$, where $p$ is the product of all the bad primes which divide $x$ and have an odd exponent in the prime factorization, and $v$ is divisible by at least one prime congruent to 1 mod 4. Then $v^2p^2 + v^2 = (p^2 + 1)(a^2 + b^2) = (pb - a)^2 + (a + pb)^2$ (where $(a, b)$ satisfies $a < b$, $a^2 + b^2 = v$) implies that $vp$ is in $S$, since $v, pb - a, pa + b$ are all less than $vp$.
Now suppose the number is divisible by no prime which is 1 mod 4. This part still needs work. Note that using the proof for the two cases below, we can exhaust the cases where x is $(\mathrm{product \,of \,bad \,primes})^2 2^\alpha$ and $\alpha > 2$.
Now suppose that the number (say $x$) is a power of $2$. If the exponent of $2$ in it is odd, then we are done by using a trivial split into equal parts. So assume that $x = 2^{2k}$. Then we have $x^2 + 2^2 = 2^2(4^{2k-1} + 1)$. Now for the second factor on the right, we know that it is a sum of two squares (namely $1$ and $4^{2k-1}$), and since $5$ divides the whole thing, and $5 \equiv 1 \pmod 4$, $(4^{2k-1} + 1)/5$ should admit a sum of squares representation with 2 positive squares (else it is a power of 2 multiplied by, possibly 0, bad primes, however since -1 is a quadratic nonresidue modulo these primes, it needs to be a power of 2, which is impossible by parity reasons if the power of 2 is > 1 and size reasons if it is 1). So we have for some positive integers $a < b$, $4^{2k} + 4 = 20(a^2 + b^2) = (4b - 2a)^2 + (4a + 2b)^2$. For showing that both $j = 4b - 2a$, $k = 4a + 2b$ do not exceed $2^{2k}$, we can do the following. Suppose one of them (wlog $j$) did exceed $2^{2k}$. Then since $j \ge 2^{2k} + 1$, $j^2 \ge 4^{2k} + 2 \cdot 2^{2k} + 1 > 4^{2k} + 4$, which is a contradiction. So since by the end of the this iteration, we would have $4b - 2a$ and $4a + 2b$ both in our set $A$, the next iteration would allow us to include $2^{2k}$ in our set as well, which completes the proof.
Note: this is still not complete.
A: Let $I=[a,a+\varepsilon]$ be an arbitrary small interval with $a>1,\varepsilon>0$. Assume that on this interval the function $f(x)$ is
concave.Furthermore we assume that $f(x)$ is  continuous and have a bounded first derivative ( Lipschitz continuous) on $(1,\infty)$.
Then for $x,y\in I$ with $x\neq y$ we have :
$$(x+y)f(x^2+y^2)=xf(y)+f(x)y\leq (x+y)f\Big(\frac{2xy}{x+y}\Big)$$
As the equality case is for $x=y$ we have :


There exists a variable $\alpha$ such that :
$$ (x+y)f\Big(\frac{2xy}{x+y}\Big)-(xf(y)+f(x)y)\leq \alpha\quad (1)$$
With $\alpha \to 0$ when $\varepsilon \to 0$


As the function $f(x)$ have a bounded first derivative and by the MVT on $(1,\infty)$ :
$$(x+y)|(f(x^2+y^2)-f\Big(\frac{2xy}{x+y}\Big))|=|f'(c)|(x+y)\Big(x^2+y^2-\frac{2xy}{x+y}\Big)$$
But by equality's OP and Jensen's inequality $\forall x,y\in I\quad f(x^2+y^2)\neq f\Big(\frac{2xy}{x+y}\Big)$
And it's not hard to show that :
$$\forall x,y\in I \quad x^2+y^2>\frac{2xy}{x+y}$$
So $|f'(c)|\to k>0$ when $x\to y$
So when $x\to y$ we have :
$$C'>(x+y)|(f(x^2+y^2)-f\Big(\frac{2xy}{x+y}\Big))|>C>0\quad (2)$$
Where $C,C'$  are constant .
So we have with $(1)$ a non-bounded inequality and with $(2)$ a bounded inequality so as :
$$(x+y)f(x^2+y^2)=xf(y)+f(x)y$$
We get clearly a contradiction . The same job can be done with $f(x)$ but now assuming that it is convex .
So we deduce that the function is not concave or convex on $I$ so $f(x)$ doesn't exists as it's continuous and even Lipschitz continuous on $(1,\infty)$.This reasoning works on an infinitely of interval $I$. The only possiblity is $x=y$ on $I$ and it's easier to solve than the initial problem.
Hope it helps !!!
