Intro Mathematics for Economists

Introductory Mathematics for Economists

Star Fork Star

This is a work-in-progress course website for Mathematics for Economists, an upper-level undergraduate economics course offered by Piruz Saboury and Fan Wang. The course covers a subset of topics from Mathematics for Economists (Simon and Blume 1994). Applications focus on households’ optimal borrowing and savings problems and firms’ optimal inputs problems. Matlab is used throughout.

bookdown site and bookdown pdf.

Materials are written in matlab livescript files and shown as HTML files. For HTML files, click on the links below. The livescript files can be downloaded and modified inside matlab. Files are from the Math4Econ repository.

Please contact Piruz Saboury or Fan Wang for issues or problems.

From other repositories: for research support toolboxes, see matlab toolbox, r toolbox, and python toolbox; for code examples, see matlab examples, stata examples, r examples, python examples, and latex examples; for packaging example, see pkgtestr for developing r packages; for teaching, also see intro statistics for undergraduates.

1 Notations and Functions

  1. Real Number and Intervals: mlx | m | pdf | html
    • Definition and draw a line.
    • m: linspace() + line() + set(gca, yaxis off) + pbaspect()
  2. Interval Notations and Examples: mlx | m | pdf | html
    • Closed, open intervals.
  3. What is a Function?: mlx | m | pdf | html
    • Domain, argument, do-domain, image/value, range.
    • Graph a circle.
    • m: sin() + plot()
  4. Function Notations: mlx | m | pdf | html
    • Consistent function naming.
  5. Monomials and Polynomial of the 3rd Degree: mlx | m | pdf | html
    • Monomial, polynomial, degree of polynomial.
    • Graph polynomial of the 3rd degree and monomials of different degrees.
    • m: syms x + f(x) = a + x + fplot(@(x) f(x,a), [x_low, x_high])
  6. Local and Global Maximum: mlx | m | pdf | html
    • local and global maximum.
    • m: syms + solve() + diff() + double() + double(solve(diff(f,x),x)), fplot(f,[x_low, x_high])

2 Commonly Used Functions

  1. Exponential and Compounding Interest Rates: mlx | m | pdf | html
    • Exponential function and rules: a^b. Base e exponential, e = 2.71828.
    • Infinitely compounding interest rate (continuous time).
    • e^r: borrow 1 dollar, given r, meaning r percent interest, e^r is how much to pay back in principle + interests given infinite compounding.
    • Log linear equation with a constant term, substraction and division.
    • m: exp() + fplot() + double(subs())
  2. Exponential and Log Functions: mlx | m | pdf | html
    • log and natural log (log in matlab base e, log in google base 10).
    • log rules, and why: log(xy) = log(x) + log(y); log(x^a) = alog(x).
    • log difference and small rates of change.
    • m: linspace() + log()

3 Derivatives

  1. Derivative Definition and Rules: mlx | m | pdf | html
    • Derivative notations, limit definition, and key rules.
    • m: syms + diff()
  2. Continuity and Differentiability: mlx | m | pdf | html
    • Continuous point, set and function, continuously differentiable.
  3. Elasticity and Derivative: mlx | m | pdf | html
    • Elasticity of demand at price p, given h change in p.
    • Point elasticity of demand at price p.
    • Elasticity and the limiting definition of derivative.
  4. First Order Taylor Approximation: mlx | m | pdf | html
    • Differential: change along the tangent line to approximate change in function value.
    • First order taylor approximation and the limiting definition of derivative.
    • Differential approximating marginal productivity of labor.
    • m: syms + f(L) = L^a + sub(f, 1)
  5. Higher Order Derivatives Cobb Douglas: mlx | m | pdf | html
    • Cobb-Douglas production function, first and second derivatives.
    • Convex and Concave functions.
    • m: syms + f(L) = L^a + diff(diff(f, L),L) + fplot() + title({‘title one’ ‘subtitle’}) + ylabel({‘ylab abc’ ‘ylab efg’}) + legend{[‘line a’],[‘lineb’],, ‘Location’,’NW’}

4 Univariate Applications

  1. Marginal Product of Labor: mlx | m | pdf | html
    • Marginal product for each additional units of workers given different levels of capital.
    • m: plot() + scatter() + legend([‘k=’,num2str(K1)], [‘k=’,num2str(K1)])
  2. Derivative of Cobb-Douglas Production Function: mlx | m | pdf | html
    • Marginal product of labor given different levels of capitals.
    • m: syms + diff() + fplot()
  3. Derivative Approximation: mlx | m | pdf | html
    • Marginal product and tangent lines.
    • m: syms + diff() + fplot() + lengend{}
  4. Household’s Savings Problem: mlx | m | pdf | html
    • Endowments today and tomorrow, borrowing and savings, no shocks.
    • Grid based or analytical solution.
    • Supply curve of savings (asset).
    • m: max() + diff() + solve() + plot() + scatter()
  5. Firm’s Borrowing Problem: mlx | m | pdf | html
    • Profit maximization choosing capital, with labor fixed.
    • Grid based or analytical solution.
    • Demand curve of capital (asset).
    • Overlay demand and supply curves, visualize interest rate equilibrium
    • m: max() + diff() + solve() + plot() + scatter()

5 Matrix Basics

  1. Laws of Matrix Algebra: mlx | m | pdf | html
    • Scalar: Associative + Communtative + Distributive laws; Matrix: all apply except A times B != B times A.
    • m: transpose()
  2. Matrix Addition and Multiplication: mlx | m | pdf | html
    • Scalar, matrices, and matrix dimensions.
    • m: dot product
  3. Creating Matrixes in Matlab: mlx | m | pdf | html
    • Vectors, matrixes and multiple matrixes.
    • m: ceil() + eye() + tril() + triu() + rand(N,M,Q)

6 System of Equations

  1. System of Linear Equations: mlx | m | pdf | html
    • One or multiple linear equations.
    • Coefficient matrix and augmented form.
  2. Solving for Two Equations and Two Unknowns: mlx | m | pdf | html
    • Two equations and two unknowns matrix form.
    • Graphical intersection of two lines.
    • Using linear solver linsolve.
    • m: linsolve + double(solve(y_1 - y_2 == 0))
  3. System of Linear Equations Row Echelon Form: mlx | m | pdf | html
    • Two equations and two unknowns.
    • Elementary row operations and row echelon form.
  4. Matrix Inverse: mlx | m | pdf | html
    • Find the inverse of a matrix.

7 Matrix Applications

  1. Firm Maximization Problem with Capital and Labor: mlx | m | pdf | html
    • First order conditions Cobb-Douglas production function with Capital and Labor.
    • Log linearize first order conditions, matrix form and linsolve Cobb-Douglas production function.
    • Own and cross price elasticities
    • m: linsolve() + simplify(exp(linsolve())) + mesh() + meshgrid() + contourf() + clabel() + zlabel()
  2. Household Maximization with Two Goods and Budget: mlx | m | pdf | html
    • Preference over two good, cobb douglas utility.
    • Indifference curves and budget set.
    • m: linspace() + meshgrid() + mesh() + contourf() + clabel() + colormap() + zlabel() + plot()
  3. Capital Demand and Supply Equilibrium Analysis: mlx | m | pdf | html
    • Simplified nonlinear form of demand and supply as functions or the interest rate.
    • First order Taylor linear approximation of nonlinear demand and supply.
    • m: diff() + subs(S,r,1) + linsolve()
  4. First Order Taylor Approximation of Demand and Supply Curves: mlx | m | pdf | html
    • Exact solutions for (approximated) equilibrium interest rate and asset supply/demand given linearized demand and supply equations.
    • Graphical illustration of exact equilibrium and linear approximated equilibrium.
    • Analyze how productivity, elasticity, wealth, discount factor impact equilibrium prices and quantity given exact solutions to linear approximation.
    • m: linspace() + subs(diff(S,r), r, r0) + subs(D, {Z,beta}, {Z_num, beta_num}) + fplot() + plot() + line.Color + line.LineStyle

8 Uncertainty

  1. Risky Assets and Different States of the World: mlx | m | pdf | html
    • Bad and good states of the world.
    • Safe savings and risky investments with uncertain returns.
    • Borrowing to finance risky investments.
    • m: solve(diff(U, D)==0, diff(U, B)==0, D, B)

9 Equality Constrained Optimization

  1. Profit Maximization and Cost Minimization: mlx | m | pdf | html
    • Profit maximization and cost minimization with Cobb Douglas production function given quantity constraint. Constant or decreasing returns to scales, optimal capital and labor given quantity constraint.
    • m: GRADIENT = subs(GRADIENT, {A,p,w,r,q,alpha,beta},{1,1,1,1,2,0.3,0.7}) + solu = solve(GRADIENT(1)==0, GRADIENT(2)==0, GRADIENT(3)==0, K, L, m, ‘Real’, true)
  2. Firm Marginal Cost and Profit given Constant Returns to Scale: mlx | m | pdf | html
    • Profit maximization over outputs given cost minimization.
    • Marginal costs and constant returns to scales, perfect competition and zero profits.
  3. Marshallian Constrained Utility Maximization: mlx | m | pdf | html
    • Budget constrained intertemporal utility maximization.
    • Marshallian solutions, indirect utility
    • Analytical solution, matlab symbolic solution, matlab fminunc numerical solutions
    • m: diff() + gradient() + fmincon()
  4. Hicksian Constrained Expenditure Minimization: mlx | m | pdf | html
    • Optimal expenditure minimization choice given indirect utility.
    • Hicksian solutions (Dual Problem).
    • Analytical solution, matlab symbolic solution.
    • m: diff() + gradient()
    • graph: budget + indifference + endowment and optimal choices
  5. Income and Substitution Effects: mlx | m | pdf | html
    • Slusky decomposition, expenditure minimization given two prices.
    • Analytical solution, matlab symbolic solution.
    • m: diff() + gradient()

10 Inequality Constrained Optimization

  1. Firm Profit Maximization Problem with Borrowing Constraint: mlx | m | pdf | html
    • Constrained on capital/borrowing, solve for cases.
    • If constraint binds, re-optimize labor choice given capital bound.
  2. Borrowing and Savings with Borrowing Constraint: mlx | m | pdf | html
    • Unconstrained and constrained problem.
    • Analytical solution and fmincon solution.
    • Optimal borrowing/savings with varying endowments and interests rates.
    • m: U = @(b) log(z1 - b) + matlabFunction(subs(U, {z1, z2}, {z1v, z2v})); + fmincon(U, b0, A, q); + optimoptions(‘FMINCON’,’Display’,’off’);
  3. Labor and Borrowing/Savings Choices with Borrowing Constraint: mlx | m | pdf | html
    • Unconstrained work/leisure and borrow/savings problem.
    • Constrained work/leisure and borrow/savings problem given borrow bound.
    • Analytical and matlab symbolic solutions.
    • Numerical solution with fmincon.
    • m: d_L_b = diff(L, b); + d_L_H = diff(L, H); + GRAD = [d_L_b; d_L_H] + solu = solve(GRAD(1)==0, GRAD(2)==0, b, H, ‘Real’, true); + solu = simplify(solu) + fmincon(U_neg, b0, A, q) + fmincon(U_neg, b0, A, q, [], [], [], [], [], options) + legendCell = cellstr(num2str(Z2_vec’, ‘Z2=%-d’)) + plot()

11 Equilibrium and Policy

  1. Equilibrium Interest Rate and Tax: mlx | m | pdf | html
    • Households supply savings or borrow (with constraint) to smooth consumption.
    • Firms borrow to finance capital inputs.
    • Solve for excess demand and supply of assets and equilibrium interest rate.
    • The effect of a tax on savings and subsidy for borrowing on equilibrium interest rate.
    • m: U_neg = @(x) -1(log(z1 - x(1)) + beta_vec(j)log(z2 + x(1)r_vec(i)(1-tau))) + excess_credit_supply = (sum(b_opti_mat, 2) + (-1)FIRM_K’) + min(abs(excess_credit_supply)) + plot(r, excess_credit_supply)*
  2. Equilibrium Interest Rate and Wage: mlx | m | pdf | html
    • Households supply labor and enjoy leisure, firms demand labor.
    • Households borrow with constraints and supply savings, firm demand capital.
    • Solve for excess supply of assets and labor over wage and interest rates grid.
    • Solve for market clearing wage and interest rates.
    • m: U_neg = @(x) -1(log(z1 + W_vec(j)x(2) - x(1)) + psilog(x(3)) + beta_vec(h)log(z2 + x(1)(R_vec(i)))) + options = optimoptions(‘FMINCON’,’Display’,’off’); + [x_opti,U_at_x_opti] = fmincon(U_neg, b0, A, q, [], [], [], [], [], options); + KD(i,j) = subs(K_opti,{r,w},{R(i), W(j)}) + LD(i,j) = subs(L_opti,{r,w},{R(i), W(j)}) + jet(numel(chart)) + plot(R, b_opti); + plot(R, -k_opti);*

RepoSize CodeSize Language Release License