Given the indicator function $I_{C}: \mathbb{R} \rightarrow \mathbb{R}$ to a convex set $C \subset \mathbb{R}$ and a function $g(x): \mathbb{R}^n \rightarrow \mathbb{R}$
$$ I_{C}(g(x)) = \begin{cases} 0 & \text{if } g(x) \in C \\ \infty & \text{if } g(x) \notin C \end{cases} $$
Under what conditions of $g(x)$ is $f(x):=I_{C}(g(x))$ convex?
Let's apply the definition of a convex function:
$$ (1-\lambda) f(a) + \lambda f(b) \geq f( (1-\lambda)a + \lambda b ) ,\quad \forall \lambda \in [0,1] \text{ and } a,b \in \mathbb{R}^n$$ We see that if
- $g(a) \in C$ and $g(b) \notin C$, then $\infty \geq I_C\left( g((1-\lambda)a + \lambda b )\right)$ which is always true
- $g(a) \notin C$ and $g(b) \in C$ then we get the same as in 1. (true)
- $g(a) \in C$ and $g(b) \in C$ then $0\geq I_C\left( g((1-\lambda)a + \lambda b )\right)$ where it follows that $$g((1-\lambda)a + \lambda b ) \in C$$
So concluding, if
$$ g(a) \in C \text{ and } g(b) \in C \quad \Rightarrow g((1-\lambda)a + \lambda b ) \in C \qquad (1)$$
for any $a,b \in \mathbb{R}^n$ and $\lambda \in [0,1]$ then
the indicator function $I_{C}(g(x))$ is convex.
But what kind of functions fullfil condition (1)? Is that a monotnicity condition on $g$?