Let $X$ be a connected space, $f:X\to X$ continuous involution, $g:X\to\mathbb{R}$ continuous. Prove that $\exists$ $x\in X$ such that $g(x)=g(f(x))$. This is a homework problem in an undergraduate topology class that I am ludicrously (and probably stupidly) stuck on. Any guidance would be appreciated:
Let X be a connected space, $f:X\to X$ a continuous involution (i.e. f is its own inverse), $g:X\to\mathbb{R}$ continuous. Prove that $\exists$ $x\in X$ such that $g(x)=g(f(x))$.
Here are the things I understand:
Some examples of $f$ include the identity map, $f(x)=-x$, $f(x)=\frac{1}{x}$ if $x\neq0$, etc. The result clearly holds if $f$ has a fixed point. I know any continuous involution in $\mathbb{R}^2$ has a fixed point, but we are on an arbitrary connected space, and I have no results I can use for such a thing. I can define a new continuous function $h:X\to\mathbb{R}$ so that $h(x)=g(f(x))-g(x)$. If this function has a zero, the result follows, but I don't know how to show it does. I could apply the intermediate value theorem since X is connected and $g:X\to\mathbb{R}$, but I again don't see how this would be helpful.
Thanks very much in advance!

HINT: Let $h(x)=g\big(f(x)\big)-g(x)$. Suppose that $x\in X$ is such that $h(x)<0$. What can you say about $h\big(f(x)\big)$? (You’re actually on the right track towards the end of your question.)
