That makes no sense at all. I could guess that p and q are "generalized coordinates" and that L is the Lagrangian (so this is a physics problem, not a math problem) but I have no idea what you want to solve for!
You will find the derivation in any textbook devoted to Classical Mechanics. I suggest you spend some time in the appropriate library of the institute you study at.