# What shape of track minimizes the time a ball takes between start and stop points of equal height?

I was at my son's high school "open house" and the physics teacher did a demo with two curtain rail tracks and two ball bearings. One track was straight and on a slight slope. The beginning and end points of the second track were the same but it was bent into a dip with a decending slope and an ascending slope. The game was to guess which ball bearing wins the race. At first blush ("the shortest distance between two points is a straight line") one might think the straight wins, but in fact the bent track wins easily (because the ball is going very fast for most of the time). His point was that nature doesn't always work that way our antediluvian brains think it should.

So my question (and I do have one) is what shape of track give the absolute shortest time? I think it's a calculus of variation problem or something. For simplicity, let's assume a) no friction b) a point mass and c) that the end point is a small delta below the start point. I played around with some MATLAB code and it seemed to give a parabola of depth about 0.4 times the distance between the start and stop point. The value of g and the mass didn't seem to matter. But I don't know if my code was right or wrong and I couldn't figure out the significance of 0.4. I Googled around for an answer but couldn't find one. Thanks for any pointers!