I am working through Leonard Susskinds 'the theoretical minimum' and one of the exercises is to show that H=ω/2(p^2+q^2).
The given equations are H=1/2mq(dot)^2 + k/2q^2, mq(dot)=p and ω^2=k/m.
q is a generalisation of the space variable x, and (dot) is the time derivative if this helps...