The brain performs and learns complex motor operations by feedback and analogy.
It makes approximations, tries them, then makes adjustments based on the results, tries again, readjusts…and repeats this process until the desired result is achieved. If you want to call this “doing math”, then it’s a pretty crude form of math. It only works because the brain has such an enormous amount of processing power , thanks to its almost inconceivable number of neural connections.
Try this: hold your computer mouse upside down (with its buttons toward the heel of your hand instead of your fingertips. Now pick a target area on the screen and try to move the cursor there. Your first motion will be wildly off. It was your brain’s wild guess about what to do. But now the feedback loop kicks in. Your eyes will have supplied information about the results and how they match the goal. Your brain will use that information to make a slightly more refined guess about what to do, and the process will repeat. This will happen with such speed that in less than a minute, you will be fairly competent at directing the cursor where you want it. It will even start to feel completely natural. This is the same process by which the brain learns all complex motor functions.
All through this feedback learning process, the brain is constructing a mental model of this particular aspect of the world. That modeling process is more recognizably mathematical than is the feedback learning by which it is acquired, because it is an abstraction. It defines the players in the scenario and then describes how they relate to each other in a way that can be encoded in memory. This code is written in the mental language of space and time and proprioception.
This abstract modeling provides a shortcut for dealing with new situations. When faced with a new task, the brain sifts through its library of models for one that’s analogous to the new situation, one where there are similarities of entities and relationships. This way, it doesn’t have to start from scratch in the feedback learning process, but can start from the actions that yielded the best result in the previous similar situation. The feedback process will still be required, though, because analogies are rarely perfect.