# Solving non-linear system of equations using substitution

I have 2 equations, p4a and r4p which relate $$a,p,r$$ and want to see 6 equations relating all ordered pairs of these 3 variables. Below is an example of doing semi-manually by using Eliminate combined with Solve. This approach feels like I'm re-implementing built-in functionality (why was manual Eliminate step necessary here?), is there a simpler way?

p4a = 1/(1 - a);
r4p = 1/(-1 + p);

temp = Eliminate[{p == p4a, r == r4p}, p];
a4r = First@SolveValues[temp, a];
solve[eq_, var_] := Print[var, "=", First@SolveValues[eq, var]];
solve[p == p4a, p]
solve[r == r4p, r]
solve[a == a4r, a]
solve[p == p4a, a]
solve[r == r4p, p]
solve[a == a4r, r]

• Yes, just solve for the three possible pairs. In[331]:= SolveValues[{p == p4a, r == r4p}, {p, r}] Out[331]= {{1/(1 - a), (1 - a)/a}} In[332]:= SolveValues[{p == p4a, r == r4p}, {p, a}] Out[332]= {{(1 + r)/r, 1/(1 + r)}} In[333]:= SolveValues[{p == p4a, r == r4p}, {r, a}] Out[333]= {{1/(-1 + p), (-1 + p)/p}} Apr 5, 2023 at 22:46
• Ahh, so I need to specify all unknowns as "vars", not just the variable I'm solving for Apr 5, 2023 at 23:02
• No, just the ones you are solving for in this case. There are three pairs, so call SolveValues three different ways. Apr 5, 2023 at 23:53
• If I try to solve for a single variable, Solve returns no solutions, so I must specify variables in pairs, that's what confused me Apr 6, 2023 at 0:05
• Generally speaking, n equations requires n variables. Fewer variables than that and it is often generically overdetermined. Empty solution set, unless you give nondefault MaxExtraConditions. Apr 6, 2023 at 3:27

As pointed out in comments, I should list all unknown variables as part of Solve "vars" parameter, not just the ones I'm trying to solve for