Thanks to all of you (specially @A.T.). Actually I skipped some portions in Classical Mechanics due to (my personal) exam. strategy in completing my Graduation as I am not a good student. That’s why I could not solve this problem. But now, I have found this (The Brachistochrone) in my textbook...