Example/counter example of a particular set being an ideal I have a problem that I'm just curious to check.. we've had a number of "is this ..." questions in this course, and the answer has always been yes, so I'm a little thrown off that it seems to be a no this time, so I'm just hoping to make sure I'm not missing small things.
The problem

Let $A$ and $B$ be two commutative rings and $\phi$ and $\psi$ two ring homomorphisms from $A$ to $B$. Is the set of $f\in A$ such that $\phi(f) = \psi(f)$ a subring of $A$?

Let denote the set of $f\in A$ such that $\phi(f) = \psi(f)$ by $I$. To show that $I$ is an ideal, we would need that $I$ is an additive subgroup of $A$ and that $I$ absorbs multiplication in $A$.
Showing that $I$ is an additive subgroup is fairly simple (i.e., $fg^{-1}\in I$ for any $f,g\in I$) but to show it absorbs multiplication, letting $a\in A$ and $f\in I$, we would require
$$ \phi(af) = \phi(a)\phi(f) = \phi(a)\psi(f) = \psi(a)\psi(f) = \psi(af)$$
and hence, $\phi(a) = \psi(a)$, which would mean the ideal would always have to be trivial (so that $\psi(f) \phi(f) = 0$) or the entire ring ($I = A$), which makes it seem plausible to be able to come up with a counterexample.
Let $A = \mathbb{R}[x], B = \mathbb{C}[x], f = 1 + x, a = 1, \phi:A\to B$ be given by $\phi(\sum_j r_jx^j) = \sum_j r_ji^j$ (i.e., every polynomial gets mapped to its evaluation at $i$) and $\psi:A\to B$ simply be the inclusion map.
Then 
$$\phi(af) = \phi(1+x) = 1+i \neq 1 + x = \psi(1 + x) = \psi(af)$$
and $I$ is not an ideal of $A$.
To make a formal question,

Is this correct?

Also, in case question with the potential accepted answer of "Yes" aren't very nice here, I can also ask, any nice examples of this not being an ideal? Any slick examples (i.e., my `counter example' boils down to $x \neq i$. Any other examples less non-trivial?)
Thanks!
 A: Let me point out several things that trouble me in what you have written.


*

*The quoted problem asks you to show the set of all $f\in A$ such that the set of all $f\in A$ such that $\phi(f)=\psi(f)$ is a subring of $A$, but you immediately go on to try to show it is an ideal. Did you misquote the question?

*You parenthetically comment on showing that the set you call $I$ is an additive subgroup and write

(i.e., $fg^{-1}\in I$ for any $f,g\in I$)

I hope that was a "thinko" (the mental equivalent of a typo)! To show the set is an additive subgroup of $I$ you need to show that (i) it is non-empty, and (ii) if $f,g\in I$, then $\mathbf{f - g}\in I$. $fg^{-1}$ need not even make sense in $A$, since $g$ may not have a multiplicative inverse. It's important not to mix the abelian group additive structure of $A$ with the semigroup/monoid multiplicative structure of $A$.
You did not comment on showing the set is nonempty. Make sure it is! It is pretty simple, of course, but one should do it anyway.

*When you are trying to show the set absorbs multiplication, you assume $f\in I$ and $a\in A$. That means you know that $\phi(f) = \psi(f)$ (because $f\in I$), and you know that $\phi(af)=\phi(a)\phi(f)$ and $\psi(af)=\psi(a)\psi(f)$ (because $\phi$ and $\psi$ are ring homomorphisms). But then you go from $\phi(a)\phi(f)$ to $\psi(a)\psi(f)$. You don't know that this is true, because you are making no assumptions on $a$. If you are trying to prove that $I$ is a subring, then you can take $f$ and $a$ in $I$, and then you are fine: $\phi(a)=\psi(a)$, so the equality you want holds.  
From your incorrect inequality $\phi(af)=\psi(af)$ you try to conclude that $a\in I$ (i.e., that $\phi(a)=\psi(a)$); this does not follow even if the set $I$ is an ideal (which it is not, in general): you could have $I=(0)$, if $\phi$ and $\psi$ disagree everywhere except at $0$ (assuming your rings don't have a $1$, or they are not required to take $1$ to $1$; for example, take $A=\mathbb{Z}$, $B=\mathbb{Z}\times\mathbb{Z}$, and map $\phi(n) =(n,0)$ and $\psi(n)=(0,n)$)), then for any $f\in I$ and every $a\in A$ you have $af\in I$, but this does not require $a\in I$. 
You seem to be trying to argue by contradiction, though somewhat confusedly in my opinion. I also don't see how you can conclude that having $I$ always be an ideal would require $I$ always equal to $(0)$ or to all of $R$.  There are many cases in which the set $I$ will be an ideal: pick your favorite ring $A$, pick your favorite ideal $J$ of $A$, and let $\phi\colon R\to R/J$ be the zero map, and $\psi\colon R\to R/J$ be the canonical epimorphism. Then $I=J$ is an ideal.
Your example is fine, by the way.
It might also be worth noting that what you have is a special case of the equalizer of two morphisms. In any variety of algebras (in the sense of universal algebra), e.g., rings, groups, modules, semigroups, monoids, lattices, etc., if you have two algebras $A$ and $B$, and two morphisms $\phi,\psi\colon A\to B$, then the collection 
$$\{a \in A\mid \phi(a)=\psi(a)\}$$
is a subalgebra of $A$ (subring, subgroup, submodule, subsemigroup, submonoid, sublattice). 
It also satisfies a universal property: the embedding
$$\iota\colon \{a\in A\mid \phi(a)=\psi(a)\}\hookrightarrow A$$
is such that $\phi\circ\iota = \psi\circ\iota$, and if $C$ is any algebra and $f\colon C\to A$ is any morphism such that $\phi\circ f = \psi\circ f$, then $f$ factors through $\iota$: there exists a unique $\overline{f}\colon C\to \{a\in A\mid \phi(a)=\psi(a)\}$ such that $f = \iota\circ \overline{f}$.
Try proving this for the $I$ you have.
A: To further my comment and to amend your example, let $f=3$ and $a=x$.  Then $\phi(3)=3$ and $\psi(3)=3$.  Also $\phi(x)=i$ and $\psi(x)=x$.  Then $\phi(x\cdot 3)=3i$ and $\psi(x\cdot 3)=3x$.  So, this is not an ideal.  But, $I$ will still be a subring as you have pointed out.
