# Deriving demand function in case of multivariable utility functions with min and max structures

Suppose I have utility function like this: $$u(x_1,x_2,x_3)=min\{x_1,a-x_1\}\times min\{x_2,b-x_2\}+x_3$$ where a and b are real numbers and $$x_1\in [0, a]$$ and $$x_2\in [0,b]$$. What will be a procedure of finding, for example, Marshallian demand $$x(p,w)$$?

My confusion: In case of more simple function without minimum or maximum structures I would simply use Lagrangian to define the demand. However, given function is not differentiable.

My question: can I apply Lagrangian here and, if so, how can I do it? If it is impossible to use Lagrangian in this case, what else sholud I do?

It is possible to use a Lagrangian to obtain your Marshallian demands, provided you break each min function up into two different pieces and remain wary of boundary solutions. So for example, if you impose the condition $$x_1<\frac{a}{2}, x_2<\frac{b}{2}$$ you can simplify your utility function to $$x_1 x_2 + x_3$$, and then solve for Marshallian demands that are valid when this condition holds. Once you've obtained your demand for this piece it's good practice to re-state your condition as a function of the parameters (a, b, w, and $$\textbf{p}$$) Then go back to your original utility function, impose an alternative condition and repeat to get a different piece of the demand. The demand function will be piecewise (and in this case it seems like it'll consist of quite a few different pieces). Good luck!
• Thanks. I thought about this and for me it seemed like very inelegant solution. For example, in my tasks there is the same problem (finding demand function), but with another utility function: $u(x_1,x_2,x_3,x_4)=min\{\sqrt x_1 + \sqrt x_2, max(\sqrt x_3 , 2\sqrt x_4 )\}$. In this situation I will have 4 cases. I hoped that easier way exists. I will try to follow your instructions anyway. Thanks again. Oct 18, 2019 at 17:26