What is the role of an unescaped circumflex or hat character " ^ "?

Yes, there is a very basic one: when input lines are being read, if TeX finds two consecutive ^ characters, it interprets the input in a very peculiar way:

  1. if the ^^ combination is followed by two hexadecimal lowercase digits (0123456789abcdef), then TeX transforms the four bytes into the byte corresponding to the hexadecimal number;

  2. otherwise TeX computes the character code of the following character and transforms the three bytes into the character having ASCII code differing by 64 from the computed one, adding or subtracting 64 so that the result is in the range 0–127.

Thus ^^20 is completely equivalent to typing a space, while ^^M is the same as typing the usual end line character.

XeLaTeX and LuaTeX add to this mechanism. Since Unicode characters can be specified with 21 bits, up to six ^ characters are allowed followed by the same number of hexadecimal lowercase digits.

So, for example,

^^^^0021

represents five tokens in standard TeX ^^^ (category code 30, see the rule above, second item), followed by ^ 0 0 2 1; in LuaTeX or XeTeX it represents just one character having character code "21 (hexadecimal, 33 decimal).

TeXnical note. The convention actually is about two (or more for Unicode engines) identical characters having category code 7. Usually only ^ is given category code 7.


In addition to egreg's answer the other reason is same reason \sin gives an error, or \hat etc.

By far the most common reason for encountering a ^ in text mode is that the author has gone

blah blah and 1 + x^2 = 2, blah ...

but forgotten to mark the math mode region.

Making math mode commands an error in text mode is an explicit design decision that permeates the TeX language. A ^ is almost never needed in normal text, plain TeX and latex 2.09 didn't even bother to define a command to access it, latex2e added \textasciicircumflex for consistency but as you can tell by the length it was assumed to be just for setting up encoding files, not something anyone would ever really want in a document.