The phenomenon you are describing is known as the "observer effect" or "measurement problem" in quantum mechanics. When a measurement or detection apparatus, such as a detector, is introduced to determine through which slit an electron passes, the interference pattern typically disappears.
In quantum mechanics, particles like electrons can exhibit both particle-like and wave-like properties, known as wave-particle duality. When electrons pass through a double-slit experiment without any measurement apparatus, they can interfere with themselves, resulting in an interference pattern on a screen or detector. This interference pattern arises due to the superposition of different quantum possibilities associated with each slit.
However, when a detector is placed near one of the slits to determine the electron's path, the act of measurement involves interaction between the detector and the electron. This interaction disrupts the delicate quantum state of the electron, collapsing it into a definite position or path. As a result, the electron behaves more like a classical particle, and the interference pattern disappears.
The measurement process disturbs the electron's wavefunction, which encodes the probabilities of different outcomes. The act of measurement forces the electron to "choose" a definite path, destroying the coherent superposition of paths that produces the interference pattern.
This effect is not unique to electrons but is a fundamental aspect of quantum mechanics. The act of measurement disrupts the delicate quantum system under observation, leading to a collapse of its wavefunction and the emergence of definite, classical-like properties.
It's important to note that there have been fascinating discussions and alternative interpretations of quantum mechanics regarding the observer effect and the nature of measurement, such as the Copenhagen interpretation, Many-Worlds interpretation, and various others. These interpretations offer different perspectives on how to understand the role of measurement in quantum systems. However, the exact interpretation and resolution of the measurement problem are still topics of debate and ongoing research within the scientific community.