Let $f$ be a numerical function, $f:D\to\mathbb{R}$, and we want to algebraically determine if $f$ is convex.
According to the definition, $f$ is convex if and only if $\forall~x_1,x_2\in D$ the line segment connecting $\big(x_1,f(x_1)\big)$ and $\big(x_2,f(x_2)\big)$ lies above the graph of $f$.
I have determined the function describing the line: $$g:[x_1,x_2]\to\mathbb{R},~g(x)=\frac{f(x_1)-f(x_2)}{x_1-x_2}x+\frac{x_1f(x_2)-x_2f(x_1)}{x_1-x_2}$$
I have taken an arbitrary $$s\in [x_1,x_2]\Rightarrow s=\lambda x_1+(1-\lambda)x_2,~\lambda\in[0,1]$$ and calculated $$g(s)=\lambda f(x_1)+(1-\lambda)f(x_2)$$ Using the definition the equivalence of convexity becomes $f(s)\le g(s)$: $$f(\lambda x_1+(1-\lambda)x_2)\le \lambda f(x_1)+(1-\lambda)f(x_2)~\forall~x_1,x_2\in D,\lambda\in[0,1]$$ ... which is the official definition of convexity.
For continous functions it is said that it is enough to check the inequality for a fixed $\lambda\in(0,1)$, but why? If it is true for a single case does it imply it is true for any $\lambda$?
EDIT1: If I think about it for $f(x)=\sin(x)$ this isn't even true...
EDIT2: I think I have misunderstood, my counterexample for $\sin(x)$ isn't valid because it only analyzes a fixed pair $x_1,x_2$, but for other pairs the inequality isn't true for the same $\lambda$. Also I have looked over the proof "midpoint convex, continuous implies convex". Thanks to everyone for the help.