A Mathematical Explanation of Transformers for Large Language Models and GPTs