Answer
$$\eqalign{
& \left( {\text{a}} \right)y = \cos x{\text{ and }}y = \sin x{\text{ are solutions of }}y'' + y = 0 \cr
& \left( {\text{b}} \right)y = A\sin x + B\cos x{\text{ is a solution of }}y'' + y = 0 \cr} $$
Work Step by Step
$$\eqalign{
& \left( {\text{a}} \right){\text{Let }}{y_1} = \cos x{\text{ and }}{y_2} = \sin x \cr
& {\text{Compute the derivatives }}{y_1}'{\text{ and }}{y_1}'' \cr
& {y_1} = \cos x \cr
& \,{y_1}' = - \sin x \cr
& \,{y_1}'' = - \cos x \cr
& {\text{Compute the derivatives }}{y_1}'{\text{ and }}{y_1}'' \cr
& {y_2} = \sin x \cr
& {y_2}' = \cos x \cr
& {y_2}'' = - \sin x \cr
& \cr
& {\text{Substitute the derivatives into }}y'' + y = 0 \cr
& {y_1}'' + {y_1} = 0 \cr
& - \cos x + \cos x = 0 \cr
& 0 = 0 \cr
& {y_2}'' + {y_2} = 0 \cr
& - \sin x + \sin x = 0 \cr
& 0 = 0 \cr
& {\text{Then }}y = \cos x{\text{ and }}y = \sin x{\text{ are solutions of }}y'' + y = 0 \cr
& \cr
& \cr
& \left( { - x\sin x + 2\cos x} \right) + x\sin x = 2\cos x \cr
& {\text{Simplify}} \cr
& - x\sin x + 2\cos x + x\sin x = 2\cos x \cr
& 2\cos x = 2\cos x \cr
& {\text{Then }}y = x\sin x{\text{ is a solution of }}y' + y = 2\cos x \cr
& \cr
& \left( {\text{b}} \right){\text{Let }}y = A\sin x + B\cos x \cr
& {\text{Compute }}y'{\text{ }} \cr
& \,y' = A\left( {\cos x} \right) + B\left( { - \sin x} \right) \cr
& \,y' = A\cos x - B\sin x \cr
& and \cr
& \,y'' = A\left( { - \sin x} \right) - B\left( {\cos x} \right) \cr
& \, - A\sin x - B\cos x + A\sin x + B\cos x = 0 \cr
& 0 = 0 \cr} $$