Show that $f$ is convex if and only if $f\left( \sum_{i=1}^m\lambda_ix_i \right) \leq \sum_{i=1}^m\lambda_if(x_i)$

I need to prove the following statement

Let $S \subset \mathbb{R}^n$ a nonempty convex set and $f: S \to \mathbb{R}$. Then $f$ is convex in $S$ if and only if $f\left( \sum_{i=1}^m\lambda_ix_i \right) \leq \sum_{i=1}^m\lambda_if(x_i)$ for al $m \in \mathbb{N}$, for all $x_1, \dots, x_m \in S$ and for al $\lambda_1, \dots, \lambda_m > 0$ such that $\sum_{i=1}^m\lambda_i=1$

My try: I think I managed to prove the backwads implication. Let $m=2$, and since $\lambda_1 + \lambda_2=1$ then $\lambda_2 = 1-\lambda_1$, so

$$f(\lambda_1x_1+\lambda_2x_2)=f(\lambda_1x_1+(1-\lambda_1)x_2) \leq \lambda_1f(x_1)+(1-\lambda_1)f(x_2)$$ since $f$ is convex in $S$ by assumption.

For the forward implication, I thought that induction might work. The case when $m=1$ is trivial. However, I'm struggling to prove the general case. Any help with that step will be highly appreciate. Thanks in advance!

Hint: Suppose that $f(c_1x_1+...+c_nx_n)\leq \sum c_if(x_i)$, $\sum_ic_i=1$.
Consider $c_1,...,c_{n+1}: \sum_ic_i=1, c_{n+1}\neq 0$. $f(c_1x_1+...+c_{n+1}x_{n+1})=f(c_1x_1+..+c_{n-1}x_{n-1}+(c_n+c_{n+1})({{c_nx_n+c_{n+1}x_{n+1}}\over {c_n+c_{n+1}}}))\leq c_1f(x_1)+..c_{n-1}f(x_{n-1})+(c_n+c_{n+1})f({{c_nx_n+c_{n+1}x_{n+1}}\over {c_n+c_{n+1}}})$.
We have $f({{c_nx_n+c_{n+1}x_{n+1}}\over c_{n+1}})\leq {c_n\over {c_n+c_{n+1}}}f(x_n)+{c_n\over {c_n+c_{n+1}}}f(x_{n+1})$ since ${c_n\over{c_n+c_{n+1}}}+{c_{n+1}\over{c_n+c_{n+1}}}=1$. This implies the result.
• How do you use ${c_n\over{c_n+c_{n+1}}}+{c_{n+1}\over{c_n+c_{n+1}}}=1$ to get $f({{c_nx_n+c_{n+1}x_{n+1}}\over c_{n+1}})\leq {c_n\over {c_n+c_{n+1}}}f(x_n)+{c_n\over {c_n+c_{n+1}}}f(x_{n+1})$? – user441848 Dec 31 '17 at 21:11