No definite article is needed. The reason is that in defining the variable you are giving it a name. And names don't normally get definite articles.
Consider: Freddie is a hippie. Freddie is fat. You wouldn't say "The Freddie is fat"
The only time definite article often comes into play with names is when the name leaves ambiguity. Eg "Is that the Freddie who owns a cat?"
So you would use "x" or "the variable" to refer to that thing, but not "the x".
There is one place where the usage gets a bit fuzzy. A comment could be made along the lines of "The x in that statement names a variable" The reason you will see that phrasing is because the sentence is not using x as the name of a variable, it is referring to the character in the sentence.