Problem: Find all functions $f \colon \RR \to \RR$ such that
for all real numbers $x$ and $y$,
\[ (f(x)+xy) \cdot f(x-3y) + (f(y)+xy) \cdot f(3x-y) = (f(x+y))^2. \]

Solution: We claim that the only two functions satisfying
the requirements are $f(x) \equiv 0$ and $f(x) \equiv x^2$.
These work.

First, taking $x=y=0$ in the given yields $f(0) = 0$,
and then taking $x=0$ gives $f(y)f(-y) = f(y)^2$.
So also $f(-y)^2 = f(y)f(-y)$, from which we conclude $f$ is even.
Then taking $x = -y$ gives
\[ \forall x \in \RR : \qquad
f(x) = x^2 \qquad\text{or}\qquad f(4x) = 0 \qquad(\bigstar) \]
for all $x$.

\begin{remark*}
  Note that an example of a function satisfying $(\bigstar)$ is
  \[
    f(x)
    =
    \begin{cases}
      x^2 & \text{if } |x| < 1 \\
      1 - \cos \left( \frac{\pi}{2} \cdot x^{1337} \right)  & \text{if } 1 \le |x| < 4 \\
      0 & \text{if } |x| \ge 4.
    \end{cases}
  \]
  So, yes, we are currently in a world of trouble, still.
  (This function is even continuous; I bring this up to emphasize that
  ``continuity'' is completely unrelated to the issue at hand.)
\end{remark*}

Now we claim
\begin{claim*}
  $f(z) = 0 \iff f(2z) = 0 \qquad (\spadesuit)$.
\end{claim*}
\begin{proof}
  Let $(x,y)=(3t,t)$ in the given to get
  \[ \left( f(t)+3t^2 \right)f(8t) = f(4t)^2. \]
  Now if $f(4t) \neq 0$ (in particular, $t \neq 0$),
  then $f(8t) \neq 0$.
  Thus we have $(\spadesuit)$ in the reverse direction.

  Then $f(4t) \neq 0 \overset{(\bigstar)}{\implies} f(t) = t^2 \neq 0
  \overset{(\spadesuit)}{\implies} f(2t) \neq 0$
  implies the forwards direction,
  the last step being the reverse direction $(\spadesuit)$.
\end{proof}
%so by $(\bigstar)$ we have $f(t) = t^2$, and moreover $f(8t) \neq 0$.
%But we also have
%\[ \left( f(t/4)+\frac{3}{16}t^2 \right)f(2t) = f(t)^2 = t^4 \neq 0 \]
%and hence $f(2t) \neq 0$ as well.
%Thus we have seen that $f(4t) \neq 0 \implies f(8t), f(2t) \neq 0$
%which is logically equivalent to $(\spadesuit)$.

By putting together $(\bigstar)$ and $(\spadesuit)$ we finally get
\[ \forall x \in \RR : \qquad
f(x) = x^2 \qquad\text{or}\qquad f(x) = 0 \qquad(\heartsuit) \]

We are now ready to approach the main problem.
Assume there's an $a \neq 0$ for which $f(a) = 0$;
we show that $f \equiv 0$.

Let $b \in \RR$ be given.
Since $f$ is even, we can assume without loss of generality that $a, b > 0$.
Also, note that $f(x) \ge 0$ for all $x$ by $(\heartsuit)$.
By using $(\spadesuit)$ we can generate $c > b$
such that $f(c) = 0$ by taking $c = 2^n a$ for a large enough integer $n$.
Now, select $x, y > 0$ such that
$x-3y=b$ and $x+y=c$. That is,
\[
  (x,y) = \left( \frac{3c+b}{4}, \frac{c-b}{4} \right).
\]
Substitution into the original equation gives
\[
  0 = \left( f(x) + xy \right) f(b)
  + \left( f(y) + xy \right) f(3x-y)
  \ge \left( f(x) + xy \right) f(b).
\]
But since $f(b) \ge 0$, it follows $f(b) = 0$, as desired.