# Perform Eliminate, Solve and Format at once in Mathematica

I have a series of equations where I use eliminate to get a new equation with desired variables. This equation is then solved for a specific variable and then the result is presented in a specific InputForm. Here is how I am doing it currently.

Eliminate[{f == x^2 + y^2, a == x + y, b == x y}, {x, y}]
2 b + f == a^2

Solve[2 b + f == a^2, b]
{{b -> 1/2 (a^2 - f)}}

Format[b, InputForm] /. {b -> 1/2 (a^2 - f)}
(a^2 - f)/2


So, I copy the result from Eliminate and then solve it for my variable and then copy the output and format it later.

Is there an easier way to do all this? For example, can I somehow specify in a single step the variables I want to eliminate and the variable for which I want to solve the equation and then get the output in InputForm?

I will probably have to do this for a lot of equations. So, copying each output, again and again, gets very tiresome.

Thanks.

• Reduce[{f == x^2 + y^2, a == x + y, b == x y}, {a, b}, {x, y}] Jan 15 at 9:15

b /. First@