Since, u''=-u
A function differentiated twice gives the negative of the same function, so it can be either A*cosine(bx) or B*sine(bx). By principle of superposition of the results (which is saying if two solutions are there bundle them up together)... u(x)=A cos (bx) + B sin (bx)