One of several ways to check convexity is when the function is restricted to a line (p.67-68, Boyd's and Vandenberghe's book on Convex Optimization): A function $f$ is convex if and only if for all $x\in\text{dom}f$ and all $v$, the function $g(t)=f(x+tv)$ is convex (on its domain, $\left\{t\mid x+tv\in\text{dom}f\right\}$).
I'd like to prove this rather simple thing, but since I'm a novice when it comes to proofs, I'd appreciate your take on it.
One straightforward way is to check whether the second derivative is positive semidefinite, but this is only a sufficient condition and also requires the function to be twice differentiable: $$g(t)=f(x+tv) \\ g'(t)=f'(x+tv)v \\ g''(t)=f''(x+tv)v^2$$ which is positive semidefinite since $f$ is convex (i.e., $f''\geq 0$).
Another and probably the preferred way:
($\Rightarrow$): If $f(x)$ is convex, then $f(y)$ is also convex for any $y=x+tv$ that belongs to the same domain as $x$.
($\Leftarrow$): Only if $f(x+tv)$ is convex, is $f(x)$ convex. This follows from the fact that if $f(x+tv)$ is convex for $x+tv$ for any $t$, then it is also convex for $t=0$, in which case the result follows.