Slim went on to study civil engineering at the National Autonomous University of Mexico, where he also concurrently taught algebra and linear programming.