If you want to learn the formulas for calculating batting average, earned-run average, on-base percentage, or several other stats, check out my statistics page.
The official scorekeeper must prove the official box score, which is what becomes part of the official record. The formula is very simple and must be applied to each teams scorecard.
First, total the number of runs, men left on base and opponents' putouts for one team. Next, total the number of at-bats, walks, sacrifices, batters hit by pitcher and awards of first base due to interference for the same team. If these two totals are equal than this team's box score is "proven." Repeat the process for the other team.
I've never tried to prove a box score, but I thought others might find it interesting.