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!