# Is it possible to derive indifference curves given marshallian demand function?

In a two good world, will a marshallian demand function the likes of D(p,m) where p is the price of one good and m the income yield a utility function or indifference curve function? If so, how does one go about solving this?

Several other technical conditions are required, but the most economically substantive condition is that the Slutsky matrix must always be symmetric and negative semidefinite. To be concrete, if we define the $ij$th element of the Slutsky matrix at $(p,m)$ to be $$\sigma_{ij}(p,m)=\frac{\partial D_i(p,m)}{\partial p_j}+D_j(p,m)\frac{\partial D_i(p,m)}{\partial m}$$ then we must have $\sigma_{ij}(p,m)=\sigma_{ji}(p,m)$ for all $(p,m)$, and also for any vector $v$ we must have for all $(p,m)$ $$\sum_i \sum_j \sigma_{ij}(p,m)v_iv_j \leq 0$$ The necessity of these conditions follows immediately from basic consumer theory, which shows that if Marshallian demand is derived from constrained maximization of a utility function, then the Slutsky matrix is symmetric and negative semidefinite. But the sufficiency of these conditions (in conjunction with some other technical assumptions) for us to back out a utility function is a more complicated matter, and to get the details I recommend Border's notes or some other advanced micro source.
If, assuming that the Slutsky conditions hold, you want a rough practical way (ignoring the technical subtleties) to back out indifference curves in the typical two-good case, the simplest way is probably to use your knowledge of demand to determine the compensating change in expenditure that is necessary to adjust for a given change in prices. Specifically, for either $i=1,2$ use the identity $$\frac{\partial e(p,u)}{\partial p_i} = h_i(p,u) = D_i(p,e(p,u))$$ which, given knowledge of the Marshallian demand function $D$, is a differential equation in the expenditure function $e$. Starting with some initial values $(\bar{p},\bar{m})$ that produce some unknown utility $\bar{u}$, we know that $e(\bar{p},\bar{u})=\bar{m}$. Then, varying $p_1$, we can integrate the above differential equation for $i=1$ to obtain $e(p_1,\bar{p}_2,\bar{u})$ for any $p_1$. And then we can get the Hicksian demand vector $$h(p_1,\bar{p}_2,\bar{u})=D(p_1,\bar{p}_2,e(p_1,\bar{p}_2,\bar{u}))$$ for any $p_1$.
Since these Hicksian demands all correspond to the same utility $\bar{u}$, they are on the same indifference curve. By varying $p_1$, we will be able to trace out many different points on this indifference curve. In fact, if demand is sufficiently well-behaved, then we can trace out the entire indifference curve by varying $p_1$ enough in either direction. (By the way, "tracing indifference curves" is all we can do in any event: since the cardinality of utility is irrelevant to Marshallian demand, we can only retrieve ordinal properties like indifference curves and their ordering.)