%% Eliminate Variables from Polynomial Equations
% Create two polynomial equations that contain the variables x and y.

syms x y
eqns = [2*x+y == 5; y-x == 1]

% Eliminate the variable x from the equations. The result is a symbolic expression that is equal to zero.

expr = eliminate(eqns,x)

% Now, create three polynomial equations that contain the variables x, y, and z. Eliminate the variable x. The result is a vector of symbolic expressions that is equal to zero.

syms z
eqns = [x^2 + y-z^2 == 2;
        x - z == y;
        x^2 + y^2-z == 4];
expr = eliminate(eqns,x)

% To eliminate both x and y, use the eliminate function and specify the two variables as the vector [x y].

expr = eliminate(eqns,[x y])

%
% Copyright 2018 The MathWorks, Inc.