The maximization problem is:
Maximize $u(x_1, x_2) = \min[a_1x_1, a_2x_2]\; \ \text{s.t.}\;\; p_1x_1 + p_2x_2 \leq$ $w$, in which $x_i, p_i$ is the amount and price of good $i$, $w$ is the total budget available.
What I have been told to deal with this $\min[.,.]$ function is to solve it graphically. It's very easy to see on the graph that the maximization happens when $a_1x_1 = a_2x_2$. But I wonder if there is a way to solve this algebraically? I'm stumped at the first step, which is to derive $\dfrac{\partial u(x_i)}{\partial x_i}$.