Demand for minimum of $4$ different goods The consumer has the utility function with $4$ goods $$U=\min\left \{ \sqrt{x+y},z+w \right \}$$ The prices are $p=(3,2,2,1)$ with wage $m=1$.

Find the demand.

So far I have observed that it is perfect complements BUT it must be between the 4 goods. So some combination of $x,y$ to $z,w$. Usually we know that the optimal choice is when $x_2=x_1$ with demand $x_{1,2}=m/(p_1+p_2)$(but with 4 goods, I lose my grib. How do I approach this? Do I just square the right side and let both equal eachother?
You can solve it sequentially by noting the nesting structure of the utility function $U$.
So first note that the utility function combines utility functions you are probably already familiar with $U=\min\{u_1,u_2\}$ of complements and $u_1=\sqrt{x+y}$ and $u_2 = z+w$ both of which are perfect substitutes. Where $u_1$ and $u_2$ are nested within $U$.
The solution procedure is based on the following argument: However much money $m_{u_1}$ the agent decides to spend on $u_1 =\sqrt{x+y}$ she must be minimizing the cost of getting $u_1$ utility points. Similarly, however much money $m_{u_2}$ the agent spends on $u_2= z + w$ it must be the case that the agent minimize cost. So first find the expenditure functions for these inner problem.
Secondly the agent must the maximize the outer utility $\min\{u_1,u_2\}$ subject to the expenditures of the inner problems adding up to total income.
Solve the second inner problem:
The second inner problem is
$$max_{z,w} \{z+w \lvert p_zz+p_ww\leq m_{u_2}\},$$
where $m_{u_2}$ is money spend on $u_2$.
How do you get the most utility for the buck when utility is $u_2 = z + w$? You simply buy the cheapest good so the price of one point of $u_2$ utility is $p_{u_2} := \min\{p_z,p_w\}$. The demand for $z$ and $w$ depends on the amount of money you decide to spend on $u_2$ assumed for now to be $m_{u_2}$. Given this amount demand for $z$ is
$$z = \frac{m_{u_2}}{p_z} 1[p_z &lt;p_w]$$
and
$$w = \frac{m_{u_2}}{p_w} 1[p_w &lt;p_z].$$
I leave it to you to handle the threshold case where $p_z=p_w$. How much utility $u_2$ do you get? Well this must be $u_2 = m_{u_2}/\min\{p_z,p_w\}$ - this is the value function for this inner utility maximization problem - hence it must be the case that
$$m_{u_2} = \min\{p_z,p_w\} u_2,$$
which is the expenditure function for this inner problem.
Solve the first inner problem:
The first inner problem is
$$max_{x,y} \{\sqrt{x+y} \lvert p_xx+p_yy\leq m_{u_1}\},$$
where $m_{u_1}$ is money spend on $u_1$.
How do you get the most utility for the buck when utility is $u_1 = \sqrt{x+y}$? It is perfect substitutes so you buy the cheapest good so demand is
$$x = \frac{m_{u_1}}{p_x} 1[p_x &lt;p_y]$$
and
$$y = \frac{m_{u_1}}{p_y} 1[p_y &lt;p_x],$$
where $m_{u_1}$ is amount of money spend on $u_1$ assumed known. How much utility $u_1$ do you get? That must be $u_1 = \sqrt{m_{u_1}/\min\{p_x,p_y\}}$ such that
$$m_{u_1} = \min\{p_x,p_y\} u_1^2$$
Solve outer problem:
The outer problem is
$$\max_{u_1,u_2}: \ \ \  \min\{u_1,u_2\}  \\[8pt] 
s.t. \ \ \ \ m_{u_1} + m_{u_2} = m $$
for which we rewrite the budget constraint to
$$\min\{p_x,p_y\} u_1^2 + \min\{p_z,p_w\} u_2 = m$$
and then use that $u_1=u_2$ because the problem is perfect complements. You then have two equations in two unknowns $u_1$ and $u_2$. Solve for $u_1$ and $u_2$ and plug solutions back into expenditure functions for inner problems to get $m_{u_1}$ and $m_{u_2}$ which you then plug into the equations for the demand.