Let $R$ and $R'$ be two rings and $f: R\to R'$ be a map satisfying the conditions:
$f(1) = 1$.
For all $x,y \in R$, $f(x+y) = f(x) + f(y)$.
For all $x,y \in R$, either $f(xy) = f(x)f(y)$ or $f(xy) = f(y)f(x)$.
Prove that $f$ is either a homomorphism or an anti-homomorphism.
Where $f$ is called an anti-homomorphism if the first two conditions above are satisfied and for all $x,y$, $f(xy) = f(y)f(x)$.
Any hints?
Reference: This is exercise $9$, page $114$ in Jacobson's Basic Algebra $1$. The author writes (Hua.) at the start of the exercise - so apparently this result is due to Hua Luogeng?
A possible idea would be to use distributivity to transform the argument of $f$ and compute it two ways. This rather greatly limits the possibility for bad things to happen. This is useful to showing that a pair $(x,y)$ having $f(xy)$ act like a homomorphism or like an antihomomorphism is somehow "infectious" - and then one uses this to derive the desired result by contradiction.
Note that we necessarily have $f(y)f(x)\neq f(x)f(y)$ due to the hypothesis. Now, suppose to the contrary that $f(xz)=f(z)f(x)$ and that $f(x)$ and $f(z)$ do not commute. Let us define two equal expressions: $$f(xy+xz)=f(xy)+f(xz)=f(x)f(y)+f(z)f(x).$$ $$f(x(y+z))=f(x)f(y)+f(x)f(z)\text{ or }f(y)f(x)+f(z)f(x).$$ The difference between these expressions is either $f(z)f(x)-f(x)f(z)$ or $f(x)f(y)-f(y)f(x)$, which are both non-zero by the givens and hypothesis. Thus, we have a contradiction.
By dualizing appropriate choices of rings (i.e. replacing multiplication in $R$ or $R'$ by an operator multiplying things in the opposite order), we achieve some more lemmas from the same argument:
Now, to finish, suppose that there were some pair $(x,y)$ such that $f(xy)\neq f(y)f(x)$ and some other pair $(x',y')$ such that $f(x'y')\neq f(x')f(y')$. We find that $f(xy')=f(x)f(y')$ by the first lemma. However, we also get $f(xy')=f(y')f(x)$ by the further lemmas, meaning that $f(x)$ and $f(y')$ commute. One may similarly find that $f(x')$ and $f(y)$ commute. Then, we may compute: $$f((x+x')(y+y'))=(f(x)+f(x'))(f(y)+f(y'))\text{ or }(f(y)+f(y'))(f(x)+f(x'))$$ $$f(xy+xy'+x'y+x'y')=f(x)f(y)+f(x)f(y')+f(x')f(y)+f(y')f(x')$$ where we note that the middle two summands in the second expression are products of commuting terms. The difference from the first expression to the second is either $f(x')f(y')-f(y')f(x')$ or $f(y)f(x)-f(x)f(y)$, both of which are non-zero. This is a contradiction. Thus, there may not both be a pair where $f$ fails to be a homomorphism and a pair where it fails to be an anti-homomorphism.