Apr21
Political Economy7
Pictured: a Utility Monster

# How To Derive A Demand Function from a CES Utility Function

Warning: Boring technical stuff that’s only here because I needed it for the model in the Helicopter Money paper, and there are no other good references online.

All the existing resources on the internet that I’ve found are either vague or inconsistent with their σ/ρ notation (where $$ρ=\frac{σ-1}{σ}$$ and σ is the elasticity of substitution, which makes the exponents in the utility function look cleaner, though the exponents in the demand function will be correspondingly messier), or don’t derive it with the coefficients. Almost none go step by step (with the exception of this video) or carry through the coefficients with exponents, and literally none ﻿derive a function for more than two goods.

We’re going to do all of these: a fully general derivation of demand functions from an n-good CES utility function, carrying through the actual elasticity of substitution as a parameter. I’ll use sum notation throughout, which you can easily expand to a definite number of goods. It’s worth noting though that the elasticity of substitution has to be the same between all pairs of goods, otherwise there’s no fully general form.

We start by writing our CES function this way, raising our coefficient to the 1/σ and summing over a set of n goods. You might wonder why we’re raising our coefficient to an exponent too. It’ll make our demand function slightly cleaner in the end, and since it’s a parameter, you can just define αn = βn1/σ and substitute that back in at the end.

(1) $$U=\left(\sum_n β_n^{1/σ}G_n^\frac{σ-1}{σ} \right)^\frac{σ}{σ-1}$$

A function of this form means that the elasticity of substitution between any pair of goods is σ. Our budget constraint, then, is

(2) $$I=\sum_nP_nG_n$$

So we want to maximize (1) subject to (2). So we set up our lagrangian, and derive with respect to each good plus λ, which gives us n+1 first-order conditions.

(3) $$\mathcal{L} = \left(\sum_n β_n^{1/σ}G_n^\frac{σ-1}{σ} \right)^\frac{σ}{σ-1} + λ\left(I-\sum_nP_nG_n\right)$$

Since both parts of the Lagrangian are sums, and the parameters of the various goods are all siloed into their own terms, this is actually fairly straightforward to derive with respect to any G variable. So we’ll pick any two goods, say a and b, and derive with respect to Ga and Gb, which we can use to find the relative price of a with respect to b. We’ll solve for the demand function for Ga, so any additional goods c, d,… will come out with symmetrical relative price equations.

To get the derivative of the first part of the Lagrangian, remember the chain rule for deriving f(g(x)): $$\frac{∂ f}{∂ x} = \frac{∂ f}{∂ g}\frac{∂ g}{∂ x}$$. Our f(g) will be $$g^\frac{σ}{σ-1}$$, and our g(x) will be the sum on the inside of the parentheses. Carrying down the $$\frac{σ}{σ-1}$$ exponent from $$\frac{∂ f}{∂ g}$$ cancels out the $$\frac{σ-1}{σ}$$ exponent carried down from the Gn in $$\frac{∂ g}{∂ x}$$. This gives us:

(4) $$\frac{∂\mathcal{L}}{∂G_a} = \left(\frac{β_a}{G_a}\right)^\frac{1}{σ} \left(\sum_n β_n^{1/σ}G_n^\frac{σ-1}{σ}\right)^\frac{1}{σ-1} – \lambda P_a = 0$$

(5) $$\frac{∂\mathcal{L}}{∂ G_b} = \left(\frac{β_b}{G_b}\right)^\frac{1}{σ} \left(\sum_n β_n^{1/σ}G_n^\frac{σ-1}{σ}\right)^\frac{1}{σ-1} – \lambda P_b = 0$$

(6) $$\frac{∂\mathcal{L}}{∂ \lambda} = I-\sum_nP_nG_n = 0$$

We have βa/Ga in (4) because $$\frac{σ-1}{σ} – 1 = \frac{-1}{σ}$$, which lets us put Ga in the denominator of the coefficient raised to the $$\frac{1}{σ}$$. Similarly, the outer $$\frac{1}{σ-1}$$ exponent comes from $$\frac{σ}{σ-1} – 1 = \frac{1}{σ-1}$$. Moving the sum to the right-hand side of (6) gives us back the budget constraint, i.e. (2).

From here, we want the relative price of Pa to Pb (and, by extension, Pc, and whatever other hypothetical goods we have FOCs for). Moving the λP terms of (4) and (5) to the right-hand side, we can divide λPaPb to make the λs cancel out, as well as a good bit of (4) and (5).

(7) $$\frac{P_a}{P_b} = \frac{(β_a/G_a)^\frac{1}{σ}}{(β_b/G_b)^\frac{1}{σ}} = \left(\frac{β_a G_b}{β_b G_a}\right)^\frac{1}{σ}$$

The right hand side is the marginal rate of substitution between Ga and Gb. This equation simply tells us that the price ratio between these two goods has to equal their marginal rate of substitution, which is a basic result in microeconomics. This tells us we’re on the right track.

Solving for Gb, we have

(8) $$G_b = \frac{β_bG_a}{β_a}\left(\frac{P_a}{P_b}\right)^σ$$

And similarly for Gc, etc. What we’re aiming to do here is to replace all the G variables in (2) except Ga with expressions in terms of Ga, so we can then solve for Ga and get an equation defining it only in terms of the β parameters. This will be our demand curve.

So, substituting (8) and its brothers back into the budget constraint (2) gives us

(9) $$I=P_aG_a + \sum_{n\neq a}P_n\frac{β_nG_a}{β_a}\left(\frac{P_a}{P_n}\right)^σ$$

$$= G_a \sum_{n}\frac{β_n}{β_a}P_a^σ P_n^{1-σ}$$

We’ve substituted every G term of the sum, except the original Ga term, with an expression in terms of Ga. But notice that the expression in the sum evaluates to PaGa when n=a. We can therefore reincorporate the stray term and pull out Ga from the sum.

All that remains is to solve for Ga.

(10) $$G_a = \frac{I}{\sum_{n}\frac{β_n}{β_a}P_a^σ P_n^{1-σ}}$$

$$= \frac{I P_a^{-σ}}{\sum_{n}\frac{β_n}{β_a}P_n^{1-σ}}$$

So there’s our demand function for Ga, and mutatis mutandis for any of the other goods. You can verify it works, because in conjunction with the formulas in the appendix to “Helicopters and the Neutrality of Money“, it lets you translate from a weight-in-the-utility-function (i.e. a value of β) to a specific quantity demanded (i.e. a value of G/P), in this case, real money balances.

None

• 1

### mg

Feb 13, 2019 at 19:47 | Reply

Thanks this was very helpful to me! But I think you left out a lambda in equations 4 and 5? It would cancel out anyway in the next step so it wouldn’t change the results at all.

• 1.1

### Cameron Harwick

Feb 13, 2019 at 21:52

Good catch, thanks – (4) and (5) are updated now.

• 2

Apr 30, 2019 at 1:47 | Reply

Thanks for the post, it is great! One thing that is not quite clear to me is what has happened to the moved down exponent (via the power rule) when taking the derivative of g(x). To be a bit clearer, you end up with (beta/gx)^1/sigma as the derivate of the inside part wrt to gx. Stepping through that, we go from b^(1/sigma)*gx^(sigma/(sigma-1)) taking the derivate wrt gx gives (sigma/(sigma-1))*(b^(1/sigma)*gx^(-1/sgima)) I think I see how we go from here to (b/gx)^(1/sigma) but it is not clear to me what has happened to (sigma/(sigma-1))?

It’s probably something really obvious that I am missing, but would love a little help on understanding that part!

• 2.1

### Cameron Harwick

Apr 30, 2019 at 10:57

I don’t 100% follow your question, but I ran through the derivative again, and I did fail to carry down the exponent on the ∂g/∂x portion of the chain rule, which gives a (σ-1)/σ coefficient that cancels out the σ/(σ-1) carried down from ∂f/∂g. It didn’t end up mattering in the end because the σ/(σ-1) canceled itself out when doing the relative price calculation in (7), but even so it shouldn’t have been there. I’ve updated (4) and (5) to correct this.

Does that address your question, or were you getting at something else? Thanks in any case for pointing out the inconsistency.

• 2.2

Apr 30, 2019 at 19:42

Thanks for getting back to me, this indeed does address my question.

Thanks again for the good work, it’s very helpful! A better treatment than Alpha Chiang’s which is what I’d been working through 😊

• 3

### Lewis

Jan 13, 2020 at 23:20 | Reply

I think the exponent on the sun term in parens is reversed. Should be 1/(/sigma-1)?

• 3.1

### Cameron Harwick

Jan 13, 2020 at 23:39

You’re right, that was flipped by mistake – fixed now.