Albert Einstein did not need dark matter to explain the orbit of Mercury because his theory of general relativity provided a different explanation for the observed anomalies in Mercury's orbit. Before the development of general relativity, astronomers had noticed that the orbit of Mercury deviated slightly from what was predicted by Newtonian gravity.
In Newtonian physics, the force of gravity decreases with distance according to an inverse square law. However, the observed discrepancies in Mercury's orbit indicated that there might be additional gravitational influences that could not be accounted for by the known mass in the solar system.
Einstein's theory of general relativity, published in 1915, presented a new understanding of gravity. According to general relativity, gravity arises from the curvature of spacetime caused by mass and energy. The presence of massive objects, such as the Sun, bends the fabric of spacetime, causing nearby objects to follow curved paths.
Einstein's theory of general relativity successfully explained the observed anomalies in Mercury's orbit without the need for dark matter. The curvature of spacetime around the Sun accounted for the deviations, providing a more accurate prediction of Mercury's orbit.
Dark matter, on the other hand, is a hypothetical form of matter that is thought to exist based on its gravitational effects on galaxies and other astronomical structures. It is invoked to explain the observed discrepancies in the rotational velocities of galaxies and the gravitational lensing effects observed in the universe. However, in the specific case of Mercury's orbit, general relativity alone sufficed to explain the observations without requiring the existence of dark matter.