Using the "natural" coordinate x=x/L and natural energy, , the Schroedinger equation of the PIB is . Now, wave functions are required to be "well behaved"; usually that means that (a) y is finite, differentiable (at least through first order), and continuous, (b) also must be continuous (except possibly at a finite number of points). Our goal is to solve this second order DE subject to these conditions.
Outside the box, where the potential is infinite, the left hand side of the DE is infinite (y and derivatives of y are finite). The only way this is possible is for y to vanish; the PIB wave function is zero outside the box. Inside the box, where the potential is zero, the solution is with n an integer. Here, the argument of the sine function is chosen to satisfy the boundary conditions, y(1) = 0 (y(0) = 0 puts no restrition on the argument). Corresponding to yn(x) is the eigenvalue e = n2.