I am trying to prove the following:
Take $f, g:[a,b] \to \mathbb{R}$ such that $f$ and $g$ are continuous. If $$\int_a^b f(x) \ \mathrm{d}x = \int_a^b g(x) \ \mathrm{d}x,$$
then there exists some $c \in [a,b]$ such that $f(c) = g(c).$
Here's my current proof. I'd welcome any feedback regarding correctness and clarity.
Current Proof
Assume that there exists no such $c$. There are then three possibilities. First, it is possible that $f(x) > g(x)$ $\forall$ $x \in [a,b]$. However, this cannot be, since then we would have $$\int_a^b f(x) \ \mathrm{d}x > \int_a^b g(x) \ \mathrm{d}.x$$
Similarly, we cannot have $g(x) > f(x)$ $\forall$ $x \in [a,b]$, since then $$\int_a^b f(x) \ \mathrm{d}x < \int_a^b g(x) \ \mathrm{d}x.$$ Thus, there exists some $x \in [a,b]$ such that $f(x) > g(x)$ and some $y \neq x$ such that $g(y) > f(y).$ Assume without loss of generality that $x < y.$ Consider a new function $h:[a,b] \to \mathbb{R}$ defined by $$h(x) = f(x) - g(x).$$ Clearly, $h$ is continuous, as the difference of two continuous functions. From the above, we have that $h(x) > 0$ and $h(y) < 0.$ Apply the Intermediate Value Theorem to $h$ on the interval $(x,y).$ Thus, there exists some $c \in (x, y)$ such that $f(c) = 0$. Since $(x, y) \subset [a, b]$, we have found an element of $[a,b]$ such that $h(c) = 0 \implies f(x) = g(x).$