Connects to: Principles Parts I–II
This part builds the mathematical scaffolding that every subsequent part uses. Readers who have taken a year of calculus and a semester of linear algebra will find it a targeted review with macroeconomic applications — not a repetition of what they already know, but a reframing of familiar tools in the language of economic models. Each chapter introduces its tools in the context of a specific macroeconomic question, so that the mathematics never floats free of motivation.
Chapter 1 develops optimization theory — the mathematical heart of all macroeconomic modeling, since macroeconomics is the study of agents who optimize subject to constraints. Chapter 2 applies linear algebra to economic systems, deriving the Leontief inverse and the IS–LM solution as matrix problems. Chapters 3 and 4 develop differential and difference equations respectively, covering the analytical toolkit for the dynamic models of Parts III–IV. Chapter 5 introduces the stochastic processes — particularly the AR(1) — that appear as the shock processes in every model from Chapter 17 onward.
A note on difficulty: Chapter 1 through Chapter 5 are sequenced so that each builds on the previous, but they are also largely self-contained. A reader who wants only the stochastic methods of Part V can read Chapter 5 directly after Chapter 2.
Chapter 1: Calculus and Optimization in Macroeconomics¶
From Utility Maximization to Lagrange Multipliers
“Optimization is the heart of economics. Almost every economic model, at its core, is an optimization problem.” — Thomas Sargent
Cross-reference: Principles Ch. 1 (scope of macroeconomics); Ch. 11 (consumption theory, Euler equation); Ch. 12 (investment theory, Tobin’s q); Ch. 13 (labour supply and demand) [P:Ch.1, P:Ch.11, P:Ch.12, P:Ch.13]
1.1 Why Calculus? The Optimization Imperative¶
Macroeconomics, at every level of sophistication, is a discipline about constrained choice. A household chooses a consumption path to maximize lifetime utility subject to a budget constraint. A firm chooses investment to maximize the present value of profits subject to an adjustment cost technology. A central bank chooses a path for the interest rate to minimize a loss function subject to the constraints imposed by the Phillips curve and the IS relationship. In each case, the economic content is carried by the optimization problem, and the calculus is the language in which that problem is solved.
The models of Principles frequently invoke optimization without deriving the conditions in full. Chapter 11 of Principles states the Euler equation and then explains it verbally; this chapter derives it, together with every other first-order condition that appears in Principles, from the underlying optimization problem. The derivations are not decorative. They matter because:
They reveal what assumptions the result depends on — and what happens when those assumptions are relaxed.
They provide the algebraic form needed for numerical computation (Part VI).
They are the basis for comparative statics — understanding how the equilibrium changes when parameters change.
We begin with unconstrained optimization, move to equality-constrained problems (the Lagrangian), then to inequality-constrained problems (Kuhn–Tucker conditions), and finally to the implicit function theorem, which turns comparative statics from a graphical exercise into an algebraic one.
1.2 Unconstrained Optimization¶
1.2.1 Single-Variable Problems¶
Definition 1.1 (Local and Global Maxima). Let . A point is a local maximum of if there exists such that for all with . It is a global maximum if for all .
The fundamental result connecting calculus to optimization:
Theorem 1.1 (First-Order Necessary Condition). If is differentiable and is a local maximum (or minimum) of , then .
Proof sketch. If , then by continuity of there exists such that for all . Then is strictly increasing on this interval, so , contradicting being a local maximum. Similarly for .
The first-order condition (FOC) is necessary but not sufficient. Points where are called critical points or stationary points; they may be maxima, minima, or inflection points.
Theorem 1.2 (Second-Order Sufficient Conditions). Let be twice differentiable and let satisfy .
If , then is a strict local maximum.
If , then is a strict local minimum.
If , the test is inconclusive.
Application to macroeconomics: The Baumol–Tobin money demand model of Principles Ch. 14 minimizes total cost over the number of bank trips . Setting :
The second derivative confirms this is a minimum.
1.2.2 Multivariate Unconstrained Optimization¶
Let . The gradient is:
Theorem 1.3 (Multivariate FOC). If is a local maximum or minimum of a differentiable , then .
The second-order conditions require the Hessian matrix:
By Young’s theorem (symmetry of mixed partials), is symmetric.
Definition 1.2 (Positive and Negative Definite Matrices). A symmetric matrix is positive definite if for all nonzero ; equivalently, all eigenvalues of are strictly positive. It is negative definite if for all nonzero ; equivalently, all eigenvalues are strictly negative. It is indefinite if it has both positive and negative eigenvalues.
Theorem 1.4 (Multivariate Second-Order Conditions). At a critical point :
negative definite strict local maximum.
positive definite strict local minimum.
indefinite saddle point.
A practical check for negative definiteness: the leading principal minors of must all be positive (i.e., is negative definite iff is positive definite iff all leading principal minors of are positive).
1.2.3 The Envelope Theorem¶
The envelope theorem answers the question: how does the optimized value of the objective function change when a parameter changes, without re-solving the optimization problem?
Theorem 1.5 (Envelope Theorem, Unconstrained). Let be differentiable in both and the parameter . Define the value function , with maximizer (assuming it is differentiable in ). Then:
That is, the total derivative of the value function with respect to a parameter equals the partial derivative of the objective with respect to that parameter, evaluated at the optimum. The channel through which changes the optimal — the indirect effect — contributes nothing to the change in because at the optimum.
Proof:
Application: In the firm’s investment problem of Principles Ch. 12, the Hamiltonian is the value function and the shadow price (Tobin’s ) is the envelope of the profit function with respect to the capital stock. The costate equation is the envelope theorem applied to the continuous-time optimal control problem — we derive this fully in Chapter 11.
1.3 Constrained Optimization: Equality Constraints¶
Most optimization problems in macroeconomics involve constraints. The household maximizes utility subject to a budget constraint; the firm maximizes profit subject to a production technology. Equality constraints are handled by the method of Lagrange multipliers.
1.3.1 The Lagrangian Method¶
Definition 1.3 (Lagrangian). For the problem subject to , the Lagrangian function is:
where is the Lagrange multiplier or shadow price associated with the constraint.
Theorem 1.6 (Lagrange Necessary Conditions). If is a local maximum of subject to , and if the constraint qualification holds, then there exists such that:
In components: for all , plus the constraint.
Derivation from first principles. Consider subject to . Since the constraint implicitly defines as a function of near the optimum (by the IFT, provided ), we can write where . Substituting into the objective and taking the total derivative with respect to :
Rearranging: . This gives for , which are exactly the FOCs of the Lagrangian.
1.3.2 Economic Interpretation of the Lagrange Multiplier¶
The Lagrange multiplier measures the marginal value of relaxing the constraint. Formally, if the constraint is (parameterized by ) and , then . Each unit increase in allows the agent to reach a higher objective by exactly .
In the household problem with budget constraint , the Lagrange multiplier is the marginal utility of income: where is the indirect utility function. In the firm’s problem with a capital constraint, is the shadow price of capital — Tobin’s [P:Ch.12].
1.3.3 Multiple Equality Constraints¶
For subject to , (with ), the Lagrangian is:
and the FOCs are and for all , giving equations in unknowns.
Worked Example 1.1: Household Utility Maximization
A household maximizes subject to , where , , and is lifetime wealth. Find the optimal consumption plan and the Lagrange multiplier.
Solution. The Lagrangian:
First-order conditions:
Equating: , which gives the Euler equation:
This is exactly equation (11.14) in Principles Ch. 11 [P:Ch.11.2], now derived explicitly. Substituting into the budget constraint and solving:
The shadow price is the marginal utility of wealth: gaining one more unit of raises lifetime utility by .
1.4 Constrained Optimization: Inequality Constraints¶
When constraints may or may not bind at the optimum — as in the borrowing constraint of Principles Ch. 11.4 — the Kuhn–Tucker conditions replace the simple Lagrange conditions.
1.4.1 The Kuhn–Tucker Conditions¶
Theorem 1.7 (Kuhn–Tucker Necessary Conditions). Consider subject to for . Define the Lagrangian . If is a local maximum and a constraint qualification holds, then there exist such that:
Stationarity:
Primal feasibility: for all
Dual feasibility: for all
Complementary slackness: for all
The complementary slackness condition is the key: either the constraint is binding () or the multiplier is zero (), or both. If a constraint is not binding, it plays no role in the optimum.
Application to the liquidity-constrained consumer [P:Ch.11.4]: The household maximizes subject to and the borrowing constraint . Writing the constraint as , the KKT conditions add a multiplier :
When the constraint binds (): — the household is “constrained” in the sense that the Euler equation holds with a positive wedge. When the constraint is slack: and the standard Euler equation holds. This is the formal derivation of Principles equation (11.16).
1.5 The Implicit Function Theorem and Comparative Statics¶
Comparative statics asks: when a parameter changes, how does the equilibrium change? The implicit function theorem (IFT) provides the algebraic tool for answering this question systematically.
Theorem 1.8 (Implicit Function Theorem — Scalar Version). Let be continuously differentiable. Suppose and . Then there exists a neighborhood of and a unique continuously differentiable function such that and . Moreover:
The multivariate version: if defines implicitly as a function of near , and if the Jacobian is nonsingular at , then:
This is the fundamental formula for comparative statics in any system of equilibrium conditions.
Worked Example 1.2: Comparative Statics for the IS Curve
Derive the slope of the IS curve (how changes with in goods-market equilibrium) using the IFT.
The IS curve is the locus satisfying . Then:
By the IFT:
since and . The IS curve slopes downward, with steeper slope when the MPC is large (strong multiplier) or investment is insensitive to the interest rate (small ). This is the algebraic derivation of the IS slope stated qualitatively in Principles Ch. 9.1 [P:Ch.9.1].
1.6 Concavity, Convexity, and Global Optima¶
The FOCs and SOCs identify local optima. For global optima, we need concavity or convexity.
Definition 1.4 (Concave and Convex Functions). A function defined on a convex set is concave if for all and :
It is strictly concave if the inequality is strict for and .
Proposition 1.1. If is strictly concave, any local maximum is also a global maximum. If is twice differentiable, it is concave iff is negative semi-definite everywhere.
Most utility functions used in macroeconomics are strictly concave: , for , and are all strictly concave in . This guarantees that the Lagrange FOCs identify a global maximum.
For convex constraint sets (which are the rule in consumer and producer theory), the constraint qualification is automatically satisfied, and the Lagrange/KKT conditions are both necessary and sufficient under concavity of the objective.
1.7 Worked Example: Deriving the Labour Supply Curve¶
Cross-reference: Principles Ch. 13 (labour supply and demand) [P:Ch.13.1]
Consider a household with preferences , where is consumption and is leisure ( is hours worked), and is the relative weight on leisure. The budget constraint is (wage income plus non-labour income ), and time is normalized so .
Step 1: Write the constrained problem.
Substitute the constraint: .
Step 2: First-order condition.
Step 3: Solve for .
Step 4: Comparative statics.
Step 5: Verify second-order condition.
The objective is strictly concave in , confirming is a global maximum.
The upward-sloping labour supply curve () is consistent with the competitive benchmark of Principles Ch. 13.1 [P:Ch.13.1]. The formula also shows that the Frisch elasticity of labour supply (the elasticity of with respect to holding the marginal utility of wealth constant) depends on the preference parameter — a result used in Chapter 13 of this volume when calibrating the RBC model.
1.8 Programming Exercises¶
Exercise 1.1 (APL)¶
Implement Newton’s method for finding the root of where using the APL ⍣ power operator with a convergence guard.
⍝ Dyalog APL — Fixed Newton's Method
⎕IO←0 ⋄ ⎕ML←1
⍝ Parentheses are mandatory for polynomials in APL
f ← {(-⍵*4) + (3×⍵*3) - 2}
df ← {(-4×⍵*3) + 9×⍵*2} ⍝ f'
ddf ← {(-12×⍵*2) + 18×⍵} ⍝ f''
⍝ One Newton step for finding a root of df(x)
⍝ Newton's formula: x - f'(x)/f''(x)
step ← {⍵ - (df ⍵) ÷ (ddf ⍵)}
⍝ Use the Power operator with a dyadic comparison guard
⍝ ⍺ is current value, ⍵ is previous value
x_star ← step ⍣ {1e¯10 > |⍺ - ⍵} 2.0
x_star ⍝ Should be 2.25
f x_star ⍝ Should be 6.54296875Note the idiom f ⍣ converged ⊢ start: apply f repeatedly until the predicate converged is satisfied. ⍣ with a dyadic right argument iterates until convergence — this pattern appears throughout the book for fixed-point computations.
Exercise 1.2 (Python)¶
# Python — Newton's method for critical point of f(x) = -x**4 + 3*x**3 - 2
from scipy.optimize import minimize_scalar
import numpy as np
f = lambda x: -x**4 + 3*x**3 - 2
df = lambda x: -4*x**3 + 9*x**2 # first derivative
ddf = lambda x: -12*x**2 + 18*x # second derivative
def newton_critical(x0, tol=1e-10, max_iter=100):
x = x0
for i in range(max_iter):
x_new = x - df(x) / ddf(x)
if abs(x_new - x) < tol:
return x_new, i+1
x = x_new
raise RuntimeError("Did not converge")
x_star, iters = newton_critical(0.5)
print(f"x* = {x_star:.10f}, f(x*) = {f(x_star):.10f}, converged in {iters} iterations")x* = 0.0000000001, f(x*) = -2.0000000000, converged in 32 iterations
Exercise 1.3 (Julia)¶
# Julia — Newton's method for critical point
f(x) = -x^4 + 3x^3 - 2
df(x) = -4x^3 + 9x^2
ddf(x) = -12x^2 + 18x
function newton_critical(x0; tol=1e-10, max_iter=100)
x = x0
for i in 1:max_iter
x_new = x - df(x) / ddf(x)
abs(x_new - x) < tol && return x_new, i
x = x_new
end
error("Did not converge")
end
x_star, iters = newton_critical(0.5)
println("x* = $(round(x_star, digits=10)), f(x*) = $(round(f(x_star), digits=10)), iters = $iters")Exercise 1.4 (R)¶
# R — Newton's method for critical point
f <- function(x) -x^4 + 3*x^3 - 2
df <- function(x) -4*x^3 + 9*x^2
ddf <- function(x) -12*x^2 + 18*x
newton_critical <- function(x0, tol = 1e-10, max_iter = 100) {
x <- x0
for (i in seq_len(max_iter)) {
x_new <- x - df(x) / ddf(x)
if (abs(x_new - x) < tol) return(list(x = x_new, iters = i))
x <- x_new
}
stop("Did not converge")
}
res <- newton_critical(0.5)
cat(sprintf("x* = %.10f, f(x*) = %.10f, iters = %d\n", res$x, f(res$x), res$iters))Exercise 1.5 — Household Problem ()¶
Extend Worked Example 1.1 to three periods. The household maximizes with subject to the lifetime budget constraint . (a) Derive the three Euler equations. (b) Solve analytically for as a function of , , and . (c) In APL, solve the system using ⌹ (matrix divide) for a range of parameter values and produce a table of consumption shares .
Exercise 1.6 — Comparative Statics ()¶
Using the IS condition with , compute , , and using the IFT. Verify these match the IS–LM multipliers derived in Chapter 6. Implement the computation in APL as a dfn that takes the parameters as a vector and returns the three partial derivatives.
Exercise 1.7 — Kuhn–Tucker ()¶
Consider a household that maximizes subject to and (a consumption floor). (a) Write the Lagrangian with two multipliers. (b) Identify the two regimes (constraint binding vs. not binding) and solve for the optimum in each. (c) Find the threshold wealth below which the floor binds.
1.9 Chapter Summary¶
This chapter developed the optimization tools that underlie every macroeconomic model in Principles and in this volume.
Key results:
The first-order necessary condition must hold at any interior maximum or minimum of a differentiable function.
The second-order sufficient condition requires the Hessian to be negative definite (for a maximum) or positive definite (for a minimum) at the critical point.
The envelope theorem states that the marginal value of a parameter equals its direct effect on the objective, evaluated at the optimum; indirect effects through the optimal policy function contribute nothing.
The Lagrange method converts equality-constrained problems into unconstrained problems over an augmented objective; the multiplier is the shadow price of the constraint.
The Kuhn–Tucker conditions extend the Lagrange method to inequality constraints, with complementary slackness ensuring that a slack constraint has a zero multiplier.
The implicit function theorem provides the formula for comparative statics: .
Connections forward: Chapter 3 extends these tools to infinite-horizon continuous-time problems (the Hamiltonians of optimal control). Chapter 11 applies them to the RCK model. Chapter 15 develops the discrete-time analogue (Bellman equations and dynamic programming). Chapter 18 applies the Lagrange method to the household’s problem under rational expectations.
Next: Chapter 2 — Linear Algebra for Macroeconomic Systems