Continuity Conditions (QM)

Answer
first boundary conditions are that $psi(-L)$ and $psi(L)$ are continuous in $-L$ and $+L$
$psi(-L) = 0$ when $x -> -L$ from left and $psi(L) = 0$ when $x -> +L$ from the right
$psi(-L) = A*exp(-i K L) + B*exp(+i K L)$ when $x -> -L$ from right
$psi(L) = A*exp(i K L) +B*exp(-i K L)$ when $x -> +L$ from the left
$A*exp(-i K L) +B*exp(i K L) = 0$
$A*exp(i K L) +B*exp(-i K L) =0$
summing
$A*(exp(i K L) +exp(-i K L)) +B(exp(i K L)*exp(-i K L)) =0$
or $A+B =0$ because exponential is never zero
$psi(x) = A*(exp(i k x) – exp(-i k x)) = 2A*sin(k x)$
at $+L$ and $-L$ one has again
$0 = 2A*sin(2KL)$
$0= 2A*sin(-2KL)$
and from the above one sees that K is restricted to a certain number of values k(n) for which
$k(n) = n*pi/L$
hence $n*pi/L = sqrt{2mE/hbar}$
and $E(n) = n^2*hbar^2*pi^2/(2mL^2)$
For part B)
$K_1 = pi/L$ , $K_2=2pi/L$ , $K_3 =3pi/L$
$psi1(x) = 2A*sin(pi*x/L)$
$psi2(x) =2A*sin(2*pi/L)$
$psi3(x) = 2A*sin(3*pi/L)$