Eliminating one or more variables from a list of equations: eliminate

### 5.12.22 Eliminating one or more variables from a list of equations: eliminate

The eliminate command eliminates variables from a list of equations.

- eliminate takes two arguments:
  - eqns, a list of equations.
  - vars, the variable or list of variables to eliminate. The equations can be given as expressions, in which case they will be assumed to be 0.
- eliminate(eqns,vars) returns the equations with the variables vars eliminated or an indication that Xcas can’t eliminate them.

#### Examples.

Assuming the variables used haven’t been set to any values:

- Input:
  eliminate([x = v0*t, y = y0-g*t^2], t)
  Output:

  | ⎡ ⎣ | g x2+y v02−v02 y0 | ⎤ ⎦

- Input:
  eliminate([x+y+z+t-2,x*y*t=1,x^2+t^2=z^2],[x,z])
  Output:

  | ⎡ ⎣ | 2 t2 y2−4 t2 y+t y3−4 t y2+4 t y+2 t+2 y−4 | ⎤ ⎦

If the variable(s) can’t be eliminated, then eliminate returns [1] or [-1]. If eliminate returns [], that means the equations determine the values of the variables to be eliminated.

Examples.

- Input:

  x:=2;y:=-5
  eliminate([x=2*t,y=1-10*t^2],t)

  Output:

  | ⎡ ⎣ | 1 | ⎤ ⎦

  since t cannot be eliminated from both equations.
- Input:

  x:=2;y:=-9
  eliminate([x=2*t,y=1-10*t^2],t)

  Output:

  | ⎡ ⎣ | ⎤ ⎦

  since the first equation gives t=1, which satisfies the second equation.
- Input:

  x:= 2; y:= -9
  eliminate([x = 2*t, y = 1-10*t^2, z = x + y - t], t)

  Output:

  | ⎡ ⎣ | 1,z+8 | ⎤ ⎦

  since the first equation gives t=1, which satisfies the second equation, and so that leaves z = 2 - 9 - 1 = -8, or z + 8 = 0.