Gravity is a fundamental force that attracts objects with mass toward each other. However, the reason matter doesn't collapse completely under the influence of gravity is due to the opposing forces that exist.
Electromagnetic Forces: At the atomic and molecular levels, electromagnetic forces play a crucial role. The electrons surrounding atomic nuclei exert repulsive forces against each other due to their negative charges. This electromagnetic force counteracts gravity, preventing objects from collapsing.
Quantum Mechanics: On extremely small scales, quantum mechanics becomes significant. The uncertainty principle in quantum mechanics introduces a degree of unpredictability in the position and momentum of particles. This uncertainty prevents particles from being precisely localized, providing a kind of stability against gravitational collapse.
Pressure: As matter collapses under gravity, pressure increases. This pressure, in turn, provides a counterforce to gravity. For example, in stars, nuclear fusion processes generate an outward pressure that balances the gravitational force pulling matter inward.
Dark Energy: The presence of dark energy in the universe also plays a role. Dark energy is thought to contribute to the accelerated expansion of the universe, counteracting gravity on cosmological scales.
In summary, a delicate balance between gravitational attraction and other fundamental forces, as well as quantum effects and pressure, prevents matter from collapsing completely under the influence of gravity.