Sense of belonging to math and competence expectancy predicted algebra learning.
Incorrect examples fostered learning for students with low prior knowledge.
Middle school students had high expectations of competence across algebra unit.
Student motivation was stable for the duration of the cognitive intervention.