# The Substitute Command

The Substitute commnand provides a way to substitute one expression for another in a target expression. A simple example would be substituting x = y + 1 into the expression x - 2y = 3 to get (y + 1) - 2y = 3. Using this command is a two step process where we first select the expression that defines the substitution (normally an equality) and put it on the clipboard using the normal Copy functionality, then highlight the target expression and apply the Substitute command. The keystroke for the Substitute command that applies this substitution to the target expression is "b".

After we put the expression x = y - 1 on the clipboard, The Substitute command retrieves the expressions on the clipboard and makes the approriate substitution in the highlighted expression.

For example, x = y + 1 can be used to replace both instances of x in the second expression with y + 1.

More than one equality can be active at the same time (see The Clipboard Viewer for more information). In this case, each of the equalites is used in turn, to make substitutions into the highlighted expression. You can also highlight more than one expression to be the target of a substitution.

To make a substitution:

1. Highlight x = y + 1, then press "Ctrl + C" to copy this expression to the clipboard. Alternately, you can select any expression that is already shown in the clipboard viewer to make it the active expression. At this point, if you open the Clipboard Viewer by selecting Clipboard from the View menu (Shift + F4) you will see something like:

2. Highlight the expression or expressions into which the substitution should be made and press "b". The substitute command retrieves the active expression(s) from the clipboard and makes the substitution in the highlighted expressions. In this case, x is replaced by y + 1 to result in: