Let $\displaystyle f:R \rightarrow R$ be any 1-variable function. Define $\displaystyle A=\{(x,y)\in R^2:y\leq f(x)\}$ and $\displaystyle B=\{(x,y) \in R^2 : y\geq f(x)\}$.

Prove that $\displaystyle f$ is continuous $\displaystyle iff$ $\displaystyle A$ and $\displaystyle B$ are closed in $\displaystyle R^2$.