Tag Archives: particle in a box

Infinite square well – expanding well

References: Shankar, R. (1994), Principles of Quantum Mechanics, Plenum Press. Section 5.2, Exercise 5.2.1.

Shankar’s treatment of the infinite square well is similar to that of Griffiths, which we’ve already covered, so we won’t go through the details again. The main difference is that Shankar places the potential walls at {x=\pm\frac{L}{2}} while Griffiths places them at {x=0} and {x=a}. As a result, the stationary states found by Shankar are shifted to the left, with the result

\displaystyle  \psi_{n}\left(x\right)=\begin{cases} \sqrt{\frac{2}{L}}\cos\frac{n\pi x}{L} & n=1,3,5,7,\ldots\\ \sqrt{\frac{2}{L}}\sin\frac{n\pi x}{L} & n=2,4,6,\ldots \end{cases} \ \ \ \ \ (1)

These results can be obtained from the form given by Griffiths (where we take the width of the well to be {L} rather than {a}):

\displaystyle   \psi_{n}\left(x\right) \displaystyle  = \displaystyle  \sqrt{\frac{2}{L}}\sin\frac{n\pi\left(x+\frac{L}{2}\right)}{L}\ \ \ \ \ (2)
\displaystyle  \displaystyle  = \displaystyle  \sqrt{\frac{2}{L}}\left[\sin\frac{n\pi x}{L}\cos\frac{n\pi}{2}+\cos\frac{n\pi x}{L}\sin\frac{n\pi}{2}\right] \ \ \ \ \ (3)

Choosing {n} to be even or odd gives the results in 1.

The specific problem we’re solving here involves a particle that starts off in the ground state ({n=1}) of a square well of width {L}. The well then suddenly expands to a width of {2L} symmetrically, that is, it now extends from {x=-L} to {x=+L}. We are to find the probability that the particle will be found in the ground state of the new well.

We solved a similar problem before, but in that case the well expanded by moving its right-hand wall to the right while keeping the left-hand wall fixed, so that the particle found itself in the left half of the new, expanded well. In the present problem, the particle finds itself centred in the new expanded well. You might think that this shouldn’t matter, but it turns out to make quite a difference. To calculate this probability, we need to express the original wave function in terms of the stationary states of the expanded well, which we’ll refer to as {\phi_{n}\left(x\right)}. That is

\displaystyle  \psi_{1}\left(x\right)=\sum_{n=1}^{\infty}c_{n}\phi_{n}\left(x\right) \ \ \ \ \ (4)

Working with Shankar’s functions 1 we find {\phi_{n}} by replacing {L} by {2L}:

\displaystyle  \phi_{n}\left(x\right)=\begin{cases} \frac{1}{\sqrt{L}}\cos\frac{n\pi x}{2L} & n=1,3,5,7,\ldots\\ \frac{1}{\sqrt{L}}\sin\frac{n\pi x}{2L} & n=2,4,6,\ldots \end{cases} \ \ \ \ \ (5)

Using the orthonormality of the wave functions, we have

\displaystyle   c_{1} \displaystyle  = \displaystyle  \int_{-L}^{L}\psi_{1}\left(x\right)\phi_{1}\left(x\right)dx\ \ \ \ \ (6)
\displaystyle  \displaystyle  = \displaystyle  \int_{-L/2}^{L/2}\sqrt{\frac{2}{L}}\cos\frac{\pi x}{L}\frac{1}{\sqrt{L}}\cos\frac{\pi x}{2L}dx\ \ \ \ \ (7)
\displaystyle  \displaystyle  = \displaystyle  \frac{\sqrt{2}}{L}\int_{-L/2}^{L/2}\cos\frac{\pi x}{L}\cos\frac{\pi x}{2L}dx\ \ \ \ \ (8)
\displaystyle  \displaystyle  = \displaystyle  \frac{\sqrt{2}}{L}\int_{-L/2}^{L/2}\left(1-2\sin^{2}\frac{\pi x}{2L}\right)\cos\frac{\pi x}{2L}dx\ \ \ \ \ (9)
\displaystyle  \displaystyle  = \displaystyle  \frac{8}{3\pi} \ \ \ \ \ (10)

The limits of integration are reduced in the second line since {\psi_{1}\left(x\right)=0} if {x>\left|\frac{L}{2}\right|}.

Thus the probability of finding the particle in the new ground state is

\displaystyle  \left|c_{1}\right|^{2}=\frac{64}{9\pi^{2}} \ \ \ \ \ (11)

Note that in the earlier problem where the well expanded to the right, the probability was {\frac{32}{9\pi^{2}}}, so the new probability is twice as much when the wave function remains centred in the new well.

We could have also done the calculation using Griffiths’s well which extended from {x=0} to {x=L}. If this well expands symmetrically, it now runs from {x=-\frac{L}{2}} to {x=\frac{3L}{2}}, and the stationary states of this new well are obtained by replacing {L\rightarrow2L} and {x\rightarrow x+\frac{L}{2}}, so we have

\displaystyle  \phi_{n}\left(x\right)=\frac{1}{\sqrt{L}}\sin\frac{n\pi\left(x+\frac{L}{2}\right)}{2L} \ \ \ \ \ (12)

We then get

\displaystyle   c_{1} \displaystyle  = \displaystyle  \int_{-L/2}^{3L/2}\psi_{1}\left(x\right)\phi_{1}\left(x\right)dx\ \ \ \ \ (13)
\displaystyle  \displaystyle  = \displaystyle  \frac{\sqrt{2}}{L}\int_{0}^{L}\sin\frac{\pi x}{L}\sin\frac{\pi\left(x+\frac{L}{2}\right)}{2L}dx\ \ \ \ \ (14)
\displaystyle  \displaystyle  = \displaystyle  \frac{8}{3\pi} \ \ \ \ \ (15)

The integral can be done by expanding the second sine using the sine addition formula. (I just used Maple.)

Infinite square well in three dimensions

Required math: calculus

Required physics: Schrödinger equation

References: Griffiths, David J. (2005), Introduction to Quantum Mechanics, 2nd Edition; Pearson Education – Problem 4.2.

Shankar, R. (1994), Principles of Quantum Mechanics, Plenum Press. Chapter 10, Exercise 10.2.1.

The three-dimensional particle in a box problem is a fairly straightforward extension of the one dimensional case. The 3-d time-independent Schrödinger equation in rectangular coordinates is

\displaystyle  -\frac{\hbar^{2}}{2m}\nabla^{2}\psi=E\psi \ \ \ \ \ (1)

Using separation of variables, we can assume that the spatial wave function is the product of three individual functions, each dependent on only one spatial coordinate:

\displaystyle  \psi(\mathbf{r})=\xi(x)\eta(y)\zeta(z) \ \ \ \ \ (2)

Plugging this into the 3-d Schrödinger equation and dividing through by {\xi(x)\eta(y)\zeta(z)} gives

\displaystyle  -\frac{\hbar^{2}}{2m}\left(\frac{\xi_{xx}}{\xi}+\frac{\eta_{yy}}{\eta}+\frac{\zeta_{zz}}{\zeta}\right)=E \ \ \ \ \ (3)


where a subscript indicates a derivative with respect to that variable, so {\xi_{xx}=d^{2}\xi/dx^{2}} etc.

Since {E} is a constant (independent of position), and each term in the sum depends on a different independent variable, each term in the sum must itself be a constant. In order to be able to use the analysis from the one-dimensional case, we therefore introduce three constants {k_{x}}, {k_{y}} and {k_{z}} so that

\displaystyle   \xi_{xx} \displaystyle  = \displaystyle  -k_{x}^{2}\xi\ \ \ \ \ (4)
\displaystyle  \eta_{yy} \displaystyle  = \displaystyle  -k_{y}^{2}\eta\ \ \ \ \ (5)
\displaystyle  \zeta_{zz} \displaystyle  = \displaystyle  -k_{z}^{2}\zeta \ \ \ \ \ (6)

From 3 the constants satisify the condition:

\displaystyle  k_{x}^{2}+k_{y}^{2}+k_{z}^{2}=\frac{2mE}{\hbar^{2}} \ \ \ \ \ (7)

From here, we can use the analysis of the infinite square well in one dimension, to get:

\displaystyle   \xi(x) \displaystyle  = \displaystyle  \sqrt{\frac{2}{a}}\sin\frac{n_{x}\pi}{a}x\ \ \ \ \ (8)
\displaystyle  \eta(y) \displaystyle  = \displaystyle  \sqrt{\frac{2}{a}}\sin\frac{n_{y}\pi}{a}y\ \ \ \ \ (9)
\displaystyle  \zeta(z) \displaystyle  = \displaystyle  \sqrt{\frac{2}{a}}\sin\frac{n_{z}\pi}{a}z \ \ \ \ \ (10)

where each of {n_{x}}, {n_{y}} and {n_{z}} can take any positive integer value. From 7, the energies are given by

\displaystyle  E_{i}=\frac{\pi^{2}\hbar^{2}}{2ma^{2}}(n_{x}^{2}+n_{y}^{2}+n_{z}^{2}) \ \ \ \ \ (11)

The various energies can be found by listing the values of {n_{x}}, {n_{y}} and {n_{z}} such that the sums {n_{x}^{2}+n_{y}^{2}+n_{z}^{2}} are listed in ascending order. The degeneracy of each combination of {n}s can be found by noting that if all three {n}s are the same, the degeneracy is 1, if two are the same, the degeneracy is 3, and if all three are different, the degeneracy is 6. Thus in the following table, we list only one combination of {n}s for each degenerate set. The energies are given in units of {\frac{\pi^{2}\hbar^{2}}{2ma^{2}}}

{n_{x}} {n_{y}} {n_{z}} Energy Degeneracy
1 1 1 {E_{1}=3} 1
2 1 1 {E_{2}=6} 3
2 2 1 {E_{3}=9} 3
3 1 1 {E_{4}=11} 3
2 2 2 {E_{5}=12} 1
3 2 1 {E_{6}=14} 6
3 2 2 {E_{7}=17} 3
4 1 1 {E_{8}=18} 3
3 3 1 {E_{9}=19} 3
4 2 1 {E_{10}=21} 6
3 3 2 {E_{11}=22} 3
4 2 2 {E_{12}=24} 3
4 3 1 {E_{13}=26} 6
3 3 3 {E_{14}=27} 4
5 1 1

The case of {E_{14}} has a degeneracy of 4, since it can arise from two distinct combinations of {n}s, as shown. It’s an interesting question as to whether this case is unique. Not obvious from a superficial analysis how this could be proved one way or the other.

Energy states: bound and scattering states

Required math: calculus

Required physics: energy, quantum mechanics basics

Reference: Griffiths, David J. (2005), Introduction to Quantum Mechanics, 2nd Edition; Pearson Education – Sec. 2.5.1.

In classical physics, a particle’s energy consists of kinetic and potential energy, the sum of which is a constant, provided we have accounted for all the forces acting on the system. For example, in the simple harmonic oscillator system (mass on a spring), the kinetic energy is given, as usual, by the term {\frac{1}{2}mv^{2}} and the potential energy by {\frac{1}{2}kx^{2}} where {k} is a constant that measures the strength of the force and {x} is the particle’s displacement from equilibrium. The particle’s total energy is

\displaystyle  E=\frac{1}{2}mv^{2}+\frac{1}{2}kx^{2} \ \ \ \ \ (1)

which is a constant, provided that the spring is the only force acting on the particle.

In classical physics, this energy can take any positive value (although in practice, of course, any real spring would break down if stretched too far, so there are limits, but we’re considering the ideal case).

In quantum physics, the particle is represented by a wave function which is found as the solution to the Schrödinger equation. For the harmonic oscillator, the mathematics required to solve the equation is non-trivial, but one outcome of the analysis is that the allowed energies of the particle are discrete or quantized, and must be one of {E=(n+\frac{1}{2})\hbar\omega} where {\omega=\sqrt{k/m}} is the frequency of oscillation and {n=0,1,2,3,\ldots}.

We find a similar situation in other cases where the potential function creates a well in which the particle must move. The harmonic oscillator potential is {V(x)=\frac{1}{2}kx^{2}}, and is a parabola that goes to infinity in both directions. The particle in a box potential (or infinite square well) has infinitely high walls at the ends of a fixed interval. Any such potential in which there is an infinitely high barrier in both directions results in quantized, rather than continuous, energy levels in quantum mechanics.

It would be nice to get some sort of physical intuition as to why this happens. We can hide behind the mathematics and say “that’s what the equations tell us”, but a better explanation should be possible.

Ultimately it comes down to the fact that solutions of the Schrödinger equation in regions where the total energy is greater than the potential function are, in some sense, waves. In classical physics, a particle is just a particle: it is a point-sized bit of matter that can rattle around inside a potential well and it has no wave-like properties at all. The wave properties of a quantum particle, however, mean that it has an extent larger than a geometric point. Trying to confine a wave inside a well means that the wave will interact with the boundaries of the well, and it is these boundary conditions that impose restrictions on what types of wave can exist inside a potential well.

If we have a particle in a box, where the ends of the box are absolute barriers that are infinitely high, then there is no probability of the particle existing outside the boundaries of the box. Since the particle’s wave function measures this probability, it has to be zero at the boundaries of the box, so that effectively pins down the particle at both ends. The fact that the wave function (in the case of the infinite square well) is a pure sine wave means that only those waves that go to zero at the ends of the box are permissible solutions, which in turn means that only multiples of half a full cycle of the sine wave are allowed as solutions, and since the energy of the particle is related to its wavelength, this requirement in turn puts restrictions on the allowable energies. That is, it is the act of confining the particle that results in the quantization of its energy, and the reason that confining the particle has this effect is that that particle is defined by a wave function. So ultimately it is the wave nature of the particle that causes the quantization.

For potentials which go to infinity gradually (such as the harmonic oscillator) rather than abruptly (like the infinite square well), the particle is still being confined, but in a box with soft end points rather than hard ones. The wave is allowed to penetrate slightly into the barriers rather than be reflected from a hard surface, so it’s a bit like building a box with spongy walls rather than steel ones. There is a small chance that the particle can be found outside the end points of the box, but ultimately we are still confining the particle within a box. Going further with a qualitative description doesn’t help much, but we need to recognize that because the particle is still a wave, confining it within any type of box, no matter what type of endpoints the box has, will result in only certain wave functions being allowed. So ultimately it’s the boundary conditions that result in quantization of energy.

What happens if the potential does not go to infinity at some point? In that case, it is possible for the total energy of a particle to be greater than the maximum potential energy, which means that it is not restricted within a box. In that case, there is no restriction on energy levels of the particle, and in both the classical and quantum cases, the allowed energy levels are not quantized. In the quantum case, the particle still retains its wave-like qualities, but since the wave is not restricted by any barriers, there is no restriction on the allowable wavelengths, and thus, on the energies. The simplest example of such a case is that of the free particle, where a particle moves without any forces acting on it.

It should be added that potentials that don’t go to infinity at both ends can still give rise to bound states, if the total energy is less than the maximum value of the potential. The point is that for a potential that is finite everywhere, any total energy that is greater than the maximum of the potential is possible, and these states are scattering states. For a potential that goes to infinity at both ends, only bound, quantized states are possible.

This is not to say that a particle whose total energy is greater than the maximum potential energy is unaffected by the presence of the potential, however. If a particle, represented as a wave, travels in from the left (say) and encounters a potential barrier (or in fact, any change in the potential) at some point, then if the energy of the particle is greater than the barrier, there will be both reflected and transmitted components of the wave function past that point. Note that this doesn’t mean that the particle splits in two, with half of it being reflected and the other half transmitted. Rather, it is the wave function that effectively splits, and since the wave function is a measure of the probability of finding the particle at a given place and time, this means that there is now a certain probability that the particle (all of it!) will get reflected by the potential barrier, and another probability that it will get transmitted and proceed beyond the barrier.

A similar effect can be seen with classical wave physics. For example, if you watch the wave patterns on the surface of the sea at a point near the shore where the level of the seabed changes you will see changes in the surface waves as they move over the seabed. Even if there are no abrupt changes in the seabed (for example, if you are on a gradually sloping sandy beach), the waves will change form as the depth of the water varies. It is for this reason that waves will eventually tip over and ‘break’ as they near the shore.

These two types of quantum states are known as bound states (for states that are quantized, and in which the energy is constrained by a potential well that is infinite at both ends) and scattering states (for states where the potential fails to reach infinite height in either one or both directions).

The infinite square well (particle in a box)

Required math: calculus

Required physics: time-independent Schrödinger equation

Reference: Griffiths, David J. (2005), Introduction to Quantum Mechanics, 2nd Edition; Pearson Education – Sec 2.2.

Shankar, R. (1994), Principles of Quantum Mechanics, Plenum Press. Section 5.2, Exercise 5.2.5.

To get the feel of how to solve the time-independent Schrödinger equation in one dimension, the most commonly used example is that of the infinite square well, sometimes known as the ‘particle in a box’ problem. First, recall the Schrödinger equation itself:

\displaystyle   -\frac{\hbar^{2}}{2m}\frac{\partial^{2}\Psi}{\partial x^{2}}+V(x)\Psi \displaystyle  = \displaystyle  i\hbar\frac{\partial\Psi}{\partial t} \ \ \ \ \ (1)

Remember that the ‘time-independent’ bit refers to the potential function {V} which is taken to be a function of position only; the wave function itself, which is the solution of the equation, will in general be time-dependent.

The infinite square well is defined by a potential function as follows:

\displaystyle  V(x)=\begin{cases} 0 & 0<x<a\\ \infty & \mathrm{otherwise} \end{cases} \ \ \ \ \ (2)

An area with an infinite potential means simply that the particle is not allowed to exist there. In classical physics, you can think of an infinite potential as an infinitely high wall, which no matter how much kinetic energy a particle has, it can never leap over. Although examples from classical physics frequently break down when applied to quantum mechanics, in this case, the comparison is still valid: an infinitely high potential barrier is an absolute barrier to a particle in both cases.

We saw in our study of the time independent Schrödinger equation that separation of variables reduces the problem to solving the spatial part of the equation, which is

\displaystyle   -\frac{\hbar^{2}}{2m}\frac{d^{2}\psi}{dx^{2}}+V(x)\psi \displaystyle  = \displaystyle  E\psi \ \ \ \ \ (3)

where the constant {E} represents the possible energies that the system can have. It is important to note that both {E} and {V(x)} are unknown before we solve the equation. In classical physics, we would be allowed to specify {E} since it is just the kinetic energy that the particle has inside the well. Classically, {E} can be any positive quantity, and the particle would just bounce around inside the well without ever changing its speed (assuming the walls were perfectly elastic and there was no friction). In quantum physics, as we will see, {E} can have only certain discrete values, and these values arise in the course of solving the equation.

In an infinite square well, the infinite value that the potential has outside the well means that there is zero chance that the particle can ever be found in that region. Since the probability density for finding the particle at a given location is {|\Psi|^{2}}, this condition can be represented in the mathematics by requiring {\psi(x)=0} if {x<0} or {x>a}. This condition is forced from the Schrödinger equation since if {V(x)=\infty}, any non-zero value for {\psi(x)} would result in an infinite term in the equation. However, it is certainly not rigorous mathematics, since multiplying infinity by zero can be done properly only by using a limiting procedure, which we haven’t done here. A proper treatment of the infinite square well is as a limiting case of the finite square well, where {V(x)} can have a large but finite value outside the well. However, the mathematics for solving the finite square well is considerably more complicated and tends to obscure the physics. Readers who are worried, however, can be reassured that the energy levels in the finite square well do become those in the infinite square well when the proper limit is taken.

Inside the well, {V(x)=0} so the Schrödinger equation becomes

\displaystyle   -\frac{\hbar^{2}}{2m}\frac{d^{2}\psi}{dx^{2}} \displaystyle  = \displaystyle  E\psi\ \ \ \ \ (4)
\displaystyle  \frac{d^{2}\psi}{dx^{2}} \displaystyle  = \displaystyle  -k^{2}\psi\ \ \ \ \ (5)
\displaystyle  \mathrm{with\;}k \displaystyle  \equiv \displaystyle  \frac{\sqrt{2mE}}{\hbar} \ \ \ \ \ (6)

This differential equation has the general solution

\displaystyle   \psi(x) \displaystyle  = \displaystyle  A\sin(kx)+B\cos(kx) \ \ \ \ \ (7)

for unspecified (yet) constants {A} and {B}. If you don’t believe this, just substitute the solution back into the equation.

How can we determine {A} and {B}? To do this, we need to appeal to Born’s conditions on the wave function. Born’s first condition is clearly satisfied here: {\psi} is single-valued. The second condition of {\psi} being square integrable we’ll leave for a minute. The third condition is that {\psi} must be continuous. We have argued above that {\psi=0} outside the well, so in particular, this means that at the boundaries {x=0} and {x=a} we must have {\psi=0}. If we impose that condition on our general solution above, we get:

\displaystyle   \psi(0) \displaystyle  = \displaystyle  0\ \ \ \ \ (8)
\displaystyle  A\sin(0)+B\cos(0) \displaystyle  = \displaystyle  0\ \ \ \ \ (9)
\displaystyle  B \displaystyle  = \displaystyle  0\ \ \ \ \ (10)
\displaystyle  \psi(a) \displaystyle  = \displaystyle  0\ \ \ \ \ (11)
\displaystyle  A\sin(ka) \displaystyle  = \displaystyle  0\ \ \ \ \ (12)
\displaystyle  ka \displaystyle  = \displaystyle  n\pi\ \ \ \ \ (13)
\displaystyle  \frac{\sqrt{2mE}}{\hbar} \displaystyle  = \displaystyle  \frac{n\pi}{a}\ \ \ \ \ (14)
\displaystyle  E \displaystyle  = \displaystyle  \frac{n^{2}\pi^{2}\hbar^{2}}{2ma^{2}} \ \ \ \ \ (15)

where {n} is an integer. The useful values of {n} are just the positive integers. To see this, note that if {n=0}, then {\psi(x)=0} everywhere which besides being very boring, is also no good as a probability density since its square modulus cannot integrate to 1. Negative integers don’t really give new solutions, since {\sin(-x)=-\sin x,} so the negative sign can be absorbed into the (still undetermined) constant {A}. Also, the energies depend only on the square of {n} so the sign of {n} doesn’t matter physically.

We can now return to the square-integrable condition and use it to determine {A}. Remember that the integral is over all space in which the particle can be found, so in this case we are interested in {0\le x\le a}.

\displaystyle   \int_{0}^{a}|\psi|^{2}dx \displaystyle  = \displaystyle  1\ \ \ \ \ (16)
\displaystyle  A^{2}\int_{0}^{a}\sin^{2}kx \displaystyle  = \displaystyle  1\ \ \ \ \ (17)
\displaystyle  \displaystyle  = \displaystyle  A^{2}\frac{1}{2}\int_{0}^{a}\left[1-\cos\left(2kx\right)\right]dx\ \ \ \ \ (18)
\displaystyle  \displaystyle  = \displaystyle  \frac{A^{2}}{2}\left[x-\frac{1}{2k}\sin\left(2kx\right)\right]_{0}^{a}\ \ \ \ \ (19)
\displaystyle  \displaystyle  = \displaystyle  A^{2}\frac{a}{2}\ \ \ \ \ (20)
\displaystyle  A \displaystyle  = \displaystyle  \pm\sqrt{\frac{2}{a}} \ \ \ \ \ (21)

where we used 13 in 19 to eliminate the sine term.

Since it is only the square modulus of the wave function that has physical significance, we can ignore the negative root and take the final form of the wave function as

\displaystyle   \psi(x) \displaystyle  = \displaystyle  \sqrt{\frac{2}{a}}\sin\frac{n\pi x}{a} \ \ \ \ \ (22)

Notice what has happened here. Applying the first boundary condition at {x=0} allowed us to eliminate {B}. But the other boundary condition at {x=a} ended up giving us a condition on {E} rather than {A}. (Well, ok, we could have used the second boundary condition to set {A=0} but then we would have {\psi(x)=0} everywhere again.) Not only that, but the energy levels are discrete; thus the infinite square well is the first case in which the Schrödinger equation has actually predicted quantization in a system.

So the boundary conditions on the differential equation have put restrictions on the allowable energies. The acceptable solutions for {\psi} are determined by the condition {ka=n\pi} and so the various {\psi} functions are just lobes of the sine function. The lowest energy, called the ground state, occurs when {n=1} and {\psi} is half a sine wave, consisting of the bit between {x=0} and {x=\pi}. The next state at {n=2} corresponds to a single complete cycle of the sine wave; {n=3} contains 1.5 cycles and so on.

Eagle-eyed readers will have noticed that in all the excitement over discovering quantization, we have neglected to look at Born’s fourth condition: that of continuous first derivatives. Clearly this condition is violated, since the derivative of {\psi} outside the well is 0 (since {\psi=0} outside the well), but inside the derivative is {kA\cos(kx),}which is {kA} at {x=0} and {\pm kA} at {x=a} (the sign depends on whether {n} is odd or even). Neither of these derivatives is zero.

The reason is, of course, because of the infinite potential function which is not physically realistic. In fact, what happens in the (real-world) finite square well is that the wave function inside the potential barrier (that is, just off the ends of the well) is not zero, but a decaying exponential which tends to zero the further into the barrier you go. In that case, it is possible to make both the wave function and its first derivative continuous at both ends of the well (and it is precisely that condition which makes the mathematics so much more complicated in the finite square well).

In fact, this effect happens in any potential where the energy of the particle is less than that of a (finite) potential barrier: the particle’s wave function extends into the barrier region. So does that mean that the particle has a probability of appearing inside a barrier? Technically yes, but in practice it usually doesn’t do the particle much good, since the probability of being outside the barrier is usually a lot greater. However, there is one case where this barrier penetration effect does occur, and that is if the barrier is thin enough for the wave function to have a significant magnitude on the other side of the barrier. That is, if we have a particle in a finite well, but the wall of the well is fairly thin and there is another well (or just open space) on the other side of the barrier, then the wave function starts off with a respectable magnitude inside the main well, extends into the barrier (but gets attentuated exponentially in doing so), but before the attenuation gets so severe that the wave function becomes very small, it bursts through to the other side of the barrier. That means that, yes, there is a definite probability that the particle can spontaneously appear outside the well without having to jump over the barrier. In effect, it tunnels through the barrier and escapes. The effect, not surprisingly, is known as quantum tunneling and is one of the main causes of some forms of radioactive decay. But that’s a topic for another post.