The last part of this question is an example of this result:
The Attempt at a Solution
Here is the solution
I think L' is missing a term: If we take the Earth as your frame of reference.(i.e. You are stationary, watching the movement of the railway carriage).Then there should be an extra term for the KE of pendulum,due to horizontal movement of the carriage. (see below, the y dot term corresponds to v of the carriage)
Why is it not involved in L' ?