Math for Economists

Homework 1 Solutions

Provided by Kriti Khanna

February 10th, 2021

1 Definitions

1. Function

A function (or a mapping) is a rule that assigns to every element x of a set X a single

element y of a set Y . It is written as:

f : X → Y

where the arrow indicates mapping, and the letter f symbolically specifies a rule of mapping.

When we write:

y = f(x), we are mapping from argument x in domain X to value y in co-domain Y.

2. Domain/co-domain, argument/value, and range of a function

Domain: big X is the domain of f domain

Co-domain: big Y is the co-domain of f

Arugment: little x is an element in big X, an arugment of the function f.

Value: when y = f(x), we refer to y as the value of x under f.

Range of a function: f(X) =

y ∈ Y : y = f(x) for some x ∈ X

3. Closed interval and open interval

Closed interval:

a, b

≡

x ∈ R : a ≤ x ≤ b

Open interval:

a, b

≡

x ∈ R : a < x < b

4. Real numbers, non-negative real numbers including and excluding zero

Real numbers:

R or R1

(add a superscript 1 to emphasize this is first Euclidean space, either notation is fine).

non-negative real number including and excluding zero:

R≥0 ≡

x ∈ R : x ≥ 0

R>0 ≡

x ∈ R : x > 0

1

5. Global maximum and local maximum

Global maximum:

Function f defined on a domain X has a global maximum at x

∗ ∈ X if for all x ∈ X, f(x) ≤

f(x

∗

).

Local maximum:

Function f defined on a domain X has a local maximum at x

∗ ∈ X if there exists an open

interval (a, b), such that x

∗ ∈ (a, b), and for all x ∈ (a, b), f(x) ≤ f(x

∗

).

6. Monomials and polynomials

·Monomials

Functions of the form: a · x

k are monomials.

a is any real number, it is the coefficient.

k is a positive integer, it is the degree of the monomial.

·Polynomials

Monomials added up together are polynomials a + b · x + c · x

2 + d · x

3 + e · x

4

The coefficients a, b, c, d, e above could be positive or negative.

7. Derivative

The derivative of f at x0 is the slope of the tangent line to the graph of f at (x0, f(x0)).

8. Four common ways of denoting derivative

f

0

(x0)

df

dx (x0)

dy

dx (x0)

fx(x0)

2

2 Simon and Blume exercises

1. 2.1

Please plot the functions using the following commands in Matlab to see their graphs.

1 f p l o t (@( x ) 3∗x−2) % f u n c ti o n i s i n c r e a s i n g eve rywhe re

has no l o c a l o r g l o b a l maxima o r minima

2 f p l o t (@( x ) −2∗x ) % f u n c ti o n i s d e c r e a si n g eve rywhe re

has no l o c a l o r g l o b a l maxima o r minima

3 f p l o t (@( x ) x.^2+1) % has g l o b a l minimum o f 1 a t x = 0 .

I t i s d e c r e a si n g on (−i n f , 0 ) and i n c r e a s i n g on ( 0 ,

i n f )

4 f p l o t (@( x ) x.^3+x ) % i s i n c r e a s i n g everywhere , and has

no l o c a l maxima o r minima .

5 f p l o t (@( x ) x.^3−x ) % has a l o c a l maximum o f 2/3 ( s q r t

( 3 ) ) a t x=−1/s q r t ( 3 ) , and a l o c a l minimum o f −2/3(

s q r t ( 3 ) ) a t 1/ s q r t ( 3 ) , but no g l o b a l maxima o r

minima . I t i n c r e a s e s on (−i n f ,−1/ s q r t ( 3 ) ) and (1/ s q r t

( 3 ) , i n f ) and d e c r e a s e s i n between

6 f p l o t (@( x ) abs( x ) ) % d e c r e a s e s on (−i n f , 0 ) and

i n c r e a s e s on ( 0 , i n f ) . I t has a g l o b a l minimum o f 0 a t

x=0

2. 2.4

(a)x 6= 1

(b)x>1

(c)x ∈ R

(d)x 6= ±1

(e)-1≤x≤1

(f)-1<x≤1;x6=0

3. 2.8

(a)f(x)=2x+3

(b)f(x)=-3x

(c)f(x)=4x-3

(d)f(x)=-2x+2

(e)f(x)=x+1

(f)f(x)=-(7/2)x+3

4. 2.9

(a) The slope is the marginal revenue, that is, the rate at which revenue increases with output.

(b) The slope is the marginal cost, that is, the rate at which the cost of purchasing x units

increases with x.

3

(c) The slope is the rate at which demand increases with price.

(d)The slope is the marginal propensity to consume, that is, the rate at which aggregate consumption increases with national income.

(e)The slope is the marginal propensity to save, that is, the rate at which aggregate savings

increases with national income.

5. 2.10

(a)The geometric definition of the derivative is the limit as h approaches 0 of [

f(x0+h)−f(x0)

h

].

If a function is constant, at any x0, f(x0 + h) = f(x0) = c. So, f(x0 + h) − f(x0) = 0, and

hence the derivative at x0, that is the limit as h approaches 0 of [

f(x0+h)−f(x0)

h

] = 0 .

When f(x) = mx, the derivative at any x0 is given by limit as h approaches 0 [

mx+mh−mx

h

] = m

(b)For k = 3, the derivative of f(x) = x

k

is k ∗ x

k−1

, so the derivative is 3 ∗ x

2

.

For k = 4, the derivative of f(x) = x

k

is k ∗ x

k−1

, so the derivative is 4 ∗ x

3

.

6. 2.11

(a)

1 syms x ;

2 f ( x )=−7∗x . ^ 3 ;

3 de r = d i f f ( f , x ) ;

4 % de r i s −21∗x^2

(b)

1 syms x ;

2 f ( x ) =12∗x.^ −2;

3 de r=d i f f ( f , x ) ;

4 % de r i s −24/x^3

(c)

1 syms x ;

2 f ( x )=3∗x.^( −3/2) ;

3 de r=d i f f ( f , x ) ;

4 % de r i s −9/(2∗x^ (5/2 ) )

(d)

1 syms x ;

2 f ( x ) =1/2∗ s q r t ( x ) ;

3 de r=d i f f ( f , x ) ;

4 % de r i s 1/ (4∗ x^ (1/2 ) )

(e)

1 syms x ;

2 f ( x ) =(3∗x . ^2 ) −(9∗x ) +(7∗x . ^ ( 2 / 5 ) ) −(3∗x . ^ ( 1 / 2 ) ) ;

3 de r=d i f f ( f , x ) ;

4 % de r i s 6∗x − 3/ (2∗ x^ (1/2 ) ) +14/(5∗x^ (3/5 ) )−9

4

(f)

1 syms x ;

2 f ( x ) =(4∗x . ^5 ) −(3∗x . ^ ( 1 / 2 ) ) ;

3 de r=d i f f ( f , x ) ;

4 % de r i s 20∗x^4−3/(2∗x^ (1/2 ) )

(g)

1 syms x ;

2 f ( x ) =((x . ^2 ) +(1) ) ∗ ( ( x . ^2 ) +(3∗x ) +(2) ) ;

3 de r=d i f f ( f , x ) ;

4 % de r i s (2∗ x+3) ∗( x^2+1)+2∗x ∗( x^2+3∗x+2)

(h)

1 syms x ;

2 f ( x ) =((x . ^ ( 1 / 2 ) +(x.^( −1/2) ) ∗(4∗ x . ^5 ) −(3∗ s q r t ( x ) ) ) ;

3 de r=d i f f ( f , x ) ;

4 % de r i s −(1/x^ (1/2 )+x^ (1/2 ) ∗(3/ (2∗ x^ (1/2 ) )−20∗x^4)

−(1/(2∗x^ (1/2 ) ) ) −1/(2∗x^ (3/2 ) ∗(3∗ x^ (1/2 )−4∗x^5)

(i)

1 syms x ;

2 f ( x )=(x−1) / ( x+1) ;

3 de r=d i f f ( f , x ) ;

4 % de r i s 1/ ( x+1)−(x−1) / ( x+1)^2

(j)

1 syms x ;

2 f ( x )=x / ( ( x . ^2 ) +1) ) ;

3 de r=d i f f ( f , x ) ;

4 % de r i s 1/ ( x^2+1)−(2∗x^2) / ( x^2+1)^2

(k)

1 syms x ;

2 f ( x ) =((x . ^5 ) −(3∗x . ^2 ) ) . ^ 7 ;

3 de r=d i f f ( f , x ) ;

4 % de r i s −7∗(−5∗x^4+6∗x ) ∗(−x^5+3∗x^2)^6

(l)

1 syms x ;

2 f ( x ) =(5∗((x . ^5 ) −(6∗x . ^2 ) +(3∗x ) ) . ^ ( 2 / 3 ) ) ;

3 de r=d i f f ( f , x ) ;

4 % de r i s (10∗(5∗ x^4−12∗x+3)) / (3∗( x^5−6∗x^2+3∗x ) ^ (1/3 ) )

(m)

1 syms x ;

2 f ( x ) =(((x . ^3 ) +(2∗x ) ) . ^3 ) ∗( (4∗ x+(5) ) . ^ 2 ;

5

3 de r=d i f f ( f , x ) ;

4 % de r i s ( x^3+2∗x ) ^3∗(32∗x+40)+3∗(x^3+2∗x ) ^2∗(4∗x+5)

^2∗(3∗x^2+2)

7. 2.12

(a)y = 6x − 9

(b)y = (1/9)x + (2/9)

8. 2.16

(a)

1 f p l o t (@( x ) x^2 , [ 0 , 1 0 0 ] )

2 f p l o t (@( x ) −x^2 , [ −100 ,0 ) )

(b)

1 f p l o t (@( x ) x^2+1, [ 0 , 1 0 0 ] )

2 f p l o t (@( x ) −x^2−1, [ −100 ,0 ) )

(c)

1 f p l o t (@( x ) x^2 , [ −100 ,1] )

2 f p l o t (@( x ) x , [ 1 , 1 0 0 ] )

(d)

1 f p l o t (@( x ) x^3 , [ −100 ,1 ) )

2 f p l o t (@( x ) 3x−2, ( 1 , 1 0 0 ] )

Note: for some of these questions, you can get the answer from matlab, but you should also derive it

analytically. So please write down your steps. For example, for 2.11, you can use matlab’s symbolic

toolbox1

to get all the derivatives to check with your own calculations.

1 % D e fi n e the symbols

2 syms x

3 % D e fi n e e q ua tio n with symbols

4 f ( x ) = −7∗x^3;

5 % Take d e r i v a t i v e o f f with r e s p e c t to x

6 f_di f f_ x = d i f f ( f , x )

7 % show d e r i v a t i v e

8 f_di f f_ x

9 % e v al u a t e d e r i v a t i v e a t x = 1

10 f_di f f_ x ( 1 )

1Make sure you install matlab’s symbolic toolbox. To check what toolboxes you have, type in: ver, inside matlab.

If you do not have the symbolic toolbox listed, go to the Mathworks website where you downloaded matlab, go

through the download process again, and check symbolic toolbox when you reach the screen that asks you what

toolboxes you want.

6

3 Household Savings Problem

Please read this first: Course Webpage Savings and Borrowing Example Code.

3.1 Write down the problem

1. Write down a two period savings maximization problem with log utility. There is a fund that

provides you with the first installment of inherited wealth of Z in the initial period, and an

additional installment of inherited wealth that is half of what is provided in the initial period,

Z

2

, in the second period. Write down the problem means writing down the utility, budget, etc,

and indicate clearly what is the choice set that you are maximizing over. Do not use specific

numbers, but write down the general problem using r for interest rate, use β for discount rate,

and use z to stand for inherited wealth.

Ans.

U tility = log(z1) + β · log(z2)

c1 = log [z − save]

c2 = β · log h

z

2

+ save · (1 + r)

i

max

save∈[0,z)

log(z − save) + β · log h

z

2

+ save · (1 + r)

i

2. Imagine that you face the problem described above. If you were borne in an odd month, imagine that Z = 100, 000 dollars. If you were borne in an even month, imagine that Z = 20000

dollars. Suppose the interest rate is r = 1.05. You are taking 2 years off to enjoy life, but

have no other sources of income this year and next year. How much of the money will you

spend this year and how much next year? Do NOT compute anything, this is a survey question, about your personal preference. We will compare your answers in class, and compare

conditional on even vs odd birth months.

Ans.

Just show your own preference.

3.2 Finding optimal choice using three methods at a specific r

Use the following matlab code to draw a random number for discount rate beta, β, and for wealth

parameter, Z. Search online for what the rand() function is doing:

1 % d e f i n e max and min

2 max_beta = 0 . 9 9 ;

3 min_beta = 0 . 8 0 ;

4 max_Z = 5 0;

5 min_Z = 1 0;

6 % Draw random number between min and max

7 (max_beta−min_beta ) ∗ rand ( ) + min_beta

8 (max_Z−min_Z) ∗ rand ( ) + min_Z

7

1. The numbers you drew are your random wealth endowment, and a random discount rate.

Using the code we have from class (Note:: you have to modify it slightly, because the code

in class only had inherited wealth in the initial period, now we have inherited wealth in both

periods as described earlier), based on the grid-brute-force method, draw the utility function

values along choice grid points, and find the optimal savings choice. Interest r = 1.05, and

use log utility. Using the definition for derivative, with x0 equal to the optimal savings you

just found, and h = 0.1, h = 0.01 and h = −0.1, h = −0.01, calculate the rise over run slopes

around your optimal choice point.

Ans.

1. Use matlab code from github page. After getting the optimal saving, plugging into the

function [

f(x0+h)−f(x0)

h

} with different h value.

2. Analytically solve the household maximization problem by taking derivative of the utility

function with respect to the savings choice. To solve this, figure out what is the derivative

of log(x) with respect to x. Set the derivate to equal to 0 and solve for the optimal savings

choice.

Ans.

x = saving

U(x) = log (z − x) + β · log h

(

z

2

) + x · (1 + r)

i

max

x

log (z − x) + β · log h

(

z

2

) + x · (1 + r)

i

dU

dx

= 0

s =

z · β · (1 + r) −

z

2

(1 + r) · (1 + β)

Then we will get a “function” between saving and interest rate. Which is a supply curve in

the credit market where x-axis is “saving” and y-axis is “interest rate”.

So when we plug into different interest rate, we can get different optimal saving.

3. Write the model in matlab using symbolic toolbox. Take derivate, and solve for where derivate

equals 0.

Ans.

1 syms z be ta r x

2 f_U = l o g ( z − x ) + be ta ∗ l o g ( ( z /2 ) + x∗(1+r ) )

3 dU_dx = d i f f (f_U, x )

4 x_opti = s o l v e (dU_dx==0, x )

3.3 Supply curve of credit

1. Given the parameters you drew earlier, solve your problem now at 21 interest rate points,

evenly spaced between r = 1.0 and r = 1.20. Write down your agent’s optimal choice at

8

each rate point. Draw a supply curve for this individual. Write a few sentences interpreting

this curve. You can solve for this computationally. You can also derive this curve using the

analytical equations from earlier. Solve your analytical problem with the r inside the equation,

what is the optimal savings choice as a function of r?

Ans.

First step is to generate a vector of interest rate between 1 and 1.2 with grid points number

of points. Second, plugging the vector into this function.

s =

z · β · (1 + r) −

z

2

(1 + r) · (1 + β)

Third, we can plot the graph of the function.

1 z=50;

2 be ta =0.95;

3 g ri d_ poi n t s = 2 1;

4 r = l i n s p a c e ( 1 . 0 , 1 . 2 , g ri d_ poi n t s ) ;

5 % u se the . f o r d i v i s i o n becau se i t i s a v e c t o r di vi d e d

by ano the r v e c t o r

6 s=(z ∗ be ta ∗(1+r )−(z /2 ) ) ./ ( (1+ r ) ∗(1+be ta ) )

7 pl o t (s , r )

2. Suppose there are four types of people in the economy, use the commands below to draw

fractions of these four types of people and write them down.

1 % Type 1 f r a c t i o n

2 f r a c 1 = rand ( )

3 f r a c 2 = (1 − f r a c 1 ) ∗ rand ( )

4 f r a c 3 = (1 − f r a c 1 − f r a c 2 ) ∗ rand ( )

5 f r a c 4 = 1 − f r a c 1 − f r a c 2 − f r a c 3

Ans.

You will get 4 random number.

3. Type 1 is patient and wealthy: β = 0.95 and Z = 30, type 2 is patient and poor: β = 0.95 and

Z = 10, type 3 is impatient and wealthy: β = 0.85 and Z = 30, and type 4 is impatient and

poor: β = 0.85 and Z = 10. Given the fractions of people you have from each of these groups,

solve for the aggregate supply curve for credit in your economy. Draw each supply curve by

itself, and then draw the aggregate curve. Here, you can solve for these computationally.

You can also derive these analytically. Solve your analytical problem with r and β and Z as

symbols, how does optimal choice change as a function of these three values? Ans.

Plug into 4 different value of β and Z and get 4 different supply functions.

Aggregate supply curve is the sum of each fraction time each supply function.

Here is the supply function:

s1 =

z1 · β1 · (1 + r) −

z1

2

(1 + r) · (1 + β1)

s2 =

z2 · β2 · (1 + r) −

z2

2

(1 + r) · (1 + β2)

9

s3 =

z3 · β3 · (1 + r) −

z3

2

(1 + r) · (1 + β3)

s4 =

z4 · β4 · (1 + r) −

z4

2

(1 + r) · (1 + β4)

Aggregate Supply = frac1 · s1 + frac2 · s2 + frac3 · s3 + frac4 · s4

10

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Phasellus hendrerit. Pellentesque aliquet nibh nec urna. In nisi neque, aliquet vel, dapibus id, mattis vel, nisi. Sed pretium, ligula sollicitudin laoreet viverra, tortor libero sodales leo, eget blandit nunc tortor eu nibh. Nullam mollis. Ut justo. Suspendisse potenti.

Sed egestas, ante et vulputate volutpat, eros pede semper est, vitae luctus metus libero eu augue. Morbi purus libero, faucibus adipiscing, commodo quis, gravida id, est. Sed lectus. Praesent elementum hendrerit tortor. Sed semper lorem at felis. Vestibulum volutpat, lacus a ultrices sagittis, mi neque euismod dui, eu pulvinar nunc sapien ornare nisl. Phasellus pede arcu, dapibus eu, fermentum et, dapibus sed, urna.

Morbi interdum mollis sapien. Sed ac risus. Phasellus lacinia, magna a ullamcorper laoreet, lectus arcu pulvinar risus, vitae facilisis libero dolor a purus. Sed vel lacus. Mauris nibh felis, adipiscing varius, adipiscing in, lacinia vel, tellus. Suspendisse ac urna. Etiam pellentesque mauris ut lectus. Nunc tellus ante, mattis eget, gravida vitae, ultricies ac, leo. Integer leo pede, ornare a, lacinia eu, vulputate vel, nisl.

Suspendisse mauris. Fusce accumsan mollis eros. Pellentesque a diam sit amet mi ullamcorper vehicula. Integer adipiscing risus a sem. Nullam quis massa sit amet nibh viverra malesuada. Nunc sem lacus, accumsan quis, faucibus non, congue vel, arcu. Ut scelerisque hendrerit tellus. Integer sagittis. Vivamus a mauris eget arcu gravida tristique. Nunc iaculis mi in ante. Vivamus imperdiet nibh feugiat est.

Ut convallis, sem sit amet interdum consectetuer, odio augue aliquam leo, nec dapibus tortor nibh sed augue. Integer eu magna sit amet metus fermentum posuere. Morbi sit amet nulla sed dolor elementum imperdiet. Quisque fermentum. Cum sociis natoque penatibus et magnis xdis parturient montes, nascetur ridiculus mus. Pellentesque adipiscing eros ut libero. Ut condimentum mi vel tellus. Suspendisse laoreet. Fusce ut est sed dolor gravida convallis. Morbi vitae ante. Vivamus ultrices luctus nunc. Suspendisse et dolor. Etiam dignissim. Proin malesuada adipiscing lacus. Donec metus. Curabitur gravida

WhatsApp us