Let
h(x)=g(b)f(x)+f(a)g(x)−f(x)g(x).Notice that h is continuous on [a,b] and differentiable on (a,b). Moreover,
h(a)=h(b)=g(b)f(a).Hence, we can apply Rolle's theorem which gives
h′(x)=g(b)f′(x)+f(a)g′(x)−f′(x)g(x)−f(x)g′(x)=0for some x∈(a,b). Since g′(y)=0 for all y∈(a,b), we can rearrange the terms above and obtain
f′(x)(g(b)−g(x))=g′(x)(f(x)−f(a))⟹g′(x)f′(x)(g(b)−g(x))=f(x)−f(a).We now hope to divide both sides by g(b)−g(x) but this requires that g(b)=g(x) for all x∈(a,b). Suppose for contradiction that g(y)=g(b) for some y∈(a,b). Then, by Rolle's theorem, g′(z)=0 for some z∈(y,b) which is contradictory.