I'm trying to numerically reproduce the cycloid solution for the brachistochrone problem. In doing so, I eventually ended up with the following integral:

$$ x = \int{\sqrt{\frac{y}{2a-y}} dy} $$

Traditionally, one would at this point substitute $y=a-a\cos{\theta}$, but that seems very arbitrary and ad-hoc. What would you substitute if you didn't know the solution beforehand? What would you substitute if you had a field other than $v=\sqrt{2gy}$, such as $v=gy^2$? In the face of this conundrum, I decided to test what would happen if I simply integrated with SymPy by doing sol = integrate(y/sqrt((2*a)-y), y) print(sol.doit()), and to my horror:

Piecewise((16sqrt(2)Ia**(7/2)sqrt(-1 + y/(2a))/(-6a2 + 3ay) - 16sqrt(2)a(7/2)/(-6*a2 + 3ay) - 4sqrt(2)Ia**(5/2)ysqrt(-1 + y/(2a))/(-6a**2 + 3ay) + 8sqrt(2)a*(5/2)y/(-6a2 + 3ay) - 2*sqrt(2)Ia(3/2)y**2sqrt(-1 + y/(2a))/(-6a2 + 3ay), Abs(y/a)/2 > 1), (16sqrt(2)a(7/2)sqrt(1 - y/(2a))/(-6*a2 + 3ay) - 16sqrt(2)a(7/2)/(-6a**2 + 3ay) - 4sqrt(2)a*(5/2)ysqrt(1 - y/(2a))/(-6a2 + 3ay) + 8sqrt(2)a(5/2)y/(-6a2 + 3ay) - 2sqrt(2)a(3/2)y**2sqrt(1 - y/(2a))/(-6a**2 + 3ay), True))

When I corroborated with MATLAB, I found

enter image description here

Clearly, this is nowhere close to $x = a\theta - a\sin{\theta}$. What's going on? What can I do?

Also, please let me know if any amendments need to be made to my question.

  • $\begingroup$ Hello! It would be preferable if you could write out the images with MathJax or code formatting like this: `code` gives code $\endgroup$
    – Jonas
    Nov 15, 2021 at 18:29
  • $\begingroup$ Hi @Jonas, I will do that now. Thank you for the heads-up. $\endgroup$
    – rb3652
    Nov 15, 2021 at 18:30
  • 3
    $\begingroup$ I don't think there's a good answer to that question. It boils down to "how do you do integrals of an arbitrary class of functions", and the answer to that is "there's no general algorithm". $\endgroup$ Nov 15, 2021 at 18:35
  • 1
    $\begingroup$ I'm not sure what you mean by that. If a numerical answer is OK, then great, go ahead with that. If you need an analytic solution, then you may or may not be able to get one depending on the form of the function you're integrating. $\endgroup$ Nov 15, 2021 at 18:39
  • 1
    $\begingroup$ that seems very arbitrary Everything hard to find will seem arbitrary after someone smart has found it for you in the past and all you have to do is read it. If you're not feeling up to the Bernoullis standards, then you're in good company. :-) $\endgroup$ Nov 16, 2021 at 13:51

1 Answer 1


As has already been noted, we can't give a better answer to general alternative potentials than "usually you'll need numerical methods", so I'll concentrate on a this-potential aspect of your post, namely how you'd stumble on the answer if the substitution you've already mentioned just doesn't occur.

Well, this is the Physics Stack Exchange, so let's think like a physicist by working in dimensions of powers of $a$. The integrand is of the form $f(y/(2a))$, with $f(u):=\sqrt{\frac{u}{1-u}}$. The $2$ in the denominator makes this a bit more pedagogically messy, since I would have loved to write "of the form $f(y/a)$" instead, but whatever. If any substitution occurs to you, it should be $u=y/(2a)$.

Right, let's continue. Your instruction is that we not set $u=1-\cos\theta$, but frankly I would have instead thought of $u=\sin^2\phi$. That's beside the point for the moment. The point is that since the correct answer includes a $\arcsin\sqrt{1-u}$ term (or $\arccos$ with the term's sign changed, depending on how you do it), you need to think of $\sqrt{1-u}$ as being at least as important as $u$, or you'll never solve the problem. That's not a solution strategy: it's just a fact, known to anybody who's solved the problem already or peaked at its ending, that constrains any solution strategy ever.

OK, but now some good news: you can't not look at the above $f$ and not at least compare $u$ and $1-u$. And since $v=1-u$ wouldn't get us very far, you'll have to instead notice $f$ is the ratio of two square roots, and think in terms of $\sqrt{u}$ and $\sqrt{1-u}$. Since these quantities are defined by having squares that sum to $1$, you'll have to use Pythagoras, a hyperbolic equivalent etc. at some point. (In other words, you'll go the $\phi$ route rather than the $\theta$ route.) So there's nothing unguessable about the next step forward.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.