We explore the Jacobi last multiplier (JLM) as a means for deriving the Lagrangian of a fourth-order differential equation. In particular, we consider the classical Pais-Uhlenbeck problem and write down the accompanying Hamiltonian. We then compare such an expression with our alternative derivation of the Hamiltonian that makes use of the Ostrogradski's method and show how a mapping from the one to the other is achievable by variable transformations. © 2013 World Scientific Publishing Company.