Following partial differential equation
$\frac{1}{2 m}\left[\frac{\partial S}{\partial q}\right]^{2}+\frac{1}{2} k q^{2}+\frac{\partial S}{\partial t}=0$
is solved by substituting
$S=S_{1}(q)+S_{2}(t)$
I couldn't understand motivation behind this substitution, can somebody point out?