help defining an indicator function?

716 Views Asked by At

Consider some set: $A = \{1,2,3,4,5\}$

And a specific number, like $3$

I'd like some function $$f(a)=\begin{cases} 1 &\quad a>3\\0&\quad \text{otherwise}\end{cases}$$ - i.e. $f(4)=1,\ f(2)=0,\ f(3)=0,$ etc.

I don't want to leave it as just $f(a)$ or use the indicator notation - I'd like an actual, explicit function (like $f(x) = 2x+3$ or something), one that can produce this result.

Any suggestions?

2

There are 2 best solutions below

0
On

As long as $A$ is a finite set of numbers, you can use polynomial interpolation to construct such a function.

Suppose $A = \{x_1,\ldots,x_n\}$ is a set of distinct real numbers and $y_1,\ldots,y_n$ are real numbers. Then we can construct a real polynomial $f$ such that $f(x_i)=y_i$ for each $i$, as follows.

For each $i$, define the $i$th Lagrange polynomial $$L_i(x) = \prod_{\stackrel{1\leq j\leq n}{j\neq i}}\frac{x-x_j}{x_i-x_j}.$$ For example, for $A = \{1,2,3,4,5\}$, we have $$L_2(x) = \frac{x-1}{2-1}\cdot \frac{x-3}{2-3}\cdot \frac{x-4}{2-4} = \frac12(x-1)(x-3)(x-4).$$

Then the polynomial $$f(x) = \sum_{i=1}^n y_iL_i(x)$$ will satisfy $f(x_i)=y_i$ for each $i$.

0
On

In this case, you want a function $f:\{1,2,3,4,5\}\to \{0,1\}.$ You can define such a function like this without the use of the indicator function as follows:

$$f(a)=\left\lfloor\frac{a}{4}\right\rfloor$$