Considering the equations $$ 1 = \left(\frac{dx}{dt}\right)^2 + x^2, ~~~~~~~~~~~~~~\frac{d}{dt}\frac{dx}{dt}=-x$$ I have $\frac{dx}{dt}$ vs $x$ constrained as a circle of radius 1. I want to determine through time how these values change. I do not want to try to solve the differential equation (in general for what I'm doing, the $x^2$ term can be a different function of $x$). So I used Euler's Method: $$\left(\frac{dx}{dt}\right)_n = \left(\frac{dx}{dt}\right)_{n-1} + (-x)dt$$ $$x_n = \sqrt{1 - \left(\frac{dx}{dt}\right)_n^2}$$ where the first equation is just $y_n = y_{n-1} + (dy/dt)dt$ with $dt$ being the step size, and this uses the second equation in the first line. The second equation to find $x$ uses the constraint that the two variables $\frac{dx}{dt}$, $x$ are constrained to a circle. This works fine, except that eventually in time, the $x$ should change signs, which cannot be accounted for since the square root is always positive. Is there something to constrain the value that I'm missing which determines the correct sign at each time step?
I have tried a couple of things: It was suggested I could use that since $x$ is continuous, then $(x_{n} - x_{n-1}) - (x_{n-1} - x_{n-2}) \approx 0$ and so I can solve for $x_n$ and use the sign of that. This didn't seem to work. I have also tried using Euler's method on $x$ itself and used the sign given there (on this note, I am confused how Euler and the circle constraint can give differing results - I feel like something should connect the two). This also did not seem to work.
Additionally, weirdly enough, while the circle equation means that $(\frac{dx}{dt})^2$ is always less than 1, I sometimes get a negative square root. All of these problems tell me that something is going wrong, but I cannot see it and need some extra eyes on this.
More context: I am plotting the trajectory through time in this space of $\frac{dx}{dt}$ vs $x$, starting at some initial condition. I expect the point in time to just revolve along the path of the circle. But for a general function of $x$ I would be able to see the path for different systems. I'm doing this in Python and seeing that there are problems when the point traversing the circle attempts to change sign in $x$. This is how I could find that the solutions I tried above did not work - but actually it may have been a problem of negative square root.