Confusion about the boundary condition of rectangular potential barrier in Quantum Mechanics

In the book Quantum Mechanics by N. Zettili (page 224, 2nd edittion), the potential $$V(x)$$ is defined as: $$V(x) = \begin{cases} 0 & ; \,x \lt 0 \\ V_0 & ; \, 0 \le x \le a \\ 0 & ; \, x \gt a \\ \end{cases}$$ For the case $$E \gt V_0$$, the wave functions in the regions: $$\psi(x) = \begin{cases} \psi_1(x)=Ae^{ik_1x}+Be^{-ik_1x} & ; \,x \le 0 \\ \psi_2(x)=Ce^{ik_2x}+De^{-ik_2x} & ; \, 0 \lt x \lt a \\ \psi_3(x)=Ee^{ik_1x} & ; \, x \ge a \\ \end{cases}$$

How does the case ($$0 \le x \le a)$$ of $$V(x)$$ correspond to the case ($$0 \lt x \lt a$$) of $$\psi(x)$$? How is the equality sign moves to the first and third regions? Why and how does the domain condition change?

Some books like Griffiths and also on Wikipedia, I don't find any equal sign there.
The three cases are given for: (i) $$x \lt 0$$ (ii) $$0 \lt x \lt a$$ (iii) $$x>a$$.

Don't we need to include $$x=0$$ and $$x=a$$ ? If not, then how can be the four boundary conditions applied on the wavefunction $$\psi(x)$$?
What am I missing? I am really confused.
TIA

• In general one requires the wave function to be continuous everywhere. Hence by gluing the solutions in the different regions together you effectively remove this problem. – NDewolf Mar 12 at 14:56
• Yes, I know it. But it doesn't clear my confusion. – raf Mar 12 at 15:12
• It sounds like people were careless about the boundaries. Nothing deep here. Because the solution must be continuous, the functions on both sides of a boundary point give the same value. So it doesn't matter which function you use at the boundary. So people didn't worry about it. – mmesser314 Mar 12 at 15:21
• Can it be written as: $$V(x) = \begin{cases} 0 & ; \,x \le 0 \\ V_0 & ; \, 0 \le x \le a \\ 0 & ; \, x \ge a \\ \end{cases}$$ $$\psi(x) = \begin{cases} \psi_1(x)=Ae^{ik_1x}+Be^{-ik_1x} & ; \,x \le 0 \\ \psi_2(x)=Ce^{ik_2x}+De^{-ik_2x} & ; \, 0 \le x \le a \\ \psi_3(x)=Ee^{ik_1x} & ; \, x \ge a \\ \end{cases}$$ ? – raf Mar 12 at 15:38
• @raf That's not correct. You're assigning two different values to $V(x)$ both at $x=0$ and $x=a$, in that way it's not a function. You can't have all of the domains be closed, if one is closed the next one should be open. – user137661 Mar 12 at 15:46

The boundary conditions demand continuity of the wave function and its derivative at the boundary. For example, for $$x=0$$ we need to have $$$$\psi_1(x) = \psi_2(x), \psi_1'(x) = \psi_2'(x).$$$$ This means that both(!!) $$\psi_1(x)$$ and $$\psi_2(x)$$ are defined at this point (and equal)!
• So, can it be written as: $$V(x) = \begin{cases} 0 & ; \,x \le 0 \\ V_0 & ; \, 0 \le x \le a \\ 0 & ; \, x \ge a \\ \end{cases}$$ $$\psi(x) = \begin{cases} \psi_1(x)=Ae^{ik_1x}+Be^{-ik_1x} & ; \,x \le 0 \\ \psi_2(x)=Ce^{ik_2x}+De^{-ik_2x} & ; \, 0 \le x \le a \\ \psi_3(x)=Ee^{ik_1x} & ; \, x \ge a \\ \end{cases}$$ ? – raf Mar 12 at 15:36
• The potential should not have the overlapping conditions (otherwise $V_0$ has to be 0). – NDewolf Mar 12 at 15:37