# Characteristic function (convex analysis)

In the field of mathematics known as convex analysis, the characteristic function of a set is a convex function that indicates the membership (or non-membership) of a given element in that set. It is similar to the usual indicator function, and one can freely convert between the two, but the characteristic function as defined below is better-suited to the methods of convex analysis.

## Definition

Let ${\displaystyle X}$ be a set, and let ${\displaystyle A}$ be a subset of ${\displaystyle X}$. The characteristic function of ${\displaystyle A}$ is the function

${\displaystyle \chi _{A}:X\to \mathbb {R} \cup \{+\infty \}}$

taking values in the extended real number line defined by

${\displaystyle \chi _{A}(x):={\begin{cases}0,&x\in A;\\+\infty ,&x\not \in A.\end{cases}}}$

## Relationship with the indicator function

Let ${\displaystyle \mathbf {1} _{A}:X\to \mathbb {R} }$ denote the usual indicator function:

${\displaystyle \mathbf {1} _{A}(x):={\begin{cases}1,&x\in A;\\0,&x\not \in A.\end{cases}}}$

If one adopts the conventions that

• for any ${\displaystyle a\in \mathbb {R} \cup \{+\infty \}}$, ${\displaystyle a+(+\infty )=+\infty }$ and ${\displaystyle a(+\infty )=+\infty }$, except ${\displaystyle 0(+\infty )=0}$;
• ${\displaystyle {\frac {1}{0}}=+\infty }$; and
• ${\displaystyle {\frac {1}{+\infty }}=0}$;

then the indicator and characteristic functions are related by the equations

${\displaystyle \mathbf {1} _{A}(x)={\frac {1}{1+\chi _{A}(x)}}}$

and

${\displaystyle \chi _{A}(x)=(+\infty )\left(1-\mathbf {1} _{A}(x)\right).}$