Find all functions such that $f(x^2+y^2f(x))=xf(y)^2-f(x)^2$ I am dealing with the test of the OBM (Brasilian Math Olympiad), University level, 2016, phase 2.
I hope someone can help me to discuss this test. Thanks for any help.
The question 2 says:

Find all functions $f:\mathbb{R}\rightarrow \mathbb{R}$ such that 
$f(x^2+y^2f(x))=xf(y)^2-f(x)^2$
for all $x,y\in\mathbb{R}$.

My attempt:
Note that $f(0)\in\{0,-1\}$. In fact, by taking $x=y=0$, we have $f(0)=-f(0)^2$.
Case 1 $f(0)=0$
By taking $y=0$, we have 
$f(x^2)=-f(x)^2\forall x\in\mathbb{R}$
Particularly, $f(1)=-f(1)^2$, so $f(1)\in\{0,-1\}$.
(a) f(1)=0
By taking $x=1$, we have $f(1)=f(y)^2\forall y\in\mathbb{R}$.
So, $f\equiv 0$. Is trivial that it respects the statement.
(b) f(1)=-1
By taking $x=1$, we have $f(1-y^2)=f(y)^2-1=-f(y^2)-1\forall y\in\mathbb{R}$. So, to $t\leq 0$, we have $f(1-x)=-f(x)-1$.
By taking $y=1$, we have $f(x^2+f(x))=x-f(x)^2=x+f(x^2) \forall x\in\mathbb{R}$. 
I could not finish this subcase
Case 2 $f(0)=-1$
By taking $x=0$,
$f(-y^2)=-1\forall y\in\mathbb{R}$
So, $f(t)=-1\forall t\leq0$.
By taking $y=0$,
$f(x^2)=-x-f(x)^2 \forall x\in\mathbb{R}$
So, $f(t)=-\sqrt{t}-1\forall t\geq0$.
But this function does not is correct. For instance, to $x=y=1$, $f(x^2+y^2f(x))=f(1+1(-2))=f(-1)=-1$, but $xf(y)^2-f(x)^2=1(-2)^2-(-2)=6\not=-1$.
 A: My solution builds on Patrick Stevens's answer. For now on, I'm considering the case where $f$ isn't zero everywhere, and I'll prove that $f(x)=-x$ everywhere.
We already have $f(x+1)=f(x)-1$ for $x\ge 0$. But this is true for all $x$, here's why. Let $t \ge 0$ and set $x=1$ and $y=\sqrt{t}$ in the original identity, using $f(x^2)=-f(x)^2$. We get $f(1-t)=-1-f(t)$. Substitute $t=1-s$ to get $f(s)=-1-f(1-s)$ for $s \le 1$. Therefore, $f(x)+f(1-x)=-1$ for all $x$. Using sign-reversal and induction, we find $$ f(x+n)=f(x)-n $$ for all real $x$ and integer $n$.
Let $n$ be an integer and $t \ge 0$ be a real. Set $x=-n$ and $y=\sqrt{t}$ to get $f(n^2 + t f(n))=f(n^2) - n f(t)$, which leads to $f(-tn)-n^2=-n^2 - n f(t)$, then $f(n t) = n f(t)$. Using sign-reversal, this is also true when $t$ is negative, so (replacing $t$ with $x$) $$ f(n x) = n f(x) $$ for all real $x$ and integer $n$.
Replace $x$ with $x/n$ to find $ f(x/n) = n f(x/n)/n = f(nx/n)/n = f(x)/n $. Let $a$ be an integer and $b$ be a positive integer. Then $f((a/b)x) = f(a(x/b)) = a f(x/b) = a f(x) / b = (a/b)f(x)$ and $f(x + a/b) = f((bx + a)/b) =  f(bx + a)/b = (f(bx) - a)/b = f(bx)/b - a/b = f(x) - a/b$. So $$\begin{align} f(x+q) &= f(x)-q \\ f(qx) &= q f(x) \end{align}$$ for all real $x$ and rational $q$.
$f(q)=-q$ for all rational $q$. Now let's show that it's true for irrational values.
We already know that $f$ if negative over positive values, and vice versa. Let $x$ be any irrational number, and let $q < x$ be some rational number. Then $f(x-q)=f(x)+q$. Since $x-q$ is positive, $f(x-q)$ is negative, and so $f(x)<-q$. We can choose $q$ to be as close as we want, so $f(x) \le -x$. Doing the same from the other side shows $f(x) \ge -x$.
A: Partial progress, but not a complete answer, I'm afraid.
$$f(x^2+y^2f(x)) = xf(y)^2-f(x)^2$$
$f$ has a root
Let $y=x$; then $f(x^2(1+f(x)) = (x-1)f(x)^2$. In particular, letting $x=1$ we obtain $f(1+f(1)) = 0$, so $f$ does have a root.
$f$ is $0$ or has exactly the root $0$
Suppose $f(x) = 0$. Then $f(x^2) = x f(y)^2$ for all $y$, and so either $x = 0$ or $f(y)^2$ is constant as $y$ varies.
Suppose $f(x) = 0$ but $x \not = 0$. Then $f(y)^2$ is constant as $y$ varies; but substituting $y = x$ we obtain that $f(y)^2 = 0$ and hence $f$ is the constant $0$.
So the only possible nonzero case is that $f$ has exactly one root, and it is the root $x = 0$.
$f$ is very nearly symmetric
Substitute $y \to -y$ to obtain the following:
$$x f(y)^2-f(x)^2 = f(x^2+y^2f(x)) = x f(-y)^2-f(x)^2$$
from which $$x f(y)^2 = x f(-y)^2$$ for all $x$ and $y$; in particular, $$f(y) = \pm f(-y)$$ for all $y$.
$f$ is odd or $0$
Suppose $f(x) = f(-x)$. Then $$x f(y) - f(x)^2 = f(x^2 + y^2 f(x)) = -x f(y) - f(-x)^2 = -x f(y) - f(x)^2$$
and so $-x f(y) = x f(y)$ for all $y$; so (since wlog $f$ is not the constant zero function) $-x = x$ and hence $x=0$.
So if $f(x) = f(-x)$ then $x = 0$; hence $f(-x) = -f(x)$ for all $x$.
$f$ is sign-reversing or $0$
Note also that since $f(x^2) = -f(x)^2$ (by letting $y=0$), for every $x > 0$ we have $f(x) < 0$.
$f(n) = -n$ or $f=0$
Substituting $x=-1$ gives $f(1+y^2) = -f(y)^2-1$
and in particular $$f(x^2+1) = f(x^2)-1$$
Therefore $f(x+1) = f(x)-1$ whenever $x>0$.
This fixes the value of $f$ on the natural numbers: we have $f(n) = -n$.

We already know that the root occurs at $x=1+f(1)$, so $f(1) = -1$ (as you noted). Moreover, by letting $x=y$ and supposing $f(x)=-1$, we get $f(0) = x-1$ at any such $x$, and so $x=1$ is the only time $f$ hits $-1$.
A: Consider first the case $x = 0$. The equation reduces to:
$$f(y^{2}f(0)) = -f(0)^2$$
The right hand side is independent of $y$, leaving two possibilities: (a) $f$ is constant; (b) $f(0)=0$.
If we examine case (a), it follows that the constant is either $0$ or $-1$. Substitution into the general equation shows that only $f = 0$ is possible. 
Case (b). Assume $f(0)=0$. Consider what happens when we take $y = 0$. The equation becomes:
$$f(x^2) = -f(x)^2$$
This has solutions of the type $f(x) = -x^N$ and $f(x) = -abs(x)^N$. In both cases we must have $N > 0$ to satisfy the condition $f(0)=0$. Now substitute both solutions into the general case, where both $x$ and $y$ are variables. It becomes quickly clear that only the first solution works and only for $N = 1$. 
In conclusion there appear to be two solutions to the problem, namely:
$$f(x) = 0$$ and $$f(x) = -x$$ 
A: If $f(a)=0$ for some $a\ne0$, then 
$$\tag{$a,y$}f(a^2)=af(y)^2 $$
for all $y$, making $|f|$ constant and hence $f\equiv 0$.
Assume $f(b)=f(-b)=c$ for some $b\ne0$. Then 
$$\tag{$b,y$}f(b^2+y^2c)=bf(y)^2-c^2$$
together with 
$$\tag{$-b,y$}f(b^2+y^2c)=-bf(y)^2-c^2$$
leads to $f\equiv 0$.
In order to look for other solutions than the zero function, we may thus
assume
$$\tag1\forall x\ne0\colon f(x)\ne 0,$$
$$\tag2\forall x\ne0\colon f(x)\ne f(-x).$$
From $$\tag{$1,1$}f(1+f(1))=f(1)^2-f(1)^2=0$$
and $(1)$, we conclude $f(0)=0$ and $f(1)=-1$.
By combining
$$\tag{$1,y$}f(1+y^2)=f(y)^2-1$$
$$\tag{$1,-y$}f(1+y^2)=f(-y)^2-1,$$
we see that $f^2$ is even, hence by $(2)$, $f$ is odd. In particular $f(-1)=1$.
Then
$$\tag{$1,-1$}f(1+1)=1-1=0$$
contradicts $(1)$.
Conclusion: The only solution is $f\equiv 0$.
