Hide code cell source
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import math

7.14. Solutions to Exercises#

7.14.1. Linear Systems and the Two-Commodity Model#

1. Let \(x\) be the units of necessities and \(y\) the units of luxuries. Then \(30x+100y=4000\) and \(y=\frac{1}{10}x\). This implies that \(40x=4000\) so \(x=100\) and \(y=10\).

2. A \(10\%\) decrease in budget gives \(30x+100y=3600\) with \(y=\frac{1}{10}x\). The equilibrium bundle is \(x=90\), \(y=9\). A \(10\%\) increase in unit prices gives \(33x+110y=4000\) with \(y=\frac{1}{10}x\) so \(x=90.9\) and \(y=9.09\). So a decreased budget results in a greater loss of buying power.

3. A \(10\%\) increase in budget gives \(30x+100y=4400\), \(y=\frac{1}{10}x\). The equilibrium bundle is \(x=110,y=11.\) A \(10\%\) decrease in prices gives \(27x+9y=4000\), \(y=\frac{1}{10}x\). The equilibrium bundle is \(x=111.1,y=11.1\). So the decrease in prices has the greater gain in buying power.

4. The solid black line is the original budget. The other lines in order of increasing buying power are \(10\%\) decrease of income, \(10\%\) increase in prices, \(10\%\) increase in income, and \(10\%\) decrease in prices.

7.14.2. Marginal and Average Cost#

1.

\[ATC=\frac{TC}{Q}=.5 Q^2 - 3Q + 12 + 50/Q \]
\[MC = TC'(Q)= 1.5 Q^2 - 6Q + 12\]
Hide code cell source
Q = np.linspace(1,8,100)
ATC= .5*Q**2-3*Q+12+50/Q #average total cost
MC=1.5*Q**2-6*Q+12 # second function
plt.figure(figsize=(8, 4))
plt.plot(Q,ATC,color='k',label="ATC")
plt.plot(Q,MC,color='r',linestyle=":",label="MC")
plt.xlim((0.,8))
plt.ylim((0,60.))
plt.grid()
plt.legend()
plt.show()
../../_images/4004c775d63355debf1995f1dd3a38122bdc3a74c1e6752d2562c70c3e74f526.png

From the graph it appears ATC=MC at \(Q=5\). We can check this:

\[ATC(5)= .5 (5^2)-3(5)+12 + \frac{50}{5}=19.5.\]
\[MC(5)=1.5(5^2)-6(5)+12=19.5.\]

Finally, note that

\[ ATC'(Q) = Q - 3 -\frac{50}{Q^2}. \]

At \(Q=5\), \(ATC'(5)= 5 - 3 - \frac{50}{5^2}=0\).

2.

\[ATC=\frac{TC}{Q}=-10 Q^2 +128 Q + 3. \]
\[MC = TC'(Q)= -30Q^2+256Q+3.\]
Hide code cell source
Q = np.linspace(0,8,100)
ATC= -10*Q**2+128*Q+12+3 #average total cost
MC=-30*Q**2+256*Q+4 # second function
plt.figure(figsize=(8, 4))
plt.plot(Q,ATC,color='k',label="ATC")
plt.plot(Q,MC,color='r',linestyle=":",label="MC")
plt.xlim((0.,8))
plt.ylim((0,600.))
plt.grid()
plt.legend()
plt.show()
../../_images/2760740bb62c5608fca92ca97715463e1f5619674187be630438855f95d091bd.png

The graph does not show clearly the value of \(Q\) at the intersection. Note that \(ATC'(Q)=-20Q+128=0\) when \(Q=6.4\).

We can check that \(ATC(6.4) = MC(6.4)=412.6\).

3.

\(ATC= TC/Q\), so by the quotient rule, \(ATC'(Q)=0\) when

\[ \frac{Q \cdot MC - TC}{Q^2}=0.\]

This occurs when \(Q \cdot MC - TC=0\), or \(MC = \frac{TC}{Q}=ATC\).

7.14.3. Optimization and Object Design#

1.

a) ../../_images/fig34.png

b) \(h=\frac{250}{\pi x^2}\).

c) \(f(x)=2\pi x^2 + 500x^{-1}\).

d) \(f'(x)=4\pi x - 500 x^{-2}\)

e) \(x=(125/\pi)^{1/3}\)

f) \( h = 2 (125/\pi)^{1/3} = 2x\).

g) The height of the can and its diameter are equal. The can is ‘square-shaped’.

h)

\[f'(x)= 4\pi x - 500 x^{-2}\]
\[f''(x)= 4\pi + \frac{1000}{x^3}\]

When \(x = (125/\pi)^{1/3}\). \(f''(x)>0\), hence there is a minimum value for \(f\).

2. a) Volume \(V(h) = \frac{\pi}{3}(r^2h-h^3)\)

\(V'(h) = \frac{\pi}{3}(r^2-3h^2)=0\) when \(h= \pm \frac{r}{\sqrt{3}}\). (\(h\) must be positive)

\(V(\frac{r}{\sqrt{3}})= \frac{2\pi r^3}{9\sqrt{3}}\).

b) \(V''(h)=\frac{\pi}{3}(-6h)<0\) when \(h=\frac{r}{\sqrt{3}}\) so the volume is maximized.

c) The graph and code to make it are shown below:

Hide code cell source
import matplotlib.pyplot as plt
import numpy as np
import sympy as sp


# Create a symbolic expression for the given equation
h = sp.symbols('h')
V = sp.lambdify(h, (np.pi/3)*(h - h**3))

h_vals = np.linspace(0,1,100)
# Plot f(x), L(x), and the point (a, f(a))
plt.plot(h_vals, V(h_vals))

plt.xlabel("h")
plt.ylabel("V")
plt.title("Paper Cone's Volume V as a Function of its height h")
plt.grid(True)
plt.axhline(0, color="black", linewidth=0.5)
plt.axvline(0, color="black", linewidth=0.5)
plt.show()
../../_images/a67e4e83e6c8f1c0b6879a421f636a1d17b11d0a8d94b7dbdc9ff87182370473.png

7.14.4. Optimization and Cobbs-Douglas Production#

1.

\[ 10L + 20K + 20 =3040 \Rightarrow 20K = 3020 - 10L \Rightarrow K=151 - .5L. \]
\[ Q=2L^{.4}(151-.5L)^.6 \]
\[ \frac{dQ}{dL}=2[.4L^{-.6}(151-.5L)^{.6}+L^{.4}(.6)(151-.5L)^{-.4}(-.5)]= \]
\[ \frac{.8(151-.5L)^{.6}}{L^{.6}}-\frac{.6L^{.4}}{(151-.5L)^{.4}}=0\Rightarrow \]
\[ .8(151-.5L)=.6L. \]

Solving the last equation for \(L\) gives \(L=120.8\).

\[ K=151-.5L=151-.5(120.8)=90.6 \]

The maximum production is \(Q=2(120.8)^{.4}(90.6)^{.6}=203.3.\)

Hide code cell source
import matplotlib.pyplot as plt
import numpy as np
import sympy as sp


# Create a symbolic expression for the given equation
L = sp.symbols('L')
Q = sp.lambdify(L, 2*L**(.4) * (151-.5*L)**(.6))

Q_vals = np.linspace(0,250,500)
# Plot Q(L)
plt.plot(Q_vals, Q(Q_vals))

plt.xlabel("L")
plt.ylabel("Q")
plt.title("Optimal Production")
plt.grid(True)
plt.axhline(0, color="black", linewidth=0.5)
plt.axvline(0, color="black", linewidth=0.5)
plt.show()
../../_images/73d238bf7c13de6fe3ec3d28615ed23e0b138fdd62ef926dbceefc3acdf0068f.png

2.

\[ 130=2L^{.4}K^{.6}\Rightarrow\frac{130}{2L^{.4}}=K^{.6}\Rightarrow K = (\frac{65}{L^{.4}})^{5/3}=65^{5/3}L^{-2/3} \]
\[ TC=10L+20(65^{5/3}L^{-2/3})+20 \]
\[ TC'=10 - \frac{40}{3}65^{5/3}L^{-5/3}=0 \Rightarrow L=77.246 \]

Note that \(TC''=\frac{200}{9}65^{5/3}L^{-7/3}>0\) so there is a minimum at \(L=77.25\).

\(K=65^{5/3}(77.246)^{-2/3}\approx 57.9346\).

The minimum total cost is \(10(77.246)+20 (57.9346)+20\approx 1951.15\).

7.14.7. Probability Distributions and Drive Thrus#

1. a) \(\int_0^2 e^{-t}\,dt = -e^{-t}\mid_0^2 = -e^{-2} - -e^{0} = 1 - e^{-2}\)

b) \(\int_0^\infty k e^{-t}\,dt = -e^{-t}\mid_0^\infty = \lim_{t\to\infty} -e^{-t} + e^{0} - -e^{0} = 0 + 1 = 1\)

c)

\[\int_0^1 k e^{-kt}\,dt = 0.5 \Rightarrow\]
\[-e^{-kt}\mid_0^1 = 0.5 \Rightarrow\]
\[-e^{-k(1)} - -e^{-k(0)} = -e^{-k} + 1 = 0.5 \Rightarrow\]
\[e^{-k} = 0.5 \Rightarrow\]
\[-k = \ln{0.5} \Rightarrow\]
\[k = -\ln{0.5} \approx 0.693\]

d)

\[F(x) = \int_0^x -ln{0.5} e^{\ln{0.5} t} \,dt = \]
\[\int_0^x -ln{0.5} 0.5^{t} \,dt = \]
\[ -0.5^{t}\mid_0^x = \]
\[ -0.5^{x} - -0.5^{0} = \]
\[ -0.5^{x} + 1 = \]
\[ 1 - 0.5^{x}\]

e) \(F(3) = 1 - 0.5^{3} = 0.875\)

2. a)

\[f(x) = \frac{1}{30} (5\leq x \leq 35)\]
\[F(t) = prob(5 \leq x \leq t) = \int_{5}^{t} 1/30 \,dt = \frac{1}{30}x\mid_{5}^t = \frac{t-5}{30}\]
\[r = \frac{P-5}{30} \Rightarrow \]
\[P = 30r + 5\]

b)

\[f(x) = \frac{1}{15} (5\leq x \leq 20)\]
\[F(t) = prob(5 \leq x \leq t) = \int_{5}^{t} 1/15 \,dt = \frac{1}{15}x\mid_{5}^t = \frac{t-5}{15}\]
\[r = \frac{P-5}{15} \Rightarrow \]
\[P = 15r + 5\]

3.

\[g(x) = \frac{1}{60} (30\leq x \leq 90)\]
\[g(t) = prob(30 \leq x \leq t) = \int_{30}^{t} 1/60 \,dt = \frac{1}{60}x\mid_{30}^t = \frac{t-30}{60}\]
\[r = \frac{F-30}{60} \Rightarrow \]
\[F = 60r + 30\]

7.14.8. Normal Distribution and Process Control#

1.

../../_images/AC8.1solution1.png ../../_images/AC8.1solution2.png ../../_images/AC8.1solution3.png

2. a) \(100 \cdot 0.997 = 99.7%\)

b) \(100 \cdot (0.003 / 2) = 0.15%\)

c) \(99.7 + 0.15 = 99.85%\)

3. a)

../../_images/AC8.3solution.png

b) Yes, 0.9825 and 1.0035

4.

\[f(x) = \frac{1}{1 \cdot \sqrt{2\pi}} e^{-\frac{(x-1)^2}{2 \cdot 0.01^2}}\]
\[f'(x) = \frac{1}{1 \cdot \sqrt{2\pi}} e^{-\frac{(x-1)^2}{2 \cdot 0.01^2}} [\frac{-(x-1)}{0.01^2}]\]
\[f''(x) = \frac{1}{1 \cdot \sqrt{2\pi}} e^{-\frac{(x-1)^2}{2 \cdot 0.01^2}}[\frac{(x-1)^2}{0.01^4}-\frac{1}{0.01^2}]\]
../../_images/AC8.4solutiona.png

From the first derivative test, we can see that there is an absolute maximum at \(x = 1\). Generally, the absolute minimum is found at \(x = \mu\) for normal distribution functions.

From the second derivative test, we can see that there are inflection points at \((0.99, 24.197)\) and \((1.01, 24.197)\). Generally, the inflection points are found at \(x = \mu \pm \sigma\) for normal distribution functions.

7.14.9. Partial Derivatives and OLS Regression#

1. The plot and code to make it are shown below:

Hide code cell source
plt.figure(figsize=(8, 4))
plt.xlim((0,4.2))
plt.ylim((0,4.2))
hs=[2.0,2.5,3.0,3.0,3.5,3.5,4.0,4.0]
col=[1.5,2.0,2.5,3.5,2.5,3.0,3.0,3.5]
plt.scatter(hs,col,color='r',marker='x')
plt.gca().set_xticks(np.arange(0,5,1))
plt.grid()
plt.xlabel("High School GPA")
plt.ylabel("College GPA")
plt.show()
../../_images/921676bc04b89e76197c7d6fe89146f352d524d107fb6497fe6d48408b27b6bc.png

2.

\[S=(2m+b-1.5)^2+(2.5m+b-2)^2+(3m+b-2.5)^2+(3m+b-3.5)^2+(3.5m+b-2.5)^2+(3.5m+b-3)^2+(4m+b-3)^2+(4m+b-3.5)^2\]
\[\frac{\partial S}{\partial m}=4(2m+b-1.5)+5(2.5m+b-2)+6(3m+b-2.5)+6(3m+b-3.5)+7(3.5m+b-2.5)+7(3.5m+b-3)+8(4m+b-3)+8(4m+b-3.5)=169.5 m + 51 b - 142.5 = 0 \]
\[\frac{\partial S}{\partial b}=2(2m+b-1.5)+2(2.5m+b-2)+2(3m+b-2.5)+2(3m+b-3.5)+2(3.5m+b-2.5)+2(3.5m+b-3)+2(4m+b-3)+2(4m+b-3.5)=51 m + 16 b - 43 = 0 \]

Solving the system gives \(m\approx .784\), \(b\approx .189\).

Hide code cell source
plt.figure(figsize=(8, 4))
plt.xlim((0,4.2))
plt.ylim((0,4.2))
hs=[2.0,2.5,3.0,3.0,3.5,3.5,4.0,4.0]
col=[1.5,2.0,2.5,3.5,2.5,3.0,3.0,3.5]
plt.scatter(hs,col,color='r',marker='x')
#--plot the OLS regression line-----
m=.784
b=.189
xreg=np.linspace(0,5,50)
yreg=m*xreg+b
plt.plot(xreg,yreg,label="OLS Regression Line")
plt.gca().set_xticks(np.arange(0,5,1))
plt.grid()
plt.xlabel("High School GPA")
plt.ylabel("College GPA")
plt.show()
../../_images/50e5bcf402ced74d681e58ef032073ca727423c52fe46fd3e462fceb019053cf.png

Solution to exercise 3

\[ \frac{\partial^2 S}{\partial m^2} = 169.5\]
\[ \frac{\partial^2 S}{\partial b^2} = 16\]
\[ \frac{\partial^2 S}{\partial m\partial b} = 51\]
\[ D = (169.5)(16)-51^2=111>0\]

Since \(D>0\) and \(S_{mm}>0\), \(S\) is minimized.

Solution to Exercise 4

GPA

High School GPA:

2.0

3.0

4.0

College GPA:

1.76

2.54

3.3

7.14.10. Area between curves and the GINI index#

1.

\[GI_1= 2\int_0^1(x-x^{1.7})\,dx = 2(\frac{x^2}{2}-\frac{x^{2.7}}{2.7})\mid_0^1=2(\frac{1}{2}-\frac{1}{2.7})\approx .259. \]
\[GI_2= 2\int_0^1(x-(.8x^2+.2x))\,dx = 2\int_0^1(.8x-.8x^2)\,dx 2(.8)(\frac{x^2}{2}-\frac{x^3}{3})\mid_0^1=1.6(\frac{1}{2}-\frac{1}{3})\approx .27. \]

Profession 1 has a slightly more even salary distribution.

2.

Hide code cell source
plt.figure(figsize=(8, 4))
plt.xlim((0,1.))
plt.ylim((0,1.))
x=np.linspace(0,1,100)
f=x**1.7
g=x
plt.plot(x,f,color='r',label='L1(x)=x^1.7')
plt.plot(x,g,color='k',label='g(x)=x')
plt.fill_between(x,f,g,color='lightgray')
plt.grid()
plt.legend()
plt.xlabel("x")
plt.ylabel("y")
plt.text(.3,.7,"Shaded area A=.13")
plt.show()
../../_images/7abcc3b0b66ba9433e35e273f4f3d75feedb61694a133624813dcda61a547d62.png
Hide code cell source
plt.figure(figsize=(8, 4))
plt.xlim((0,1.))
plt.ylim((0,1.))
x=np.linspace(0,1,100)
f=.8*x**2+.2*x
g=x
plt.plot(x,f,color='r',label='L2(x)=.8x^2+.2x')
plt.plot(x,g,color='k',label='g(x)=x')
plt.fill_between(x,f,g,color='lightgray')
plt.grid()
plt.legend()
plt.xlabel("x")
plt.ylabel("y")
plt.text(.3,.7,"Shaded area A=.135")
plt.show()
../../_images/cc5d19a2f3835d990ecd2036d3ea81d6ad1127c9b80a8d3fa0215fb4610420bf.png

One further plot shows the two Lorentz curves nearly coincide.

Hide code cell source
plt.figure(figsize=(8, 4))
plt.xlim((0,1.))
plt.ylim((0,1.))
x=np.linspace(0,1,100)
L1=x**1.7
L2=.8*x**2+.2*x
g=x
plt.plot(x,L1,color='r',label='L1(x)=x^1.7')
plt.plot(x,L2,color='b',label='L2(x)=.8x^2+.2x')
plt.plot(x,g,color='k',label='g(x)=x')
plt.grid()
plt.legend()
plt.xlabel("x")
plt.ylabel("y")
plt.show()
../../_images/7d079d33f0218e452b1be52dcb2718f7799d8e62ec834c6a978d740ea21cf23d.png

7.14.11. Integral Test and Income Streams#

1. The total at \(t=4\) will be

\[10,500 e^{.05(3)} + 11,000 e^{.05(2)} + 11,500 e^{.05} + 12,000 \approx 48,446.\]

2.

Hide code cell source
f = lambda t : (10000+500*t)*math.e**(.05*(4-t))
a = 0; b = 4; N = 4
n = 10 # Use n*N+1 points to plot the function smoothly
#right endpoint rule
t = np.linspace(a,b,N+1)
y = f(t)
T = np.linspace(a,b,n*N+1)
Y = f(T)

plt.figure(figsize=(5,5))
plt.gca().set_xticks([1,2,3,4])
plt.plot(T,Y,'r', linestyle =':')
t_right = t[1:] # right endpoints
y_right = y[1:]
plt.plot(t_right,y_right,'k.',markersize=10)
plt.bar(t_right,y_right,width=-(b-a)/N,alpha=0.1,align='edge',color='k',edgecolor='k')
plt.title('Right Rectangle Sum, N = {}'.format(N))
plt.xlabel('Time t investment of 10,000+500t dollars with interest')
plt.ylabel('Value of investment at t=4')
plt.text(1,12300,"f(t)=(10,000+500t)e^{.05(4-t)}",color='r')
plt.text(.3,11800,"A_1")
plt.text(1.3,11800,"A_2")
plt.text(2.3,11800,"A_3")
plt.text(3.3,11800,"A_4")
plt.ylim((11000, 12500)) 
#plt.grid()
plt.savefig('4 period.png')
plt.show()
../../_images/9c6b89b75316fe55542436ad3e31627b4dd0feb1a8abe423e659582a42d2b5cf.png

3. Note that

\[e^{.05 (4-t)}=e^{.05(4)}e^{.05(-t)}.\]

4. Note that if we invest \(P_4\) at \(t=0\), this amount will grow by the end of year 4 to an amount \(e^{.05(4)}P_4\approx 48,561.10\). The latter amount is the area under the curve \(e^{.05 (4-t)}\) on the interval \(0\let\le 4\), which by problem 2) is greater than \(A_1+A_2+A_3+A_4\).

5.

\[P_{\infty}=\int_0^{\infty}(10,000+500t)e^{-.05t}=\]
\[(10,000+500t)(-20e^{-.05t})\mid_0^{\infty} + 10,000(-20)e^{-.05t}\mid_0^{\infty}=\]
\[200,000 + 200,000 = 400,000.\]

7.14.12. Ordinary Differential Equations and Exponential Growth/Decay#

1. a) \(\frac{dy}{dt} = 5 - 0.01y\)

b)

\[\frac{dy}{dt} = 5 - 0.01y \Rightarrow\]
\[\int \frac{1}{5-0.01y}\,dt = \int \,dt \Rightarrow\]
\[-100 \ln{|5-0.01y|} = t + c \Rightarrow\]
\[\ln{|5-0.01y|} = \frac{t + c}{-100} \Rightarrow\]
\[5-0.01y = Ce^{\frac{t}{-100}} \Rightarrow\]
\[5-Ce^{\frac{t}{-100}} = 0.01y \Rightarrow\]
\[y = 500 - Ce^{\frac{t}{-100}}\]

Plug in \(y(0) = 100\) to find the value of C.

\[(100) = 500 - Ce^{\frac{(0)}{-100}} \Rightarrow\]
\[100 = 500 - C \Rightarrow\]
\[C = 400\]

The final equation is \(y = 500 - 400e^{\frac{t}{-100}}\)

c)

\[400 = 500 - 400e^{-\frac{t}{100}} \Rightarrow\]
\[100 = 400e^{-\frac{t}{100}} \Rightarrow\]
\[\frac{1}{4} = e^{-\frac{t}{100}} \Rightarrow\]
\[\ln{\frac{1}{4}} = \ln{e^{-\frac{t}{100}}} \Rightarrow\]
\[-2\ln{2} = -\frac{t}{100} \Rightarrow\]
\[t = 200\ln{2} \approx 138.629\]

The pollution level will become unsafe during the 138th day.

d)

../../_images/AC12.1solution.png

2. We can prove the rule of 72 using the formula for compound interest, \(A = P(1 + \frac{r}{100})^t\), where \(A\) is the amount accumulated, \(P\) is the principal amount, \(r\) is the interest rate, and \(t\) is the time (in years) the money has been invested. We are trying to prove that \(t = \frac{72}{r}\) when \(A = 2P\).

\[2P = P(1 + \frac{r}{100})^t \Rightarrow\]
\[2 = (1 + \frac{r}{100})^t\]
\[\ln{2} = t \cdot \ln{(1 + \frac{r}{100})} \Rightarrow\]
\[t = \frac{\ln{2}}{\ln{(1 + \frac{r}{100})}} \Rightarrow\]
\[t = \frac{0.693}{\frac{r}{100}} \Rightarrow\]
\[t = \frac{0.72}{\frac{r}{100}} \Rightarrow\]
\[t = \frac{72}{r}\]

The last few steps are done using the approximations \(0.693 \approx 0.72\) and \(\ln{1+x} \approx x\) for small values of x. We are able to do this as the rule of 72 is only an approximation.

3. \(t_h = - \frac{\ln{\frac{1}{2}}}{k} = \frac{0.693}{k}\)

4.

\[\frac{dy}{dt} = y(100 - y) \Rightarrow\]
\[\frac{1}{y(100 - y)}dy = dt\]
\[\frac{1}{100} \int \frac{1}{y} + \frac{1}{100 - y} \,dy = \int \,dt \Rightarrow\]
\[\frac{1}{100} \ln{\frac{y}{100 - y}} = t + c \Rightarrow\]
\[e^{\ln{\frac{y}{100 - y}}} = e^{100t + 100c} \Rightarrow\]
\[\frac{y}{100 - y} = Ce^{100t \Rightarrow}\]
\[y = 100Ce^{100t} - yCe^{100t} \Rightarrow\]
\[y + yCe^{100t} = 100Ce^{100t} \Rightarrow\]
\[y = \frac{100Ce^{100t}}{1 + Ce^{100t}}\]

Now that we have the general solution, we can plug in \(y_0 = 5\) and \(t = 5\) to find the value of \(C\).

\[(5) = \frac{100Ce^{100(0)}}{1 + Ce^{100(0)}} \Rightarrow\]
\[5 = \frac{100C}{1 + C} \Rightarrow\]
\[5 + 5C = 100C \Rightarrow\]
\[5 = 95C \Rightarrow\]
\[C = \frac{1}{19}\]

The final solution is

\[y = \frac{100e^{100t}}{19(1 + (\frac{1}{19})e^{100t})}\]