Differentiate this equation, q=qpcosωt to find the current in the LC circuit, and use q=CV to find the voltage. From these obtain the magnetic energy in the inductor and the electric energy in the capacitor, and sum to show that the total energy remains constant.