Convex set to convex function and vice versa

54 Views Asked by At

There is a related question, but I still not sure that I understood.

Let's say there is a set

$\{ x\in \mathbb{R}^n : f(x) \le 0 \}$

Is it right to say that the set is convex iff function $f(x)$ is convex?

If yes, is convex function domain same as convex set domain?

Edit:

I saw the answers for my original question, and all gave the same example that convex set not always lead to convex function.

So my new question,

Is it always right to say that if the function is convex then the set too?

2

There are 2 best solutions below

0
On

$-x^{2}$ is not convex (it is concave), and $-x^{2} \leq 0$ for all $x$.

Note also that for any monotone function $f: \mathbb R \to \mathbb R$ your set is convex.

2
On

Suppose that function $f$ is convex. Let us denote the given set by $S$. Let $x, y \in S$ and let $\alpha$ be any real number such that $0 < \alpha < 1$. Then $x, y \in \mathbb{R}^n$ and we also have $f(x) \leq 0$ and $f(y) \leq 0$. Now using the convexity of $f$, we note that $$ f\big( (1-\alpha)x + \alpha y \big) \leq (1-\alpha)f(x) + \alpha f(y) \leq (1-\alpha) \times 0 + \alpha \times 0 = 0, $$ showing that $(1-\alpha)x + \alpha y \in S$. Thus our given set is also convex.

The converse may not hold however. For example, let $S$ be the set given by $$ S = \{ \ x \in \mathbb{R} \ \colon \ x < 0 \ \}.$$ This set $S$ is clearly convex in $\mathbb{R} = \mathbb{R}^1$. Now let $f \colon \mathbb{R} \to \mathbb{R}$ be the function defined by $$ f(x) = -x^2.$$ Then obviously $f$ is not convex [Use the second-derivative test for convexity / concavity.], but $f(x) \leq 0$ for all $x \in S$.

Hope this helps.