We analyze why and how erroneous examples can be beneficially employed in learning mathematics. The `Why' addresses reasoning and attitudes that are rarely fostered in today's mathematics lessons but which are useful for learning, certainly needed in real life and in all applications of mathematics as well as in maths itself. The `How' addresses pedagogical strategies capitalizing on errors via erroneous examples and their realization in the web-based learning environment ActiveMath. An analysis of classes of errors informs the knowledge representation, the instructional strategies and the feedback of ActiveMath. KEYWORDS cognition in education, meta-cognition