How do underlying beliefs work?

A student hears that five out of a hundred students failed a test in his math class. He gets down before he even knows his own results; he thinks that he must be one of those students for sure. His underlying belief might be, “I'm terrible at math, a failure at school, and I never do well at anything.” Here's how his unhelpful thought happened:

Underlying Belief: “I never do well at anything.”

Activating Event:

Belief:

Consequence:

A friend can't hang out

“No one wants to go out with me.”

“I feel down.”