I have a sort of theoretical question that has an application to a problem I am doing. I have been asked the question in the title. Given a three good economy on $\mathbb{R}^3$ and a consumer's Marshallian demand for goods $x_1$, $x_2$ I need to find the demand for $x_3$ given the fact that the consumer is maximizing locally non-satiated preferences.
So consider two demand functions $x_1(p, y)$ , $x_2(p,y)$ that I am given. I want to find $x_3(p,y)$. I believe that under local non-satiation we know the solution lies on the budget constraint ie
$$x \cdot p = y$$
or
$$x_1(p, y)p_1 + x_2(p,y)p_2 + x_3(p,y)p_3 = y$$
Which means we can solve for $x_3(p,y)$ trivially.
$$x_3{p,y} = \frac{1}{p_3} \left( y - x_1(p, y)p_1 + x_2(p,y)p_2\right)$$
Is the correct approach?