First, these equations can be expressed as follows:
In[]:=
ϕ=(r1^(1/3))*(r2^(1/3))*(r3^(1/3))
Out[]=
1/3
r
1
1/3
r
2
1/3
r
3
In[]:=
Grad[ϕ,{r1,r2,r3}]
Out[]=

1/3
r
2
1/3
r
3
3
2/3
r
1
,
1/3
r
1
1/3
r
3
3
2/3
r
2
,
1/3
r
1
1/3
r
2
3
2/3
r
3

In[]:=
exp1=Grad[ϕ,{r1,r2,r3}][[3]]*p1-Grad[ϕ,{r1,r2,r3}][[1]]*p3​​exp2=Grad[ϕ,{r1,r2,r3}][[3]]*p2-Grad[ϕ,{r1,r2,r3}][[2]]*p3
Out[]=
p
1
1/3
r
1
1/3
r
2
3
2/3
r
3
-
p
3
1/3
r
2
1/3
r
3
3
2/3
r
1
Out[]=
p
2
1/3
r
1
1/3
r
2
3
2/3
r
3
-
p
3
1/3
r
1
1/3
r
3
3
2/3
r
2
The next step is to use Mathematica command GroebnerBasis to isolate each r_i  in function of the safe variables K (the invariant of pool) and the prices 
p_i  (assumed to come from a safe oracle):
In[]:=
GroebnerBasis[{ϕ-K,exp1,exp2},{r1,p1,p2,p3},{r2,r3}]
Out[]=
-
3
K
p
2
p
3
+
2
p
1
3
r
1
,
3
K
p
2
p
3
r
1
-
2
p
1
2
r
1

In[]:=
GroebnerBasis[{ϕ-K,exp1,exp2},{r2,p1,p2,p3},{r1,r3}]
Out[]=
-
3
K
p
1
p
3
+
2
p
2
3
r
2
,
3
K
p
1
p
3
r
2
-
2
p
2
2
r
2

In[]:=
GroebnerBasis[{ϕ-K,exp1,exp2},{r3,p1,p2,p3},{r1,r2}]
Out[]=
-
3
K
p
1
p
2
+
2
p
3
3
r
3
,
3
K
p
1
p
2
r
3
-
2
p
3
2
r
3
