eqn = {x''[t] + w^2*x[t] == 0, y[t] == x'[t]}; w = 1;
sol = DSolve[eqn, {x[t], y[t]}, t];
xt[t_] = Flatten[x[t] /. sol /. {C[1] -> 1, C[2] -> 1}][[1]];
yt[t_] = Flatten[y[t] /. sol /. {C[1] -> 1, C[2] -> 1}][[1]];
yx[x_] = yt[InverseFunction[Function[{a}, xt[a]]][x]];
Plot[yx[x], {x, -0.5, 0.5}, AspectRatio -> Automatic,
PlotRange -> All]
Show[ParametricPlot[
Evaluate[{x[t], y[t]} /. First[sol] /. {C[1] -> 1, C[2] -> 1}], {t,
0, 10}],
Plot[yx[x], {x, -0.5, 0.5}, AspectRatio -> Automatic,
PlotStyle -> Red]]