Transforming discrete input for regression

Suppose we are in the modelling framework and have been given a discrete input variable for a regression problem. If has possible values we introduce dimensional space . Then we define the transformation where are the basis vectors of .

We would then replace by in the input space .

In the case of boolean input variables, this is as simple as saying is for False and is for True.

You may wonder why no expand this to an -dimensional space. This would ruin independence of the variables, as we would know that always these values in these dimensional spaces have to add to 1 - this causes instability in our polynomial regression.