When solving the brachistochrone problem (path of least time for a mass sliding on the path, with the path having no friction, from point A to point B), the solution curves are solved from the following equation (see for example https://www.youtube.com/watch?v=zYOAUG8PxyM&t=587s):
$$ x - x_0 = \int_{y_0}^y \sqrt{\frac{y_0 - y}{C - (y_0 - y)}} dy $$
Here $ (x_0, y_0) $ is the starting position of the mass and $C$ is a constant which satisfies the end position $ (x_1, y_1) $. Typically this equation is solved analytically by the help of new variable $\theta$, but I'm interested in solving it numerically, as I'm trying to later solve harder versions of the brachistochrone problem which are not solvable analytically and I'm practising on this easier case first.
The brachistochrone curve is one that not only goes down but also comes up. This seems like a problem for me, because when you look at the equation above, the right-hand side always gets same value for any given value of $\textbf{y}$. If we take two points of brachistochrone curve which have the same y-value but different x-values (figure below), then for these points the right-hand side of the equation is the same but left-hand side isn't, which is a contradiction. Where am I making a mistake?