Kate Quarfordt is the founding director of the musical theater program at Bronx Preparatory Charter School.

I know you’re going to think I’m making this up, but I swear it actually happened, earlier this week, exactly as follows:

I’m on the D train heading up to the South Bronx, where I teach theater to students in grades 5-12. The commute from Brooklyn is a long one.

Out comes the laptop. I try to work on a draft of an article I’m struggling with. I’m supposed to be writing about making education engaging and relevant for today’s “urban youth.”

At West 4th Street I look up, my eye caught by the bouncy swagger of an attractive young kid with his hair in long thin braids. He’s maybe 13 or 14, wearing those jeans that somehow look baggy and skinny at the same time.

The kid sits down diagonally from me, takes out a Rubik’s Cube and starts working at it feverishly. He’s twisting and flipping it again and again at top speed, moving like he’s hypnotized.

People are glancing up from their iPods at him, mildly curious. The 30-ish guy in the rumpled T-shirt who’d been slouching half-asleep across from him is now sitting bolt upright, riveted.

After a minute or so he lets out a long whistle and asks, “Can you solve it?”

The kid grins and, without hesitating, tosses the Rubik’s Cube to the guy, who catches it.

“Yup,” he says. “Mix it up. I can solve it.”

So the guy scrambles it. He’s about to hand it back, but he hesitates. “Damn,” he says, wistfully. “I haven’t messed with one of these in years. Can I try solving it?”

“Sure,” says the kid. “But I’m getting off at 59th, so…”

The guy starts working furiously.

Now everyone on the train is watching. I try to pry my eyes away and go back to my laptop. But the article can’t hold my interest. I’m magnetized by the blur of the Rubik’s Cube in the guy’s hands.

The kid is, too. I catch his eye as he watches and smile at him. “So, you really know how to solve it?” I ask him.

“Yeah,” he says. “I mean, whatever. It’s just algorithms.”

“Right,” I say, trying not to let my jaw drop. “Listen, you gotta forgive me, but I’m a teacher so I’m kind of fascinated here. What do you mean, ‘just algorithms’?”

The kid looks at me like he feels a little sorry for me, and explains. “Well, an algorithm is just like a pattern of steps, like a sequence of moves to get you where you want to go.”

It occurs to me at this moment that it’s around noontime. This kid is skipping school.

“So … who taught you these patterns?” I ask.

“My friend,” says the kid. “This dude Lewis. He had a Rubik’s Cube and I thought it was cool, so I bought one and he showed me. It only took me a few days to figure it out.”

“Yeah,” the rumpled guy across from him chimes in, not looking up from the cube in his fast-moving hands. He’s got the red, yellow, green and white sides all matched up now, only orange and blue to go. “It’s just like in computer programming,” he says. “Everyone uses algorithms. And there’s some statistics involved, too, because when you —” he stops violently midsentence, as if he’s been stung by a bee, drops the Rubik’s Cube in his lap and throws his hands up. “Aw, damnit!” he says, “I just HAD to go and hit the asymptote!”

He displays the orange side, marred by a symmetrical pattern of four pesky blue squares, then flips the cube to reveal the same pattern in reverse on the other side.

“Oh snap,” says the kid, nodding sympathetically. “Yeah, the asymptote’s a bitch.”

“Wait a second,” I say. “What do you mean, the asymptote?”

The kid looks at me. “Thought you were a teacher.”

“I teach theater,” I explain.

The kid nods. “So, the asymptote is the curve?” he makes a swoop with his hand. “You know? The curve that keeps getting closer and closer to the line but never hits it?”

An image of the soup-green textbook from my ninth-grade geometry class, which I barely passed, flashes dimly in my memory.

“So what do you do when you hit the asymptote?” I ask. I am completely hooked now, my laptop closed on my knees.

“Well,” says the kid. “You gotta go back to go forward.”

“Like in life,” the guy agrees. He scrambles the cube up again so it’s totally random and hands it back to the kid, who holds it up and says, “Wanna see?”

“Yeah,” I say. “I definitely want to see.”

A few minutes later, we pull into 59th Street, just as the kid solves the whole puzzle. There is a smattering of applause. He says, “See ya, miss,” and gets off the train.

I sit there for a second. Then I open up my laptop.