Prove that if $f$ is a convex and differentiable function, then for all $\mathbf{x}_1, \mathbf{x}_2$ and $\mathbf{y}$, and $\lambda_1, \lambda_2, \lambda>0$ such that $\lambda_1+\lambda_2=\lambda$, we have $$ \left\langle\nabla f\left(\mathbf{y}\right), \lambda_1 \mathbf{x}_1+\lambda_2 \mathbf{x}_2-\lambda \mathbf{y}\right\rangle \leq \lambda_1 f\left(\mathbf{x}_1\right)+\lambda_2 f\left(\mathbf{x}_2\right)-\lambda f\left(\mathbf{y}\right) $$
This is a problem promoted in Convex Optimization course. A similar situation I've noticed shows that:
Suppose $f$ is differentiable (i.e., its gradient $\nabla f$ exists at each point in $\operatorname{dom} f$, which is open). Then $f$ is convex if and only if dom $f$ is convex and $$ f(\mathbf{y}) \geq f(\mathbf{x})+\langle\nabla f(\mathbf{x}), \mathbf{y}-\mathbf{x}\rangle $$ holds for all $\mathbf{x}, \mathbf{y} \in \operatorname{dom} f$.
For concave functions we have the corresponding characterization: $f$ is concave if and only if $\operatorname{dom} f$ is convex and $$ f(\mathbf{y}) \leq f(\mathbf{x})+\langle\nabla f(\mathbf{x}), \mathbf{y}-\mathbf{x}\rangle $$ for all $\mathbf{x}, \mathbf{y} \in \operatorname{dom} f$.
Is my thinking direction correct? What should we do afterwards?