Take a simplified version of the Ramsey–Cass–Koopmans model. We wish to maximize an agent's discounted lifetime utility achieved through consumption
subject to the time evolution of capital per effective worker
where is period t consumption, is period t capital per worker, is period t production, is the population growth rate, is the capital depreciation rate, the agent discounts future utility at rate , with and .
Here, is the state variable which evolves according to the above equation, and is the control variable. The Hamiltonian becomes
The optimality conditions are
If we let , then log-differentiating the first optimality condition with respect to yields
Setting this equal to the second optimality condition yields
This is the Keynes–Ramsey rule or the Euler–Lagrange equation, which gives a condition for consumption in every period which, if followed, ensures maximum lifetime utility.