---
title: "Constant Elasticity of Substitution production function"
author:
  - name: "Fan Wang"
    affiliation: "Department of Economics, University of Houston"
    url: "https://fanwangecon.github.io/"
date: "2026-11-29"
---

**Part of [Production, Preferences, and Equilibrium: Theory and Applications](https://fanwangecon.github.io/Micro4Econ/).**  
[Main Micro4Econ site](https://fanwangecon.github.io/Micro4Econ/) | [View this section in the book](https://fanwangecon.github.io/Micro4Econ/producer_ces/overview.html#constant-elasticity-of-substitution-production-function) | [Author: Fan Wang](https://fanwangecon.github.io/)  
Date: 2026-11-29 | [HTML](https://fanwangecon.github.io/Micro4Econ/htmlpdfq/producer_ces/ces1_optimal.html) | [PDF](https://fanwangecon.github.io/Micro4Econ/htmlpdfq/producer_ces/ces1_optimal.pdf) | [QMD](https://fanwangecon.github.io/Micro4Econ/htmlpdfq/producer_ces/ces1_optimal.qmd)

## Constant Elasticity of Substitution production function

### The CES

Let $x$, $y$, and $z$ be three inputs. Let $A$ be aggregate productivity, $\rho$ be the elasticity of substitution parameter across the inputs, and $\alpha_x$, $\alpha_y$, and $\alpha_z=1-\alpha_x-\alpha_y$ and $\alpha_i >0$ be the relative productivity parameter. The production function is:

$$
\begin{gathered}
G(x, y, z) = A
\left(
  \alpha_x x^{\rho} +
  \alpha_y y^{\rho} +
  \alpha_z z^{\rho}
\right)^{\frac{1}{\rho}}\\
\end{gathered}
$$

### CES, first and second derivative, and cross derivative

Taking derivatives, we have:

$$
\begin{aligned}
\frac{\partial G}{\partial x} &= A^{\rho}\cdot G(x,y,z)^{1-\rho}\cdot \left(\alpha_x x^{\rho-1}\right)\\
\frac{\partial G}{\partial y} &= A^{\rho}\cdot G(x,y,z)^{1-\rho}\cdot \left(\alpha_y y^{\rho-1}\right)\\
\frac{\partial G}{\partial z} &= A^{\rho}\cdot G(x,y,z)^{1-\rho}\cdot \left(\alpha_z z^{\rho-1}\right)\\
\end{aligned}
$$

The factor $\rho$ from differentiating $x^{\rho}$ cancels the $1/\rho$ from the outer power, and $A^{\rho}$ restores the productivity term inside $G^{1-\rho}$.

For second derivatives, we have:

$$
\begin{aligned}
\frac{\partial^2 G}{\partial x^2} &= 
\frac{
\partial \left(A^{\rho}\cdot G(x,y,z)^{1-\rho}\cdot \left(\alpha_x x^{\rho-1}\right)\right)
}{\partial x}\\
&=\left(1-\rho\right) \cdot A^{2\rho} \cdot
\left(\alpha_x\right)^2 \cdot
x^{2\rho-2} \cdot
G(x,y,z)^{1-2\cdot\rho} + 
\left(\rho-1\right) \cdot A^{\rho} \cdot
\left(\alpha_x\right) \cdot
x^{\rho-2} \cdot
G(x,y,z)^{1-\rho}
\end{aligned}
$$

For $\rho<1$ with $\rho\ne0$, positive inputs and positive weights, the first term is positive and the second is negative. Their ratio is negative and smaller than one in absolute value, so the second derivative is negative:

$$
\begin{aligned}
\frac{\text{positive term}}{\text{negative term}}
= -A^{\rho} \cdot \alpha_x \cdot x^{\rho} \cdot G(x,y,z)^{-\rho}
= -\frac{\alpha_x x^{\rho}}{\alpha_x x^{\rho}+\alpha_y y^{\rho}+\alpha_z z^{\rho}}
\in (-1,0)
\end{aligned}
$$

For cross derivatives, we have:

$$
\begin{aligned}
\frac{\partial^2 G}{\partial x \partial y} &= 
\frac{
\partial \left(A^{\rho}\cdot G(x,y,z)^{1-\rho}\cdot \left(\alpha_x x^{\rho-1}\right)\right)
}{\partial y}\\
&= 
\left(1-\rho\right) \cdot A^{2\rho} \cdot
\left(\alpha_y \alpha_x\right) \cdot
\left(y x\right)^{\rho-1} \cdot
G(x,y,z)^{1-2\cdot\rho}\\
&>0, \text{ with } \rho \in \left(-\infty, 1\right)
\end{aligned}
$$

### Relative marginal products of inputs

The marginal rate of substitution between inputs are:

$$
\begin{aligned}
MRS_{yx} &= \frac{\alpha_y}{\alpha_x} \cdot \left(\frac{y}{x}\right)^{\rho -1}\\
MRS_{zx} &= \frac{\alpha_z}{\alpha_x} \cdot \left(\frac{z}{x}\right)^{\rho -1}\\
\end{aligned}
$$

- Given this production function, the elasticity of marginal rate of substitution (MRS) with respect to the input ratio is invariant to the levels of inputs.

### Output maximization with a budget

Assume $A>0$, positive input prices and weights, $W>0$, and $\rho<1$ with $\rho\ne0$. For the Cobb-Douglas case, use the limit as $\rho\to0$. Consider maximizing $G(X,Y,Z)$ subject to $p_xX+p_yY+p_zZ\le W$. The optimum is interior and the budget binds. Equating marginal products per unit of expenditure gives:

$$
\begin{aligned}
\frac{1}{p_x} G(x,y,z)^{1-\rho}\cdot
\left(\alpha_x X^{\rho-1}\right) &= \frac{1}{p_y} G(x,y,z)^{1-\rho}\cdot
\left(\alpha_y Y^{\rho-1}\right)\\
\frac{1}{p_x} G(x,y,z)^{1-\rho}\cdot
\left(\alpha_x X^{\rho-1}\right) &= \frac{1}{p_z} G(x,y,z)^{1-\rho}\cdot
\left(\alpha_z Z^{\rho-1}\right)\\
W &= p_x X + p_y Y + p_z Z \\
\end{aligned}
$$

We simplify the optimality conditions by cancelling common terms.

$$
\begin{aligned}
\frac{p_y}{p_x} &=
\frac{\alpha_y}{\alpha_x} \cdot
\left(\frac{Y}{X}\right)^{\rho-1}\\
\frac{p_z}{p_x} &=
\frac{\alpha_z}{\alpha_x} \cdot
\left(\frac{Z}{X}\right)^{\rho-1}\\
W &= p_x X + p_y Y + p_z Z \\
\end{aligned}
$$

We write optimal $Y$ and $Z$ choices as functions of $X$.

$$
\begin{aligned}
Y &=
\left(\frac{p_x}{p_y} \cdot \frac{\alpha_y}{\alpha_x}\right)^{\frac{1}{1-\rho}}
\cdot X\\
Z &=
\left(\frac{p_x}{p_z} \cdot \frac{\alpha_z}{\alpha_x}\right)^{\frac{1}{1-\rho}}
\cdot X\\
W &= p_x X + p_y Y + p_z Z \\
\end{aligned}
$$

We eliminate $Y$ and $Z$ from the budget constraint and simplify the resulting equation as a function of $X$.

$$
\begin{aligned}
W &= p_x X +
  p_y \cdot
  \left(
    \left(\frac{p_x}{p_y} \cdot \frac{\alpha_y}{\alpha_x}\right)^{\frac{1}{1-\rho}}
    \cdot X
  \right) +
  p_z \cdot
  \left(
    \left(\frac{p_x}{p_z} \cdot \frac{\alpha_z}{\alpha_x}\right)^{\frac{1}{1-\rho}}
    \cdot X
  \right)\\
W &= X\cdot\left(
  p_x +
  p_y\cdot
    \left(\frac{p_x}{p_y} \cdot \frac{\alpha_y}{\alpha_x}\right)^{\frac{1}{1-\rho}} +
  p_z\cdot
    \left(\frac{p_x}{p_z} \cdot \frac{\alpha_z}{\alpha_x}\right)^{\frac{1}{1-\rho}}
\right)
\end{aligned}
$$

Thus, $X^{\ast}\left(W, p_x, p_y, p_z\right)$ denotes the budget-constrained optimal $X$ input choice.

$$
\begin{aligned}
X^{\ast}\left(W, p_x, p_y, p_z\right)
 &= W\cdot
\left(
  p_x +
  p_y\cdot
    \left(\frac{p_x}{p_y} \cdot \frac{\alpha_y}{\alpha_x}\right)^{\frac{1}{1-\rho}} +
  p_z\cdot
    \left(\frac{p_x}{p_z} \cdot \frac{\alpha_z}{\alpha_x}\right)^{\frac{1}{1-\rho}}
\right)^{-1}
\end{aligned}
$$

### Output maximization choices with $N$ inputs

Now generalize the budget-constrained output maximization problem to $N$ inputs.

Let $\left\{X_i\right\}_{i=1}^N$ be $N$ inputs, and $\left\{p_i\right\}_{i=1}^{N}$ are prices on these $N$
inputs. Let $A$ be aggregate productivity, $\rho$ govern the elasticity of substitution, and $\left\{\alpha_i\right\}_{i=1}^N$ be positive relative productivity weights with $\sum_i^N \alpha_i = 1$.

$$
\begin{aligned}
X_j^{\ast}\left(W, \left\{p_i\right\}_{i=1}^N\right)
 &= W\cdot
\left(
  \sum_{i=1}^{N}
  p_i
  \cdot
    \left(
      \frac{p_j}{p_i} \cdot \frac{\alpha_i}{\alpha_j}
    \right)^{\frac{1}{1-\rho}}
\right)^{-1}
\end{aligned}
$$

Given model parameters, prices and the budget, the optimal choice equation above can be implemented directly.

### Marginal value of additional resources

How much additional output can be produced when the budget $W$ increases? Evaluate production at the budget-constrained optimal inputs:

$$
\begin{aligned}
V^{\ast}\left(
  W, \left\{p_i\right\}_{i=1}^N
\right) =& \left(
\sum_{j=1}^{N}
\alpha_j \cdot 
\left(X_j^{\ast}\left(W, \left\{p_i\right\}_{i=1}^N\right)
\right)^{\rho}
\right)^{\frac{1}{\rho}} A\\
=& A \left(
\sum_{j=1}^{N}
\alpha_j \cdot W^{\rho} \cdot
\left(
  \sum_{i=1}^{N}
  p_i
  \cdot
    \left(
        \frac{p_j}{p_i} \cdot \frac{\alpha_i}{\alpha_j}
      \right)^{\frac{1}{1-\rho}}
\right)^{-\rho}
\right)^{\frac{1}{\rho}}\\
=& A W \cdot
\left(\sum_{j=1}^{N}
\alpha_j \cdot
\left(
  \sum_{i=1}^{N}
  p_i
  \cdot
    \left(
      \frac{p_j}{p_i} \cdot \frac{\alpha_i}{\alpha_j}
    \right)^{\frac{1}{1-\rho}}
\right)^{-\rho}
\right)^{\frac{1}{\rho}}\\
\end{aligned}
$$

The derivative with respect to $W$ is constant because production has constant returns to scale:

$$
\begin{aligned}
\text{MVofW} = \frac{\partial \text{V}^{\ast}(W)}{\partial W} =&
A\left(\sum_{j=1}^{N}
\alpha_j \cdot
\left(
  \sum_{i=1}^{N}
  p_i
  \cdot
    \left(
      \frac{p_j}{p_i} \cdot \frac{\alpha_i}{\alpha_j}
    \right)^{\frac{1}{1-\rho}}
\right)^{-\rho}
\right)^{\frac{1}{\rho}}\\
\end{aligned}
$$

For a given positive output target $Q$, the corresponding minimum cost is $Q/\text{MVofW}$, and marginal cost is $1/\text{MVofW}$.

### Marginal value of additional resources if only use one input

Suppose now that only one of the $N$ inputs is used, and the others are zero. Output is then, for $\rho > 0$:

$$
\begin{aligned}
  A\alpha_i^{\frac{1}{\rho}}\cdot X_i = 
  A\alpha_i^{\frac{1}{\rho}}\cdot \left(\frac{W}{p_i}\right)
\end{aligned}
$$

When $\rho >0$, the marginal value of additional resources under this one-input restriction is $\frac{A\alpha_i^{\frac{1}{\rho}}}{p_i}$. For $\rho<0$, the displayed formula requires positive inputs; its continuous extension gives zero output when an input is zero.

With positive weights and prices, the unrestricted optimum for $\rho<1$ uses every input. Although zero inputs are feasible when $\rho>0$, observing an excluded input requires some additional mechanism, such as a fixed cost, or a different technology or parameter case.

### Matrix Representation of Solutions

Now consider the dual problem: minimize input expenditure for a given output target $Q>0$. We represent its solutions in matrix form.

First, we divide each price by every other price using an [outer product](https://en.wikipedia.org/wiki/Outer_product) of two vectors.

$$
\begin{aligned}
\begin{bmatrix}
p_1\\
p_2
\end{bmatrix}
\cdot
\begin{bmatrix}
\frac{1}{p_1}\\
\frac{1}{p_2}
\end{bmatrix}^{T} & =
\begin{bmatrix}
\frac{p_1}{p_1} & \frac{p_1}{p_2} \\
\frac{p_2}{p_1} & \frac{p_2}{p_2} \\
\end{bmatrix}
\end{aligned}
$$

Second, combining all operations, the matrix representation of the optimal choice formula is as shown below. Note that $\circ$ denotes element-wise operations ([Hadamard product](https://en.wikipedia.org/wiki/Hadamard_product_(matrices))), $^{\circ(-1)}$ denotes element-wise inverse operations, and $\cdot$ denotes matrix multiplication. Powers of matrices and vectors below are also element-wise. $Q$ and $A$ are scalars, while $P$ and $\alpha$ are $N$ by $1$ vectors.

$$
\begin{aligned}
X^{\ast} =
\underbrace{
\frac{Q}{A}
\left(  
  \left(
  \underbrace{
    \overbrace{
      \left(
        P
        \cdot
        \left(P^{\circ\left(-1\right)}\right)^{T}
      \right)
    }^{N \text{ by } N}
    \circ
    \overbrace{
    \left(
      \alpha
      \cdot
      \left(\alpha^{\circ\left(-1\right)}\right)^{T}
    \right)^{T}
    }^{N \text{ by } N}
  }_{N \text{ by } N}
  \right)^{\frac{\rho}{1-\rho}}
  \cdot
  \overbrace{
  \alpha
}^{N \text{ by } 1}  
\right)^{\frac{-1}{\rho}}}_{N \text{ by } 1}
\end{aligned}
$$

Third, the matrix representation of the aggregate marginal cost equation is shown below.

$$
\begin{aligned}
\text{MCofQ} =
\underbrace{
\frac{1}{A}
\overbrace{
P^{T}
}^{1 \text{ by } N}
\cdot
\left(
  \left(
  \underbrace{
    \overbrace{
      \left(
        P
        \cdot
        \left(P^{\circ\left(-1\right)}\right)^{T}
      \right)
    }^{N \text{ by } N}
    \circ
    \overbrace{
    \left(
      \alpha
      \cdot
      \left(\alpha^{\circ\left(-1\right)}\right)^{T}
    \right)^{T}
    }^{N \text{ by } N}
  }_{N \text{ by } N}
  \right)^{\frac{\rho}{1-\rho}}
  \cdot
  \overbrace{
  \alpha
  }^{N \text{ by } 1}
\right)^{\circ\left(\frac{-1}{\rho}\right)}}_{1 \text{ by } 1}
\end{aligned}
$$

#### Computational Implementation

Now we write a small program with the solutions for the cost minimization problem as well as the aggregate marginal cost equation.

```{python}
# The CRS CES solver function
def ffi_ces_crs_solver(ar_price, ar_share,
                       fl_elasticity,
                       fl_Q, fl_A):
    # Price Ratio: divide each price by every other price
    # PRICES x trans(1/PRICE)
    # SHARES x trans(1/SHARES)
    # fl_elasticity = 0.5
    # fl_Q = 1
    # fl_A = 1

    # np.random.seed(8888)
    # ar_price = np.random.uniform(size=3)
    # # ar_price = np.array([1,1,1])
    # # ar_price = np.array([0.6965, 0.2861, 0.2269])

    # ar_share = np.random.uniform(size=3)
    # ar_share = np.array([1,1,1])/3
    # ar_share = np.array([0.3255, 0.4247, 0.2498])
    ar_share = ar_share/sum(ar_share)

    # Each column divides by a different number
    # [a;b;c] x [1/a, 1/b, 1/c] : (3 by 1) x (1 by 3)
    mt_rela_price = np.outer(ar_price, np.reciprocal(ar_price))
    np.reciprocal(mt_rela_price)
    mt_rela_share = np.outer(ar_share, np.reciprocal(ar_share))

    # (p_j/p_i) x (alpha_i/alpha_j)
    mt_rela_prcshr = np.multiply(mt_rela_price, np.reciprocal(mt_rela_share))
    mt_rela_prcshr_rho = mt_rela_prcshr**(fl_elasticity/(1-fl_elasticity))

    # alpha_i x [(p_j/p_i) x (alpha_i/alpha_j)]^(rho/(1-rho))
    # 1/p_i are columns
    # (N by N) x (N by 1)
    ar_sum = np.matmul(mt_rela_prcshr_rho, ar_share)
    ar_sum_rho = ar_sum**(-1/fl_elasticity)

    # rescale
    ar_opti_costmin_x = ar_sum_rho * fl_Q/fl_A
    ar_opti_costmin_x

    # weighted average of prices
    fl_mc_aggprice = (np.dot(ar_sum_rho, ar_price)/fl_A)
    fl_mc_aggprice

    return ar_opti_costmin_x, fl_mc_aggprice

# Test function
fl_elasticity = 0.5
fl_Q = 1
fl_A = 1

# Test 1 fixed inputs
ar_price = np.array([0.6965, 0.2861, 0.2269])
ar_share = np.array([0.3255, 0.4247, 0.2498])
ffi_ces_crs_solver(ar_price, ar_share, fl_elasticity, fl_Q, fl_A)
# Test 2 common price
ar_price_common = np.array([1, 1, 1])
ffi_ces_crs_solver(ar_price_common, ar_share, fl_elasticity, fl_Q, fl_A)

# Test 3 common share
ar_share_common = np.array([1, 1, 1])/3
ffi_ces_crs_solver(ar_price, ar_share_common, fl_elasticity, fl_Q, fl_A)

# Test 4 fixed price and shares
np.random.seed(8888)
ar_price_rand = np.random.uniform(size=3)
ar_share_rand = np.random.uniform(size=3)
ffi_ces_crs_solver(ar_price_rand, ar_share_rand, fl_elasticity, fl_Q, fl_A)

# relative price function
def ffi_ces_rela_opti(ar_inputs_x, ar_share,
                      fl_elasticity, it_idx_base=0):

    # relative prices, with it_index_price_1 price normalized to 1.
    ar_rela_prices = np.multiply((ar_share * 1/ar_share[it_idx_base]),
                                 (ar_inputs_x * 1/ar_inputs_x[it_idx_base])**(fl_elasticity - 1))

    return(ar_rela_prices)

# Test
# Input optimal quantities
fl_elasticity = 0.5
fl_Q = 1
fl_A = 1
ar_price = np.array([0.6965, 0.2861, 0.2269])
ar_share = np.array([0.3255, 0.4247, 0.2498])
ar_opti_costmin_x, fl_mc_aggprice = ffi_ces_crs_solver(ar_price, ar_share,
                                                       fl_elasticity,
                                                       fl_Q, fl_A)
# Solve for relative prices given demand optimality
it_index_price_1 = 0
ar_rela_prices = ffi_ces_rela_opti(ar_opti_costmin_x, ar_share, fl_elasticity,
                                   it_idx_base=it_index_price_1)
ar_price/ar_price[it_index_price_1]
```
