Question
It is stated in Boyd & Vandenberghe's "Convex Optimization" that if $f:\mathbb{R}^n \to \mathbb{R}$ is differentiable, then $f$ is quasiconvex if and only if $\forall x,\,y \in \operatorname{dom}(f)$,
$$f(y) \le f(x) \implies \nabla f(x)^T(y-x) \le 0.$$
The "only if" part is not hard to prove, but I have a little problem making the proof of the "if" part clean and rigorous. I'll share my current attempt below, and will appreciate a better proof, or suggestions to improve it.
Current attempt
I use the fact that $\forall x,\,y \in \operatorname{dom}(f), \forall \theta \in [0,\,1]$, $$f\text{ is quasiconvex } \iff f(x+\theta (y-x)) \le \max\{f(x), f(y)\}$$ and prove by contradiction as follows:
Suppose there exists $\theta\in (0,\,1)$ and $x,\,y \in \operatorname{dom}(f)$ such that $f(z) > \max\{f(x),\,f(y)\}$, where $z \triangleq x + \theta(y - x)$ and $x \ne y$. Without loss of generality, assume $f(y) \le f(x)$.
Hence, we have $f(z) > f(x)\ge f(y)$.
But this implies that $\nabla f(z)^T(x - z) \le 0$ and $\nabla f(z)^T(y-z)\le 0$, due to the sufficient condition above. Since $x-z=\theta(x-y)$ and $y-z=(1-\theta)(y-x)$, this in turn implies that $\nabla f(z)^T(x-y) = 0,$ i.e. the directional derivative is zero. But this is true for any $z=x+\theta(y-x)$ where $\theta\in(0,1)$, so it's impossible for $f(z)$ to descend to $f(x)$, as $\theta$ tends to $0$, and we have a desired contradiction.
You have the right idea, but your exposition is off. You have already set $\theta$, so you can't claim this is true for all $\theta$. I would make the following amendments:
But this is true for any $z=x+θ(y−x)$ where $θ \in (0,1)$ and $f(z) > f(x)$, so it's impossible for f(z) to descend to f(x). More precisely, let
$Z = \{ z | f(z) > f(x) \text{ and $z=x+θ(y−x)$ for some $\theta$} \}$.
Pick $z^* = \min Z$. Then since $z^* > x$ and $f(z^*) > f(x)$, there must exist $z' \in (x, z^*)$ such that $ f(z^*)>f(z') > f(x)$. But then $z' < z^*$ and $z \in Z$, contradicting that $z^*$ was the minimum element of $Z$.