Introduction to the theory of magnetism