0102.mws
Module 1 : Algebra
102 : Simplify & Substitute
O B J E C T I V E
The objective of this module is to learn about variables and some of the common algebraic operations that can be performed on an algebraic expression. We can simplify expressions, factor and expand expressions, and substitute values for the variables in expressions,
______________________________________________________________________
A. Variables & Expressions
__________________________________________________________________________________
In this section we'll learn about variables, expressions, and evaluation. In the previous module 201, we worked only with numbers. However, operations with variables can be performed just as easily.
Note that the remarkable in these expression are unknowns and are dealt with purely symbolically.
>
3 + 4*x; x^2; 1/(x-2);
Any meaningful combination of variables and numbers is an algebraic expression. Remember that multiplication in Maple is accomplished by using the * character, not juxtaposition as we normally do in mathematics. In other words, to write 5x2 + 7x, you would write 5*x^2 + 7*x. One of the most common mistakes in Maple is to forget to use the star for multiplication - for example, writing that last expression incorrectly as 5x^2 + 7x.
A1 Write the following expressions in Maple
A. 1 - 2x B. 3x + 5y + 8 C. 9x2 - 4
D. (2x 3)(4x + 5) (hint there are three multiplications occurring here)
E. 1/(x + 7)
You can also define a variable to be equal to a certain value using :=. In a sense, the variables become constants because Maple will remember their values from that point on. Any expressions including these values will be computed numerically.
>
a := 29 ;
>
x := 73.45;
>
a + x; a*x; a/x;
Variable names in Maple are not limited to single characters as commonly done in mathematics. Variable names can be more descriptive of the values they represent. However they must begin with a character and must not include any blanks spaces within the name.
>
gas_pressure := 13.25;
>
interest_rate := .08125;
>
profit = revenue - cost;
Be careful, Maple is case sensitive. Maple makes a distinction between upper and lower case.
Be careful not to hit the shift key accidentally. In the first example, the values of x and X are completely different!
>
x := 33; X := 200;
>
x+x; X+X; x+X;
In the next example, Maple knows that rate is 10, but does not recognize the new variable Rate. Rate and rate are treated as two different variables.
>
rate := 10; Rate + rate;
If you give a value to a variable, Maple will remember it, and use it in any expression that uses that variable.
>
a := 3; b := 5;
>
a + b; a^2 + b^2;
The only drawback is that these letters are now associated with those numbers. The only way to reset them to be indefinite variables again is to use the restart command or use the strange looking command :
>
a := `a`; b := `b`;
>
a + b; a^2 + b^2;
______________________________________________________________________
B. Substituting Values
__________________________________________________________________________________
A safer method of substituting values for variables is to use the subs command. With this command, you can replace variables in algebraic expressions, without permanantly changing the values of the variables.
>
restart;
>
subs( x = 19, x^7 - 31*x^6);
You can also give a name to an expression to make it more convenient to refer to.
Here, we define an expression and name it expr.
We substitute 5 for x in the expression and find the result
Next we evaluate at x=2 and x=0, and compute those results.
>
expr:=(2*x + 1)/(5-3*x);
>
subs( x = 5, expr);
>
subs( x = 2, expr);
>
subs( x = 0, expr);
You can even substitute other variables or expressions for a variable.
>
subs( x = distance, expr);
>
subs( x = a+3, expr);
>
simplify(%);
You can also substitute into multivariable expressions at one time.
>
expr:=(7*x - 3)/(1 + x^2 - y^2);
>
subs( {x = 5, y = 2}, expr);
>
subs( {x = A, y = B}, expr);
>
subs( {x = a+3, y = a-3}, expr);
______________________________________________________________________
C. Factor Expressions
__________________________________________________________________________________
Recall that Maple can factor numbers, into primes.
>
ifactor( 1234567890 );
Just as easily, Maple can factor algebraic expressions
>
factor( x^2 -7*x -12);
>
factor( x^3 - 4*x^2 -3*x + 12);
Prime polynomials can't be factored using rational numbers even using Maple!
>
factor( x^2 -x + 5);
A slightly more sophisticated way of doing this, is to name an expression and then factor it separately. For example, is the expression a4b7c-3 + a-4b6c-2. Its useful to apply a liberal does of parentheses to this expression to make sure that the exponents and products come out as they should. Since it would be easy to make a mistake, its a good idea to view the original AND the factored form we are seeking.
>
expr := (a^4)*(b^7)*(c^(-3)) + (a^(-4))*(b^6)* (c^(-2)):
The colon ( rather than semi-colon) allows the command to be executed
Factored expression Note that we can see both the original and the factored form!
Original expression
>
expr = factor( expr );
>
expr := r^7 - 3*r^5 + 2*r^3 :
>
expr = factor( expr );
C1. Factor each of these polynomials (Hints : remember to use * for multiplication and ^ for exponents, also help yourself to as many parentheses as you need.)
A.
B.
C.
D.
E.
F.
G.
H.
______________________________________________________________________
D. Expanding Expressions
__________________________________________________________________________________
Maple can operate in both directions - factoring expressions (taking them apart) and expanding expressions (putting them back together).
If we raise an expression to a power, Maple returns the same expression verbatim.
>
(x - 2) ^ 10;
If we want to actually multiply the powers out and see the result, we use the expand command.
>
expand( (x - 2) ^ 10 );
You could do this by hand, but it would take a long time! Here is a slightly more sophisticated way of doing it :
>
(a - 2*b) ^ 10; % = expand(%);
D1. Expand these expressions
A. (5x - 1)^13 B. (x^2 + x + 1)10 C. (x-2)(x+3)(x-4)(x+5)
______________________________________________________________________
E. Simplifying Expressions
__________________________________________________________________________________
Many of the problems in algebra involve simplifying expressions. Maple will automatically simplify some that are relatively easy.
>
3*(x-1) + 7*(x+2) - 5*(x+11);
However, more complicated expressions will not simplify automatically.
>
3*(x-1)^2 + 7*(x+2)^3 - 5*(x+11)^4;
We need to tell Maple that we want to simplify this expression.
>
simplify(%);
Maple can also simplify rational and root expressions.
>
7/(x-3) + 4/(x+5): % = simplify( % );
>
sqrt(x+3) - 2/sqrt(x+3): % = simplify(%);
E1. Simplify
A. 1/(x^2 + 19*x + 90) + 1/(x^2 - 81) B. 4*(2*x+9)^2 - 5*(8-x)^2
>