Elementary Algebra (Lec01)

yukita@k.hosei.ac.jp

•Expand and Factor

f = x^3 + x^2 + x + 1 ; g = x - 1 ;

f * g

(-1 + x) (1 + x + x^2 + x^3)

Expand[f * g]

-1 + x^4

Factor[x^4 - 1]

(-1 + x) (1 + x) (1 + x^2)

Factorization over Z[I], where I=Sqrt[-1].

Factor[x^4 - 1, Extension -> {I}]

(-1 + x) (-i + x) (i + x) (1 + x)

Algebra modulo p.

Factor[x^3 + x + 1]

1 + x + x^3

Factor[x^3 + x + 1, Modulus -> 3]

(2 + x) (2 + x + x^2)

Expand[(x + 1)^2, Modulus -> 2]

1 + x^2

•Collect

Collecting like terms.

f = a b^3 + a^2 b + a (b + 3) + a b

a b + a^2 b + a b^3 + a (3 + b)

Collect[f, a]

a^2 b + a (3 + 2 b + b^3)

Collect[f, b]

3 a + (2 a + a^2) b + a b^3

•Together, Apart, and Cancel

f = 1/(x - 1) + 1/(x + 1)

1/(-1 + x) + 1/(1 + x)

g = Together[f]

(2 x)/((-1 + x) (1 + x))

Apart[g]

1/(-1 + x) + 1/(1 + x)

f = (x^2 - 1)/(x - 1)

(-1 + x^2)/(-1 + x)

Cancel[f]

1 + x

•Coefficient

f = a0 + a1 x + a2 x^2 + a3 x^3 + a4 x^4

a0 + a1 x + a2 x^2 + a3 x^3 + a4 x^4

Coefficient[f, x^2]

a2

Coefficient[f, x, 3]

a3

g = (1 + x)^3

(1 + x)^3

Coefficient[g, x, 2]

3

•Solve and Reduce

eq = x^2 - 5 x - 6 == 0

-6 - 5 x + x^2 == 0

Solve[eq]

{{x -> -1}, {x -> 6}}

eq = a x^2 + b x + c == 0

c + b x + a x^2 == 0

Solve[eq, x]

{{x -> (-b - (b^2 - 4 a c)^(1/2))/(2 a)}, {x -> (-b + (b^2 - 4 a c)^(1/2))/(2 a)}}

Reduce[eq, x]

x == (-b - (b^2 - 4 a c)^(1/2))/(2 a) && a != 0 || x == (-b + (b^2 - 4 a c)^(1/2))/(2  ... = 0 || a == 0 && b == 0 && c == 0 || a == 0 && x == -c/b && b != 0

System of equations

eqs = {3 x + 4 y == 1, 4 x - 3 y == 2}

{3 x + 4 y == 1, 4 x - 3 y == 2}

Solve[eqs, {x, y}]

{{x -> 11/25, y -> -2/25}}

eqs = {a x + b y == 1, c x + d y == 2}

{a x + b y == 1, c x + d y == 2}

Solve[eqs, {x, y}]

{{x -> -(2 b - d)/(-b c + a d), y -> -(-2 a + c)/(-b c + a d)}}

Reduce[eqs, {x, y}]

x == (2 b - d)/(b c - a d) && y == (2 a - c)/(-b c + a d) && b c - a d != 0 || ... & c != 0 || a == 0 && 2 b == d && c == 0 && y == 2/d && d != 0

•Example 1

Let  C be a hyperbola defined by  x^2-y^2=1.  Let  L be a line defined by  -2x+3y=5.  Find the intersection of  C and L.

<< Graphics ` ImplicitPlot `

g1 = ImplicitPlot[{x^2 - y^2 == 1, -2 x + 3 y == 5}, {x, -8, 8}, DisplayFunction -> Identity]

-Graphics -

Show[g1, DisplayFunction -> $DisplayFunction]

[Graphics:HTMLFiles/index_66.gif]

-Graphics -

eqs = {x^2 - y^2 == 1, -2 x + 3 y == 5}

{x^2 - y^2 == 1, -2 x + 3 y == 5}

sol = Solve[eqs, {x, y}]

{{x -> 1/5 (10 - 3 30^(1/2)), y -> 1/5 (15 - 2 30^(1/2))}, {x -> 1/5 (10 + 3 30^(1/2)), y -> 1/5 (15 + 2 30^(1/2))}}

•Example 2

Find a circle that passes through all the intersection points of C and L (in Example 1), and also passes through point (5,0).

Remove[f]

f[x_, y_] = x^2 + y^2 + a x + b y + c

c + a x + x^2 + b y + y^2

eq1 = (f[x, y] /. sol[[1]]) == 0

1/25 (10 - 3 30^(1/2))^2 + 1/25 (15 - 2 30^(1/2))^2 + 1/5 (10 - 3 30^(1/2)) a + 1/5 (15 - 2 30^(1/2)) b + c == 0

eq2 = (f[x, y] /. sol[[2]]) == 0

1/25 (15 + 2 30^(1/2))^2 + 1/25 (10 + 3 30^(1/2))^2 + 1/5 (10 + 3 30^(1/2)) a + 1/5 (15 + 2 30^(1/2)) b + c == 0

eq3 = f[5, 0] == 0

25 + 5 a + c == 0

sol2 = Solve[{eq1, eq2, eq3}, {a, b, c}]

{{b -> -138/25, a -> -108/25, c -> -17/5}}

g2 = ImplicitPlot[(f[x, y] /. sol2) == 0, {x, -8, 8}, {y, -9, 8}, DisplayFunction -> Identity, PlotStyle -> RGBColor[1, 0, 0]]

-ContourGraphics -

Show[{g1, g2}, DisplayFunction -> $DisplayFunction]

[Graphics:HTMLFiles/index_86.gif]

-Graphics -

•Quotient and Remainder

f = x^5 + x^3 + 1 ; g = x^2 + x + 1 ;

q = PolynomialQuotient[f, g, x]

x - x^2 + x^3

r = PolynomialRemainder[f, g, x]

1 - x

f == Expand[g * q + r]

True

•Exercises

•Problem 1

Let C be a circle defined by  x^2+y^2= 1.  Let  L be a line defined by 3x+4y=5. Find the intersection of C and L.

•Solution

We must solve the following system of equations.

eqs = {x^2 + y^2 == 1, 3 x + 4 y == 5}

{x^2 + y^2 == 1, 3 x + 4 y == 5}

sol = Solve[eqs, {x, y}]

{{x -> 3/5, y -> 4/5}, {x -> 3/5, y -> 4/5}}

We see that the straight line is tangent to the circle.

Show[ {ImplicitPlot[x^2 + y^2 == 1, {x, -2, 2}, DisplayFunction -> Identity], ImplicitPlot[ ... e[0.03], RGBColor[1, 0, 0], Point[{x, y} /. sol[[1]]] }]}, DisplayFunction -> $DisplayFunction]

[Graphics:HTMLFiles/index_100.gif]

-Graphics -

Note that the default point size is 0.008.


Converted by Mathematica  (May 8, 2003)