Rewriting Equations to Substitute Variables

To rewrite equations to substitute variables, tap the "Substitute" button and follow the prompts, or use the "substitute" command.

The "substitute" command is used to solve simultaneous equations using the method of substitution.  The specified equation is solved in terms of the variable, and the resulting right-hand-side is used to replace all occurrences of the variable in other equations.

If no equation number is specified, the program automatically chooses an equation containing the variable.

If neither parameter is specified, the program examines the simultaneous  equations and their unknowns to choose a variable and corresponding equation for substitution.  Substitution only occurs if the system can be simplified.

The Method of Substitution

> x+y=3

> x=2y

> info

2 equations in 2 variables (0 locked) with 2 unknowns.

* Unresolved equations and their unknowns:

(Eq. 1) x+y=3 {xy}
(Eq. 2) x=2y {xy}

* Unknown variables:

x y

If an equation can be rewritten such that the substitutions performed on it would reduce the number of unknowns by one, it might reduce the number of unknowns to exactly one, and start a cascade of solutions.  For example, "x" can be defined solely in terms of "y" and substituted in the other equation to reduce its number of unknowns down to one:

> list

 (Eq. 1)

          x + y = 3

 (Eq. 2)

              x = 2 y

> substitute x using 2

               x = 2 y

   Substituting (2y) for 'x' in x+y=3...

         2 y + y = 3

   Substitution leaves 2y+y=3

   Solving for y:

         2 y + y = 3

       y (2 + 1) = 3

             3 y = 3

           y (3) = 3

               y = 1

       y = 1

   Eliminate 'x'?  y/[n]:

 * 'x' not eliminated.

               x = 2 y

       x = 2

> list

 (Eq. 1)

              x = 2 y

       y = 1
      x = 2

After a substitution is performed, the program offers the option to eliminate the substituted variable.

The same problem can be solved semi-automatically by only telling the "substitute" command which variable should be substituted.  The program examines the system of equations and chooses an equation to drive the substitution.

> clear all

> remove all

> x+y=3

> x=2y

> substitute x

 * Automatic substitution of 'x' using x=2y...

x = 2 y


 Substituting (2y) for 'x' in x+y=3...

         2 y + y = 3


   Substitution leaves 2y+y=3

   Solving for y:

         2 y + y = 3

       y (2 + 1) = 3

3 y = 3

           y (3) = 3

y = 1

       y = 1

   Eliminate 'x'?  y/[n]:


 * 'x' not eliminated.

x = 2 y

       x = 2

 * No more automatic substitutions found.

> list

 (Eq. 1)
x = 2 y

       y = 1
       x = 2

Sometimes a problem can be solved completely automatically, without specifying a variable or an equation.  However, there is no guarantee that the program will automatically choose the "simplest" variable or equation!

> clear all

> remove all

> x+y=3

> x=2y

> substitute

* Automatic substitution of 'y' using x=2y...

Solving for y:

x = 2 y

2 y = x

y (2) = x

x
y = -
2


Substituting (x/2) for 'y' in x+y=3...

x
x + - = 3
2


Substitution leaves x+x/2=3

Solving for x:

x
x + - = 3
2

/ 1\
x ( 1 + - ) = 3
\ 2/

3
x = -----
1
1 + -
2

x = 2

Eliminate 'y'? y/[n]:


* 'y' not eliminated.

x
y = -
2

y = 1

* No more automatic substitutions found.

> list

(Eq. 1)
x
y = -
2


x = 2
y = 1

If the program does not find a substitution that would result in an equation having fewer unknowns, it will not do an automatic substitution...

> clear all

> remove all

> F=32+9/5C

> C+273=K

> info

   2 equations in 3 variables (0 locked) with 3 unknowns.

 * Unresolved equations and their unknowns:

   (Eq. 1)   F=32+9C/5   {FC}
   (Eq. 2)   273+C=K     {CK}

 * Unknown variables:

   F C K

> substitute

 * No more automatic substitutions found.

However, substitutions can always be forced by specifying both the variable and the equation.  The program will not permit nonsense substitutions:

> substitute K

 * ERROR: No multiple occurrences of 'K'

Since "C" appears in multiple equations, its substitution can be forced:

> substitute C using 2

   Solving for C:

         273 + C = K

               C = - 273 + K


   Substituting (-273+K) for 'C' in F=32+9C/5...

9 (K - 273)
F = 32 + -----------
5


   Substitution leaves F=32+9(K-273)/5

   Eliminate 'C'?  y/[n]: y


 * 'C' eliminated.

> list

 (Eq. 1)
9 (K - 273)
F = 32 + -----------
5

Although "C" was eliminated in this case to help streamline the system of equations, it could have been preserved to retain its relationship to other variables.  The program lets the user decide if the substituted variable should be eliminated or preserved.