The first thing that I notice, is that
[tex]T = 2\pi\sqrt{\frac{R ^3}{g}}[/tex]
looks suspiciously like
[tex]T = 2\pi\sqrt{\frac{\ell}{g}}[/tex]

And [tex]g_x=G\frac{M}{R^3}x[/tex] looks suspiciously like:

[tex]F = G \frac{m_1 m_2}{r^2}[/tex]
[tex]F=m_1 a_1[/tex]
[tex]a_1= \frac {F}{m_1}[/tex]
[tex]a_1 = G \frac{m_2}{r^2}[/tex]

And other than that, I'm stuck. I don't even understand what this problem is asking for sure yet. And just because something "looks" like something doesn't mean necessarily it's right, but both of the equations do look quite suspicious! I would be pleased with any hints.

Ok, I made a small bit of progress with the pendulum equation similarity idea. I drew a diagram of a sector of a slice of the earth, with radius r, angle theta, and therefore the arc length would be:
[tex]s = r \theta[/tex]

So, by trigonometry, the straight train tunnel/tracks is equal to [tex]r \tan \theta[/tex]

(Unless by "straight" it means curving along with the curve of a perfect sphere in which case it would just be s)

Also, velocity v cold be equated to change in theta, and then also acceleration and so on:
[tex]v = {ds\over dt} = \ell{d\theta\over dt}[/tex]
[tex]a = {d^2s\over dt^2} = \ell{d^2\theta\over dt^2}[/tex]

The 2nd part is straightforward: given the expression for force along x from the 1st part, the equation F = ma boils down to mx'' = -kx where k is given by the answer to the 1st part. This equation represents simple harmonic motion with radian frequency ω = √(k/m) and period = 2π/ω. Rather than trying to fit a pendulum's motion into your problem, concentrate on the math behind the formulas. For one thing, your pendulum formula is an approximation, valid for infinitely small perturbation angles only. The above equation has no such limitation. Which is why the question says "independent of the length of the track".

For the 1st part, come up with an expression that shows the force along x is proportional to the distance x away from the track's low point. This is so because gravity is postulated here to increase linearly with vertical distance away from the Earth's center, and thus also from the track's low point, and x is related to y by simple trig.

There have been so many views (> 1500) on this item that it suggests that subterranean trains are a fascinating subject to many.

Here's a question for some of them: given that one wants to construct an underground tunnel between two fixed surface points A and B, what shape should the tunnel take for a frictionless train to go from A to B in minimum time? The distance between A and B is L.

And unlike the OP's problem, consider g constant for the depths involved.