Eliminating Variables

When you write down a set of simultaneous equations in the Wolfram Language, you are specifying a collection of constraints between variables. When you use (RefLink[Solve, paclet:ref/Solve]), you are finding values for some of the variables in terms of others, subject to the constraints represented by the equations.

Eliminating variables.

Here are two equations involving x, y and the "parameters" a and b:

eqn={x+y==6a+3b,y==9a+2 x}

If you solve for both x and y, you get results in terms of a and b:

Solve[eqn,{x,y}]

Similarly, if you solve for x and a, you get results in terms of y and b:

Solve[eqn,{x,a}]

If you only want to solve for x, however, you have to specify whether you want to eliminate y or a or b. This eliminates y, and so gives the result in terms of a and b:

Solve[eqn,{x},{y}]

If you eliminate a, then you get a result in terms of y and b:

Solve[eqn,{x},{a}]

In some cases, you may want to construct explicitly equations in which variables have been eliminated. You can do this using (RefLink[Eliminate, paclet:ref/Eliminate]).

This combines the two equations in the list eqn, by eliminating the variable a:

Eliminate[eqn,a]

This is what you get if you eliminate y instead of a:

Eliminate[eqn,y]

As a more sophisticated example of (RefLink[Eliminate, paclet:ref/Eliminate]), consider the problem of writing (x^5)+(y^5) in terms of the "symmetric polynomials" x+y and xy.

To solve the problem, we simply have to write f in terms of a and b, eliminating the original variables x and y:

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

In dealing with sets of equations, it is common to consider some of the objects that appear as true "variables", and others as "parameters". In some cases, you may need to know for what values of parameters a particular relation between the variables is always satisfied.

Solving for parameters that make relations always true.

This finds the values of parameters that make the equation hold for all x:

SolveAlways[a+b x+c x^2==(1+x)^2,x]

This equates two series:

Series[a Cos[x]+b Cos[2x]+Cos[3x],{x,0,3}]==Series[Cosh[x],{x,0,3}]

This finds values of the undetermined coefficients:

SolveAlways[%,x]