Problem: Let $f,g:[a,b]\to [c,d]$ be continous functions. Suppose that $f$ is surjective. Prove that there exists $x\in[a,b]$ such that $f(x)=g(x)$
My solution and proof: Given $f,g:[a,b]\to[c,d]$ are both continous functions. Let $h(x)=f(x)-g(x)$. Then clearly $h$ is a continous function from $[a,b]$ into $[c,d]$, and it's the difference between two continous functions. Since $f$ is surjective, $\exists x$ such that $f(x_2)=d$. Also, $g(x_1),g(x_2)\in[c,d]$. Therefore $h(x_1)=f(x_1)-g(x_1)\leq0$ as $f(x_1)=c$ and $h(x_2)=f(x_2)-g(x_2)\geq$ as $f(x_2)=d$. Thus $h$ is a continous function having $h(x_1)\leq0$ and $h(x_2)\geq0$, then by intermediate value theorem $\exists x\in[x_1,x_2]\subseteq[a,b]$ such that $h(x)=0$ and $f(x)=g(x)$. Hence, $\exists x\in[a,b]$ such that $f(x)=g(x)$
Does my proof look correct? Anything missing?