Prove the marginal rate of substitution more generally, that is given

(a) $L\left(x_{1}, x_{2}, \ldots, x_{n}\right)=f\left(x_{1}, x_{2}, \ldots, x_{n}\right)+\lambda\left(a_{1} x_{1}+a_{2} x_{2}+\cdots+a_{n} x_{n}\right)$

then $$\frac{a_{i}}{a_{j}}=\frac{\frac{\partial f}{\partial x_{i}}}{\frac{\partial f}{\partial x_{j}}}$$

at the optimal point.

(b) $L\left(x_{1}, x_{2}, \ldots, x_{n}\right)=a_{1} x_{1}+a_{2} x_{2}+\cdots+a_{n} x_{n}+\lambda f\left(x_{1}, x_{2}, \ldots, x_{n}\right)$

then

$$\frac{a_{i}}{a_{j}}=\frac{\frac{\partial f}{\partial x_{i}}}{\frac{\partial f}{\partial x_{j}}}$$

at the optimal point.