For real numbers $a,b,c,d$, define $\mathcal{O}=\{x\vert cx+d\neq 0\}$. Then define $$f(x)=\frac{ax+b}{cx+d}\;\;\text{for all $x\in\mathcal{O}$}$$ Show that if $f:\mathcal{O}\rightarrow\mathbb{R}$ is not constant, then it fails to have any local maximizers or minimizers.
For this question, it seems easier to use contradiction.
Assume that $f:\mathcal{O}\rightarrow\mathbb{R}$ is a non constant function and has a local maximizer and a local minimizer, there exist an $x_1$ and an $x_2$ in $\mathcal{O}$ such that $f(x_1)$ is a local maximizer and $f(x_2)$ is a local minimizer. However, $f$ is not continuous at $x=-d/c$ since $x=-d/c$ is a critical point. The limit at $x=-d/c$ doesn't exist and $$\lim\limits_{x\rightarrow (\frac{-d}{c})^+} \frac{ax+b}{cx+d}=\pm\infty;\;\;\;\lim\limits_{x\rightarrow (\frac{-d}{c})^-} \frac{ax+b}{cx+d}=\pm\infty$$ As $x\in\mathcal{O}$ approaches to $x=-d/c$, $f(x)$ is either approaching to infinity or negative infinity. This contradicts with $f$ has $f(x_1)$ as a local maximizer and $f(x_2)$ as a local minimizer. Therefore, by contradiction.
Can someone check this solution right or not? And I want to know how to write a direct proof, can someone give me a hint or suggestion to do it? Thanks