BY THE time I was in the fifth grade, I loved math and I hated math.

I adored the beauty of the subject. But at school, it was worksheet after worksheet, even if I had already mastered a concept.

I was stuck in a classic education trap: a teacher must “teach to the middle” of a class. This causes no end of grief. The kids who already get something are bored, the kids who are trailing behind feel lost and embarrassed. And the middle third isn’t having such a great time, either, surrounded by unhappy friends.

Yet this would seem to come with the territory. There is, after all, only one teacher and many students.

Now there is a compelling solution in math education, one that I dearly wish had been around when I was a kid. Called the Khan Academy, it’s a free website that offers a large library of startlingly clear mini-lectures, combined with software that generates exercises, feedback, and encouragement in the form of points and badges inspired by the video game world.

Last year the Los Altos school district in California decided to try out the Khan Academy for a few of their math classes. These classrooms were “flipped”: The students listened to the lectures at home, and then did problem sets on laptops at school, where the teacher could help.

Before Khan, 23 percent of students in a class of struggling seventh graders scored “proficient” on a standardized test, with the rest lagging behind. After just one year, 35 percent scored proficient, and 6 percent were “advanced.” Some fifth graders were well into algebra. Students and teaches loved it, and this year Los Altos is trying Khan in all the fifth and sixth grade classes.

Khan offers a new way to teach mathematics for a country badly in need of inspiration. The initial results suggest that many kids who are being tracked out of more challenging math are being done a great disservice – a good number of them might come to love math and do brilliantly.

The Khan Academy is more broadly significant because it suggests that, after decades of overheated hype, we may finally begin to see ways technology can contribute in the classroom.

The traditional vision of a high-tech classroom looks a lot like Arizona’s Kyrene School District, the subject of recent story in The New York Times. On the walls are large interactive screens. There is Facebooking and blogging and late-model laptops aplenty. The technology push has cost more than $30 million, but test scores are stuck.

But the Khan Academy did not begin with dreams of gleaming gadgets. Its founder, the MIT-educated Salman Khan, is a recovering hedge-fund employee who wanted to help a cousin with her math. He started to tutor her remotely. Then he started making short videos for her, so she could play and replay them at her own pace.

The videos brilliantly manage to be more compelling than a textbook, but without any distractions. All you hear is Khan’s voice, and all you see is his writing on a black background. There is no theme music, no animation. He posted to YouTube; others discovered them. Khan eventually quit the day job.

Khan has gone on to make more than 2,400 videos, and his nonprofit academy is backed by Google and Bill Gates. The academy is going global and branching out beyond math.

What is great about Khan Academy is not that it uses computers, but that it represents a genuine conceptual advance. Relatively passive work (listening to lectures) happens at home, and help is available when the student needs it most (doing homework – in this case, at school). Students of all abilities can work side by side, helping and encouraging each other. Math is no longer a divider, but a uniter.

“Math, I always found after teaching for 21 years, kids love it, or kids don’t love it,” says Richard Julian, a fifth grade teacher at Los Altos, in a video testimonial. “And now I think I have 27 kids in my class who at some point during the day say, hey, I love math.”