Eating your cake the right way

October 11, 2022

Share this article:

For some reason I always have a hard time making inter-temporal decisions. Should I drink a few more beers tonight, taking into account that I have a lecture at 9 am tomorrow? Should I buy that new piece of clothing or save to accumulate some (possibly negative) interest on my bank account? Planning my actions over a longer horizon, I struggle to find a clear framework to make good decisions. It is clear that my impatience and present-bias prevent me from fully indulging in my cake. What would be the optimal way from an economical point of view?

Economists are always optimizing

Inter-temporal decision making is a recurring theme in economics. It fits neatly into the framework of optimizing agents over longer time periods. One could think of savings decisions over your life span or government pondering what a profitable tax scheme would be. Let us start with a simple example. Suppose that we want to solve the following optimization problem:

(1)   \begin{equation*} \max_{\{c_t\}_{t=0}^\infty } \sum_{t=0}^\infty \beta^t u(c_t), \text{subject to} \:\sum_{t=0}^\infty c_t \leq a_0. \end{equation*}

To give an interpretation to this problem, suppose that we have to choose how much we want to consume, c_t, in each period (t). We can consume out of a finite stock (for instance your cake) a_0. Your total utility (“well-being”) is given by the sum of discounted utilities in each period. Here, \beta governs time preference, i.e. usually you prefer consumption today over consumption tomorrow as people are impatient. The smaller \beta, the more you value consumption today over consumption in the future. When considering infinite horizons, we have to impose that 0<\beta<1 in order to get a well-behaved solution (otherwise, we have a finite resource stock that we want to split up into an infinite number of equal (!) pieces. If you try to cut your cake at your birthday in this way, chances are that all your friends will look at you in a very weird way.). Given that we impose regular conditions on utility, i.e. marginal utility is positive but at a diminishing rate (your first beer is always nicer than your 12th), it is clear that the resource constraint will be binding, which implies that in finite time you will exhaust your resource stock.

The method of Lagrange

We can solve this problem in multiple ways. The dimension and lack of uncertainty in the problem implies that the method of Lagrange, named after Italian mathematician Joseph-Louis Lagrange, can be used. Assuming that we have logarithmic utility, the Lagrangian associated with the problem above is given by:

(2)   \begin{equation*} \mathcal{L}= \sum_{t=0}^\infty \beta^t \log(c_t)-\lambda\Big[\sum_{t=0}^\infty c_t - a_0\Big]. \end{equation*}

Here \lambda is the Lagrange multiplier associated with the resource constraint. The first-order conditions are given by:

(3)   \begin{align*} &\frac{\partial \mathcal{L}}{\partial c_t}=\frac{\beta^t}{c_t}-\lambda = 0, t=0,1,2,\dots,\infty, \\ &\frac{\partial \mathcal{L}}{\partial \lambda}=\sum_{t=0}^\infty c_t - a_0=0. \end{align*}

The first conditions imply:

(4)   \begin{align*} \frac{\beta^t}{c_t}=\frac{\beta^{t-1}}{c_{t-1}}=\dots=\frac{1}{c_0} \implies c_t=\beta c_{t-1}=\dots=c_0 \beta^t. \end{align*}

This implies that in each period, you consume a constant fraction of your previous consumption. Some manipulations (left as homework for the reader) give us the optimal consumption path:

(5)   \begin{align*} c_t = \beta^t(1-\beta)a_0. \end{align*}

This implies that in each period a decreasing fraction of the cake will be eaten, until there is no more cake left. The method of Lagrange is very handy in this example, as we can obtain an analytical solution. It also lends itself for other types of (non-negativity) constraints. Yet, when there is no analytical solution at hand, the fact that we have an infinite amount of optimality conditions introduces infinitely many troubles we cannot solve.

Solving the model via dynamic programming

Fortunately, the problem can be rewritten into a different form. For that, we first introduce a new object, the value function:

(6)   \begin{align*} V(a_t)=\max_{c_t} U_t \text{ s.t. } a_t =\sum_{v=t}^\infty c_v. \end{align*}

In words, the value function evaluated for the amount of assets at time t, (a_t), equals the maximum utility attainable with that level of assets. It can then be shown that maximizing lifetime utility subject to the resource constraint corresponds to the following recursive problem:

(7)   \begin{align*} V(a_t)=\max_{c_t, a_{t+1}} u(c_t) +\beta V(a_{t+1}), \text{subject to } a_{t+1}=a_t-c_t. \end{align*}

The equation above is called the Bellman-equation, after the American Mathematician Richard Bellman. Here, (c) is the control variable and (a) is the state variable, which in each period captures all the information the system contains. Dropping time scripts and denoting the next period value of a variable with a ‘(+)’, the task at hand is now to determine an expression for the value function and the optimal path for consumption c and future assets a^+. First, we maximize the right hand-side of the following equation:

(8)   \begin{align*} V(a)=\max_{c} u(c) +\beta V(a-c), \end{align*}

which yields us the condition u'(c)=\beta V'(a^+). Next, we know that in optimum consumption is a function of the amount of assets that you have. So, we can write, dropping the maximum operator as we have set c optimally:

(9)   \begin{align*} V(a)= u(c(a)) +\beta V(a-c(a)). \end{align*}

Total differentiation of this equation with respect to (a) implies:

(10)   \begin{align*} V'(a)&=u'(c)c'(a) + \beta V'(a^+)[1-c'(a)], \\ V'(a)&=c'(a)\underbrace{[u'(c)-\beta V'(a^+)]}_{=0} + \beta V'(a^+), \\ V'(a)&=\beta V'(a^+). \end{align*}

This result follows from the Envelope Theorem. Using this and the first-order condition derived earlier yields, not surprisingly, the same condition as in the previous method, namely that c_{t+1}=\beta c_t.

The beauty of this method is that dynamic programming lends itself perfectly for other sorts of utility functions, state variables and stochastic elements. For instance, in public economics, researchers are very fond of the so-called Life-Cycle-Model, where we can for example model individual savings behaviour. Such a model allows for heterogeneity in individuals in terms of wage earning uncertainty, health status, marital status and so forth. When models increase in complexity, analytical solutions are not reachable anymore, which makes us resort to numerical methods, but I have bothered you already too much with mathematical nonsense. I would advice you to not try to apply these methods when eating your cake but just have a small piece a day or, even better, share it with your friends.


Fehr, H. and Kindermann, F., 2018. Introduction to computational economics using Fortran. Oxford University Press.

Read more