## Characteristic function. (Not the probability one.)

Today’s entry in my mathematical A-To-Z challenge is easier than the bijection function was. This is the characteristic function. Its domain is any set, any collection of things you like. This can be real numbers, it can be regions of space, it can be houses in a neighborhood. Its range, however, is just the two numbers 0 and 1. Its rule — well, that’s the trick. It’s not right to say there’s “the” characteristic function. There are many characteristic functions. It’s just they all look alike. This is the way they look.

To define a characteristic function we need some subset of the domain. A subset is just a collection of things that are also all in another set. So we want a subset — let me give it the name D — of the domain. This subset D can have one or a couple of things in it; it could have everything in the domain that’s in it. The one rule is that D can’t have something in it which isn’t also in the domain. Otherwise, anything goes. (It’s even fine if D doesn’t have anything in it.)

Now, the rule for the characteristic function for D is that the function for any given item in the domain — use x as a name for that — is equal to 1 if x is in D, and is equal to 0 if x is not in D. The function is usually written as the Greek letter chi ($\chi$), or the letter I, or the number 1 put in some kind of fancy heavy font, with the D as a subscript so we know which characteristic function it is.

For example. Suppose the domain is the counting numbers. Suppose the subset D is the prime numbers: 2, 3, 5, 7, 11, 13, and so on. Then the characteristic function looks like this:

For the number x $\chi_D(x)$ is
1 0
2 1
3 1
4 0
5 1
6 0
7 1
8 0
9 0
10 0

… and so on.

Some might ask why create, much less care about, such a boring function? These are people who’ve never had to count how many rows on a large spreadsheet satisfied some complicated set of conditions. That trick where you create a column with a rule like ‘IF((C$2 > 80 AND C$2 ’01/01/2013’ AND C\$4 < '05/01/2013'), 1, 0)', and then add up the column, to find out how many things had a value between 80 and 90 and a date between the start of January and the start of May, 2013? That's using a characteristic function to figure out how large a collection of things is.

Characteristic functions offer ways of breaking down a complicated set into smaller ones all of which share some property. This can be used just to work out how large are the collections of things that share different properties. It can also be a way to break a big problem into multiple smaller problems. We hope those smaller problems are simpler enough that we’re making overall less work for ourselves despite increasing the number of problems. And that’s a good trick, one mathematicians rely on a lot.