There are Babylonian and Egyptian sources describing how to solve quadratic and some cubic equations from about 1600 BCE, but that is unfortunately at the end of the pyramid-building period. I think it's likely that they had this knowledge much earlier, but it's possible that they built the Pyramids, or most of them, before anyone had figured that out.