Demand for utility function given prices and budget I have to find the consumer's demand at prices $\textbf{p} = (1,1,1)$
and budget $m=4$ when the utility function is given by
$$u(x_1,x_2,x_3) = 3 \sqrt{x_1+x_2+2x_3}$$ or when transformed
$$\hat{u}(x_1,x_2,x_3) = x_1+x_2+2x_3 $$

I know the answer is $\textbf{x} = (0,0,4)$


What I don't understand: For perfect substitutes the demand is given by $x_1^* = \frac{m}{p_1}$ so the demand should have been
   $\textbf{x} = (4,4,4)$. But why is $x_1^*,x_2^* = 0$?


For the same utility function I want to find the demand at prices
$p=(2,3,p_3) &gt;&gt;0$ and budget $m&gt;0$.

The answer is  \begin{equation} \textbf{x} = \left(0,0,
    \frac{m}{p_3} \right) \quad \text{when} \quad p_3&lt;4 \end{equation}
\begin{equation} \textbf{x} = \left(\frac{m}{2},0,0 \right) \quad
    \text{when} \quad p_3&gt;4 \end{equation} \begin{equation} \textbf{x} =
    \left(\frac{\alpha m}{2}, 0, \frac{(1-\alpha)m}{4} \right) \quad
    \text{when} \quad p_3=4 \end{equation}
where $\alpha \in [0,1]$ because the consumer is indifferent between the bundles


What I don't understand: Why is the demand different depending on what $p_3$ is and how do I know when the demand is different? Personally, I would've said the demand is $\textbf{x} = \left( \frac{m}{2}, \ \frac{m}{3}, \ \frac{m}{p_3} \right)$
Regarding the first question, @Oliv suggestion in the comments to formally write down the consumer's problem, budget constraint, Kunh-Tucker multipliers and all, and solve it (carefully -linear objective functions easily mislead when we are used to deal with non-linear ones), is the way to go in order to see how the mathematical set-up will lead you to the answer that stares you in the face:

Our purpose here is to maximize the utility index. Given unitary prices, isn't it obvious that the multivariable function

$$\hat{u}(x_1,x_2,x_3) = x_1+x_2+2x_3$$

will take its maximum value if we purchase only good $x_3$? For any tiny amount $\Delta x_3$ of $x_3$ that you don't purchase, you lose $2\Delta x_3$ in utility terms, while you gain (in utility terms) only $\Delta x_1 + \Delta x_2 = \Delta x_3$ for any combination of $\Delta x_1$ and $\Delta x_2$. Since $2\Delta x_3 &gt; \Delta x_3$ it will be suboptimal to purchase anything else than $x_3$. That was the "plain logic" part, and I hope it answers the "what I don't understand..." aspect of your question. Put the model in math to reconcile this obvious arithmetic with the formal approach.