The mathematical representation of one-hot encoding can indeed be done using indicator functions. An indicator function is a mathematical function that takes a value and returns 1 if the value satisfies a certain condition (belongs to a particular set), and 0 if it doesn't satisfy the condition.
C={C1,C2,C3,C4,C5}, and you want to encode an input XX as a one-hot vector. You can define indicator functions for each category:
For category CiCi, the indicator function 1Ci(X)1Ci(X) is defined as:
{1if X=Ci0otherwise
{10if X=Ciotherwise
In this definition, 1Ci(X)1Ci(X) is 1 if XX belongs to category CiCi, and 0 otherwise. Essentially, it's a function that acts as a "switch" to turn on (1) or off (0) for each category based on whether XX belongs to that category.
So, for your examples:
If X1X1 belongs to the C4C4 class, the one-hot encoding can be represented as:
1C1(X1)=0, 1C2(X1)=0, 1C3(X1)=0, 1C4(X1)=1, 1C5(X1)=01C1(X1)=0,1C2(X1)=0,1C3(X1)=0,1C4(X1)=1,1C5(X1)=0
If X1X1 belongs to the C2C2 class, the one-hot encoding can be represented as:
1C1(X1)=0, 1C2(X1)=1, 1C3(X1)=0, 1C4(X1)=0, 1C5(X1)=01C1(X1)=0,1C2(X1)=1,1C3(X1)=0,1C4(X1)=0,1C5(X1)=0