# Total Differential of a Utility Function Subject to a Budget Constraint

I am trying to fully understand the process of maximizing a utility function subject to a budget constraint while utilizing the Substitution Method (as opposed to the Lagrangian Method). I am following the work of Henderson and Quandt's Microeconomic Theory (1956).

My confusion lies with obtaining the total differential of the generalized utility function after substituting in the budget constraint. For example, suppose you have the following utility function:

$$U=f(q_1,q_2)$$ Subject to: $$y^0=p_1q_1+p_2q_2$$

The total differential of this utility function is:

$$dU=f_{q_1}dq_1+f_{q_2}dq_2$$

where $f_{q_1}$ and $f_{q_2}$ are the partial derivatives of $U$ with respect to $q_1$ and $q_2$, and $dq_1$ and $dq_2$ are the changes in $q_1$ and $q_2$.

Substituting the budget constraint into the utility function results in: $$U=f(q_1,\frac{y^0-p_1q_1}{p_2})$$

I am struggling to calculate the total differential of the above function. Would the total differential just be the partial derivative of $U$ with respect to $q_1$ multiplied by the change in $q_1$? Below is my attempt:

$$U=f(q_1,\frac{y^0}{p_2}-\frac{p_1}{p_2}q_1)$$ $$dU=f_{q_1}dq_1-\frac{p_1}{p_2}dq_1$$

The next step in the book (after skipping the above total differential) is: $$\frac{dU}{dq_1}=f_1+f_2(-\frac{p_1}{p_2})=0$$

Obviously, my intermediate calculation is incorrect (probably in multiple ways). Can someone identify and clarify my mistakes in progressing from the substituted utility function to the above equation? I understand that this process is used to equate the marginal rate of substitution to the goods price ratio and I am aware of its interpretation. My question lies simply with the mathematical derivation.

In the second term of the intermediate calculation we must find the partial derivative of the entire second parameter of the $f$ function. Hence $$dU = \frac{\partial f}{\partial{q_1}}dq_1+\frac{\partial f}{\partial (\frac{y_0-p_1q_1}{p_2})}d(\frac{y_0-p_1q_1}{p_2})$$. Obviously this is a substitution of $q_2$ into the original total differential derivation you had. My point is that you tried to do the partial differential of $f$ with respect $q_2$ by assuming that this would equal $$\frac{dq_2}{dq_1}$$ when this may not always be the case. For the final equation that you have may want to consider the chain rule. The way you have it, we have defined $$U=f(q_1, q_2)$$ and $$q_2(q_1)=\frac{y_0}{p_2}-\frac{p_1}{p_2}$$ Then according to the chain rule you have $$\frac{dU}{dq_1}=\frac{\partial f}{\partial q_1}\frac{dq_1}{dq_1}+\frac{\partial f}{\partial q_2}\frac{dq_2}{dq_1}$$ Then we evaluate $$\frac{dq_1}{dq_1}=\frac{d}{q_1}q_1=1$$ Then we get $$\frac{dU}{dq_1}=\frac{\partial f}{\partial q_1}+\frac{\partial f}{\partial q_2}\frac{dq_2}{dq_1}$$ Then, $$\frac{dq_2}{dq_1}=-\frac{p_1}{p_2}$$ Finally we end up with $$\frac{dU}{dq_1}=f_1+f_2(-\frac{p_1}{p_2})$$