<>= ## p = a - b * x p <- sample(5:15, 1) fctr <- sample(c(2, 4, 5, 10), 1) x <- sample(5:15, 1) * fctr b <- sample(1:5, 1) / fctr a <- p + b * x ## elasticity sol <- -1/b * p/x @ \begin{question} Consider the following inverse demand function: $p(x) = \Sexpr{a} - \Sexpr{b} \cdot x$ for the price $p$ given the demanded quantity $x$. What is the price elastiticy of demand at a price of $p = \Sexpr{p}$? \end{question} \begin{solution} First, we obtain the demand function by inverting the inverse demand function: $x = D(p) = (\Sexpr{a} - p)/\Sexpr{b} = \Sexpr{fmt(a/b, 6)} - \Sexpr{fmt(1/b, 6)} \cdot p$. Then, at $p = 5$ the price elasticity of demand is $$ \frac{D'(p)}{D(p)} p = \frac{-\Sexpr{fmt(1/b, 6)}}{\Sexpr{x}} \Sexpr{p} = \Sexpr{fmt(sol, 6)}. $$ \end{solution} %% \extype{num} %% \exsolution{\Sexpr{fmt(sol, 3)}} %% \extol{0.01} %% \exname{price elasticity of demand}