The Clear Command

This small demo helps illustrate how to use the Clear command.  The Clear command is used to remove assignments to variables.  For instance, you may assign a value of 3 to a value of x by running the command:

x^2-2x+3

x^2-2x+3==0

x = 3

x^2-2x+3

x^2-2x+3==0

x^2-2x+3==6

But we can also define functions with variables:

F[x_,y_]:= x+y-4*x*y+x^2;

F[x,y]

If for some reason, we want to use the variable x in another context in which it is not equal to 3, we will need to clear that variable of its assignment.  This is where the command Clear[x] comes in.  Note that in the assignment above for F(x,y), the variable x is automatically set to 3 if we had run the command x=3 above.  However, if we now clear the variable x, we can see that the variable x is once again only a variable.

Clear[x]

F[x,y]

F[2,z]

F[3,y]

x=3

Solve[3*x+4==2,x]

Clear[x]

y=12

Clear[x,y]