What happens when a laser beam is stuck between two mirrors and the distance in-between is decreased gradually? Heisenberg Uncertainty Principle Assuming a laser beam going back and forth between two mirrors, what would happen if we keep bring the mirrors closer and closer to each other? Because after a certain width, we would be knowing both the momentum and the position of photons which would violate Heisenberg Uncertainty Principle?
So, how would the laser beam react in this scenario? What would happen?
 A: Note: the following was intended as a response to a question posed in the comments of a previous answer ("why does the force increase as we move the mirrors together?"), not as a complete answer. In particular, I have ignored the ability of the photons to escape the mirror confinement.

The laser beam exerts a force on the mirrors, $F = P/c$ where P is power.
To push the mirrors together you must do work, which increases power, which increases force, which is a recursion, which probably needs a numerical solution with a computer.
There might be some trick to elegantly solve this but I don't know it, so I'll just carry it until the point where I'd let a computer do the rest for me.
Problem 1: Do Work on Photons, Ignore the Beam
Doing work on the beam is doing work on the photons.
The photon kinetic energy is $T = h \nu$ so when you do work on n photons $W = n\int_0^{x'} dT/dx$, you increase the frequency such that $\nu_f = \nu_0 + W/hn$
This accounts for the conservation of energy: when you do work on the beam (with perfectly reflective mirrors) you must increase the energy of the beam. Remember that we don't actually know what W is, because W is a function of F which is a function of P which changes with W.

Problem 2: Increase Energy Density, Ignore the Work
Furthermore, suppose the distance between the mirrors was initially D. Then the energy of the beam was:
$$E_0 = P D/c$$
Conserve energy and leave out the conservation of energy from doing work, we have already accounted for it by increasing photon energy. So treat E as a constant. When you push the beams together distance $x'$ at constant E, we must increase P:
$P = cE_0/(D-x')$

Put The Results Together
We know the power of the beam scales linearly with the energy of the photons so we can just multiply our result for problem 2 by the ratio of photon kinetic energies.
$T/T_0 = \nu_f/\nu_0 = 1 + W/nh\nu_0$
$P = \frac{cE_0}{D-x'} + \frac{cE_0W/nh\nu_0}{D-x'}$
A: Let me propose that from a mathematical point of view this question has nothing to do with quantum mechanics. You have got a standing wave between two fixed boundaries (a vibrating string is a perfectly valid image) and the "uncertainty principle" says there is a relation between the frequency (which in quantum mechanics is proportional to the uncertainty of photon momentum) and the distance between the boundaries (which give the uncertainty in the position). Concretely the frequency is inversely proportional to the wavelength (with the invariant wave propagation speed as conversion factor), and the latter cannot exceed twice the distance between the boundaries for a standing wave.
Now what happens when you bring the boundaries closer together, as in an upward glissando? Although the change of boundary position at finite speed will perturb the standing wave solution in a complicated manner, it would seem that in the limit of slow change what essentially happens is that the frequency of the vibration goes up inversely proportionally to the remaining distance. In the photon* image, the (theoretically infinitely hard) mirrors by moving together exert work on the photons, which thereby gain energy and frequency, and therefore uncertainty of momentum. The uncertainly principle remains valid.
*I might add that talking about photons is pointless here; photons only are a relevant notion when there is exchange of energy form, which can only happen in quanta. In the described situation the wave picture is entirely sufficient, no need for a particle view.
A: As everything the devil is in the details of how exactly you set up this experiment. But roughly speaking after a certain amount of time you will find that 1. The amount of force it takes to push the mirrors very close gets very high.  And 2. You will find that the photon doesn't always stay between the mirrors.
A: I would like to address something interesting the other answers do not mention, that is, that there are no perfect mirrors, and the interaction between the atoms in the mirror and the photons does matter:

*

*reflection (elastic scattering)


*absorption (heating up the mirror), the photon transfers its energy to the absorbing atom/electron system and the photon ceases to exist
Now in your case, both happen, it is just that the probability of reflection is much higher, but even then, some photons will be absorbed by the mirror and will heat up the mirror (please note it is possible in this case that the atom will re-emit the excess energy, but that could be in a random direction, and at a different energy level/ or cascades, thus not contributing to your example of laser beam).

In the real world the mirrors aren't perfectly reflecting so you need to supply energy to make up for the energy lost by absorption at the mirrors (this also ends up heating up the laser).

Why is it necessary to supply constant electricity to make a laser work?
As you move the mirrors closer and closer, the number of interactions rises per unit time (there will be more and more interaction in the same period of time), and in absolute sense, there will be more and more absorptions. Thus, way before you would have to consider the HUP, you will run out of photons in your laser beam, because they will all be absorbed by the mirrors' atoms, and their energy will heat up the mirror.
So the answer to your question is that eventually all the energy in your laser beam will be transferred to the mirror (heat it up) before the mirrors would be too close to consider the HUP.
A: Most of the answers tackle the classical problem described in the first part of the question involving a laser and mirrors.  I'm going to focus on the part of the question about the uncertainty principle.
infinite square well
There's a "toy" system that is studied by many introductory quantum mechanics students.  The system is a single quantum particle trapped in a rigid 1D box.  The potential energy of the particle is described as an infinite square well.
The position wavefunction of the particle is exactly zero outside of the box, so the particle remains trapped.  Photons are massless, but for the time being, lets imagine a massive particle in the box.  The energy eigenstates of the system are
$$ E_n = n^2 \frac{\pi^2\hbar^2}{2m L^2},$$
where $m$ is the mass of the particle and $L$ is the length of the box.  In the minimum energy (or ground) state $n=1$, and $E_1 \ne 0$.  The particle cannot stop moving.  It must have some energy.
In an energy eigenstate the particle's energy is exactly known, but its position is in a mixture state.  The position wavefunction is non-zero in many places inside of the box.  We could approximate the position uncertainty, the width of the wavefunction, as the size of the box:
$$\Delta x \approx L$$
(It's possible to exactly calculate $\Delta x$, and the Wikipedia article linked above works it out)
If the particle is in a definite energy state, then its energy is known exactly.  Since $E = \frac{p^2}{2m}$ it might seem that its momentum must be known exactly too.  But because momentum is squared in the equation, its momentum can be either positive or negative.  The particle could be moving to the left or right.  In the ground state
$$ p = \pm \sqrt{2m E_1} = \pm \frac{\pi\hbar}{L}. $$
We can approximate the momentum uncertainty as
$$\Delta p \approx \frac{\pi\hbar}{L}$$
(again, the Wikipedia article works it out exactly)
Using our approximations:
$$\Delta x\, \Delta p \approx \pi \hbar \ge \frac{\hbar}{2}$$
The size of the box $L$ cancelled out.  It doesn't matter how small the box is the uncertainty relation holds.
In the energy equation we can see that if we decrease $L$, the minimum energy increases.  This in turn increases the momentum uncertainty.  When we decrease the position uncertainty the momentum uncertainty grows to compensate.
As others point out, there is an energy cost to shrinking the box.  To decrease $L$, we must increase the energy of the particle.  As $L$ gets smaller and smaller, the energy cost blows up.  It would take an infinite amount of energy to decrease $L$ to zero.  We just can't do it.
a photon in a box
The same idea holds for a photon.
The infinite square well is a perfectly reflective box.
The photon wavefunction is a standing wave for the energy eigenstates, so $L = \frac{n}{2}\lambda_n$.
The energy eigenstates are
$$E_n = \hbar \omega_n = \frac{2\pi\hbar c}{\lambda_n} = n \frac{\pi \hbar c}{L}$$
We use the relativistic relation between the energy and momentum of a particle.  For a massless photon, we see
$$E^2 = p^2 c^2 + m^2 c^4 \quad\implies\quad E = \pm pc.$$
We have the same direction ambiguity in the momentum associated with an energy eigenstate of the photon.
In fact using our simple approximation, we get the same
$$\Delta x \approx L \quad\text{and}\quad \Delta p \approx \frac{\pi\hbar}{L}$$
in the ground state!
A: I will add yet another answer, which would be the most accurate to your description of a laser beam bouncing between 2 mirrors (if starting from "macro" distances), albeit my lack of time will make my answer non-exhaustive.
What you describe is none other than a fabry-perot interferometer, or a resonator. In this case, within the mirror walls, the only allowed wavelengths are those which are a multiple of $2L$ where $L$ is the distance between the mirrors. All other wavelengths are radiated out of the cavity due to destructive interference inside and constructive outside. Which means that with whichever photon frequency with which you start, if first in resonance, as you move the mirrors, it will immediately leak out of your cavity (in the case of really high-finesse resonator or reflectivity approaching 100%).
Also, in other words, the shortest you can confine a photon in a resonator, is a resonator that has half the wavelength's size. Smaller and it will always leak out.
The (complex) wave characteristic of electric fields wins in this scenario, so it is not possible to slowly spatially confine a laser of frequency $\nu$ inside a cavity.
A: A similar experiment is what I call quantum fly. The classical fly problem is well known:

From point A and point B two trains depart simultaneously towards each other along the same track with speeds $u_A,u_B$. A fly starts at the windschield of train A, flies towards the windschield of train B at speed $v$, turns back towards train A, and so on, till it is squashed by the two colliding trains. What is the distance covered by fly?

In quantum case we are talking about a potential well, the walls of which collapse, and an electron in this well. What will happen to it?
Of course, it depends on the details of the problem, but a few things can be conjectured immediately:

*

*As we know from the solution for the time-independent well, if it is too narrow, its levels will become separated by greater and greater energy. If the well is finite, it will end up with no bound state in it. i.e., electron will be ejected - the fly doesn't die!

*From time-dependent perturbation theory we may also conjecture that the trains will add energy to the electron, as it is excited to higher and higher energy states. If the well is infinite, it will eventually get excited to infinitely high energy.

And so on. Note that much of this reasoning can be adapted for a photon in a shrinking cavity.
Remark on Heisenberg uncertainty relations
Note that, if the walls are truly infinitely high, the uncertainty relation does not depend on the width of the well (see this answer for full derivation):
$$
\sigma_x\sigma_p=\frac{\hbar}{2}\sqrt{\frac{6\pi^2n^2-1}{3}}
$$
Indeed, while the collapsing walls localize the particle, making its momentum more certain, the uncertainty in the momentum actually grows as
$$
\sigma_p=\frac{\pi\hbar n}{L}
$$
