My question is that when solving for the kinetic and potential energies at x=3.0cm, why when finding the kinetic energy why do we useA 50.0 g object connected to a spring with a force constant of 35.0 N/m oscillates on a horizontal, friction less surface with amplitude of 4.00 cm. Find the total energy of the system, the speed when x=1.0cm, and calculate the kinetic and potential energies when x =3.0cm

E_{k }+ E_{e }= E_{e}' + E_{k}' (which is the correct method and gives an answer of 12.2 mJ) and not E_{k }+ E_{e + }E_{g}= E_{e}' + E_{k}' + E_{g}', why can we exclude the gravitational energy? (I

and for the potential energy, how do we go about solving for it. I tried using E_{k }+ E_{e + }E_{g}= E_{e}' + E_{k}' + E_{g}' and E_{e +}E_{g}= E_{e}' + E_{g}' to solve but in either case I got the wrong answer (The correct answer is 15.8 mJ)