Quantum mechanics is the branch of physics explaining how energy and matter behave at the atomic and subatomic scales, a realm where particles act as both waves and particles, and where properties are quantized into discrete packets rather than continuous values.