Let $f\colon \Bbb R^n\to \Bbb R$ be a function. Then, $f$ is convex if and only if the function $g\colon\mathbb{R} \to \mathbb{R}$ defined as $g(t) \triangleq f(x+tv)$, with domain $$ \operatorname{dom}(g)=\{t\mid x+tv \in \operatorname{dom}(f), x\in \operatorname{dom}(f), v\in \mathbb{R}^n\}, $$ is convex in $t$.
It says that: a function is convex if and only if it is convex when restricted to any line that intersects its domain. My question was how to prove it?
Reference: Steven Boyd, Convex Optimization, Cambridge University Press, Page 67.