Definition

$$f( \lambda A + (1- \lambda)B) \leq \lambda f(A) + (1- \lambda)f(B)$$

in which $A$ and $B$ are two points in $\mathbb{R}^n$ and $\lambda$ is in the interval $(0, 1)$

What the above expression says in words is:

The value of the function for any value $X$ on the line segment between $A$ and $B$ is less then any value on the line segment between the result of the function in $A$ and $B$.

A Convex Function

A sample:

The function is:

$$f(x) = 0.04 * x^2 - 40 $$

The above expression becomes:

$${}$$

You can drag the two black dots to change the endpoints $A$ and $B$ of the linesegment.

The yellow-ish arrows represent the expression $\lambda A + (1- \lambda)B$ and then the value of the function $f()$. The blue-ish arrow represents the expression $\lambda f(A) + (1- \lambda)f(B)$

Change the value of $\lambda$ by dragging the slider:

A NOT Convex function

A sample:

The function is:

$$g(x) = x - 10 $$

$$f(x) = (0.001 * g(x)^3) + (0.03 * g(x)^2) - 10 $$

The above expression becomes:

$${}$$

You can drag the two black dots to change the endpoints $A$ and $B$ of the linesegment.

The yellow-ish arrows represent the expression $\lambda A + (1- \lambda)B$ and then he value of the function $f()$. The blue-ish arrow represents the expression $\lambda f(A) + (1- \lambda)f(B)$

Change the value of $\lambda$ by dragging the slider: