Solving second order ODE oscillator I'm currently just taking my first ODE course and one of the questions is,
A projectile of mass $m$ is fired from the origin at speed $v_0$ and angle $\theta$. It is attached to the origin by a spring with spring constant
$k$ and relaxed length zero. Find $x(t)$ and $y(t)$.
Here's how I went about it:
$X$ direction:
$$m \ddot x = -kx$$
$$\ddot x = -\omega^2x$$
$$\omega = \sqrt{\frac{k}{m}}$$

$$x(t) = \frac{v_0}{w}\sin(\omega t)$$
$Y$-direction:
$$m \ddot y = -ky -mg$$
$$\ddot y = -\omega^2y - g$$
$$\dot v + \omega^2y = g$$
Then the integrating factor $=e^{w^2t}$
$$e^{w^2t}v = \int_{0}^{t} -ge^{w^2t}$$
$$v= -\frac{g}{w^2}$$
$$\dot y = -\frac{g}{w^2}$$
$$ y = -\frac{g}{w^2}t$$
Is this right way to go about this? Any help would greatly appreciated. Thank you.

In fact, the equation can be integrated in vector form.
$$\ddot{\vec r}+\omega^2 \vec r=\vec g$$
has the homogeneous solution
$$\vec r=\vec{c_c}\cos\omega t+\vec{c_s}\sin\omega t$$ and the particular solution $$\vec r=\vec g.$$
Now with the initial conditions,
$$\vec r_0=\vec{c_c}+\vec g=\vec 0,
\\\vec v_0=\omega\vec c_s$$ 
we have
$$\vec r=\vec g-\vec{g}\cos\omega t+\vec{v_0}\frac1{\omega}\sin\omega t.$$
This is an ellipse, inscribed in the parallelogram of vertices
$$\vec g\pm\vec g\pm \vec{v_0}\frac1{\omega}.$$
