Let $F$ be a field, and let $f\in F[x]$ that has at least two distinct irreducible factors in $F[x]$. Show that there exists a polynomial $g \in F[x]$ with $0 < \deg(g) < \deg(f)$ for which $g^2 \equiv g \bmod f$.
I know f is not irreducible, hence not prime, and not maximal, but I haven't been able to make any of these facts work for me. I feel like an appropriate strategy is to have g be built out of two different irreducible factors of f, but the restriction that deg(g) < deg(f) has hampered my attempts. Any help would be very much appreciated as I have been banging my head against this problem for quite awhile.
Note that if $ R = R_1 \times R_2 \times \ldots \times R_n $ is any product of nontrivial commutative rings with $ n \geq 2 $, then it always contains a root of $ X^2 - X $ which is not $ 0_R $ or $ 1_R $. Indeed, the element
$$ X = (1, 0, \ldots, 0) $$
is neither $ 0_R $ nor $ 1_R $, but it is readily checked to be a root of $ X^2 - X $.
If $ f = gh $ is a polynomial where $ g, h $ are both nonconstant, coprime polynomials in $ F[X] $, then the Chinese remainder theorem gives the isomorphism
$$ F[X]/(f) \cong F[X]/(g) \times F[X]/(h) $$
By the above result, therefore, $ F[X]/(f) $ contains a root of $ X^2 - X $ that is not $ 0 $ or $ 1 $. However, we know that these are the only roots of $ X^2 - X $ that lie in the image of $ F $ under the obvious embedding $ F \to F[X]/(f) $ whose image are the constant polynomials. Therefore, any root that is not $ 0, 1 $ must be of degree at least $ 1 $ (this is the smallest possible degree of a representative of its coset in the quotient), so we are done.