From page 217 of 'Convex functions' by Arthur Wayne Roberts, Dale Varberg (exercise F) i want proof that: $f \mathbb{R}\to\mathbb{R}$ is affine iff $ f(\sum_{i=1}^n\lambda_ix_i)\le \sum_{i=1}^n\lambda_if(x_i)$, for all $\lambda_1,...,\lambda_n,x_1,...,x_n\in\mathbb{R}$ with $\sum_{i=1}^n\lambda_i=1$.
If $f$ is affine (i.e. $f(x)=mx+q$ with $m,q\in\mathbb{R}$) is obvious that $ f(\sum_{i=1}^n\lambda_ix_i)= \sum_{i=1}^n\lambda_if(x_i)$ but why conversely?