The wizard Drum Billet knows that he will soon die and travels to a place where an eighth son of an eighth son is about to be born. This signifies that the child is destined to become a wizard; on the Discworld, the number eight has many of the magical properties that are sometimes ascribed to seven in other mythologies. Billet wants to pass his wizard's staff on to his successor.
However, the newborn child is actually a girl, Esk (full name Eskarina Smith). Since Billet notices his mistake too late, the staff passes on to her. As Esk grows up, it becomes apparent that she has uncontrollable powers, and the local witch Granny Weatherwax decides to travel with her to the Unseen University in Ankh-Morpork to help her gain the knowledge required to properly manage her powers.
But a female wizard is something completely unheard of on the Discworld. Esk is unsuccessful in her first, direct, attempt to gain entry to the University, but Granny Weatherwax finds another way in; as a servant. While there, Esk witnesses the progress of an apprentice wizard named Simon, whom she had met earlier, on her way to Ankh-Morpork. Simon is a natural talent who invents a whole new way of looking at the universe that reduces it to component numbers. His magic, however, is so powerful that it causes a hole to be opened into the Dungeon Dimensions.
Eskarina and Simon discover the weakness of the creatures from the Dungeon Dimensions - if you can use magic, but don't, they become scared and weakened. They both manage to transport themselves back into the Discworld. Together they develop a new kind of magic, based on the notion that the greatest power is the ability not to use all the others.